chromiumos/platform/installer.git
14 months agoMove encrypted_import -> src/scripts src/platform/installer. 49/66449/2 master
Don Garrett [Tue, 20 Aug 2013 23:09:07 +0000 (16:09 -0700)]
Move encrypted_import -> src/scripts src/platform/installer.

encrypted_import needs to be installed onto the image, and that's easier to
do from here. Also modified the script (and it's test) to not use common.sh,
though it now imports /usr/share/misc/shflags, which means it only runs
in the chroot or on the device.

Changes to chromeos-install-9999 are forthcoming.

BUG=chromium:275052
TEST=Ran encrypted_import_unittests.

Change-Id: Ifdbf22f1b61a3fd568f6399ea7af4bd27cf285a1
Reviewed-on: https://gerrit.chromium.org/gerrit/66449
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
14 months agoAdded extensions dir to stateful install whitelist. 96/66396/2
Don Garrett [Tue, 20 Aug 2013 18:16:28 +0000 (11:16 -0700)]
Added extensions dir to stateful install whitelist.

BUG=chromium:259593
TEST=None (files in question aren't really built yet)

Change-Id: I466a7f729a801db905a203d1438d8b94635e6559
Reviewed-on: https://gerrit.chromium.org/gerrit/66396
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
14 months agoAdd real EFI support. 69/66169/3
Don Garrett [Sun, 18 Aug 2013 00:56:05 +0000 (17:56 -0700)]
Add real EFI support.

EFI should now work in all cases (install and update), and should boot with
the kernel from the EFI partition used by syslinux instead of the kernel in
/boot on the rootfs. This is needed in some factory processes since /boot
is being removed from official images.

BUG=chromium:275050 chromium:260512
TEST=New Unittest, chromeos-install to EFI system, image_to_live.

Change-Id: If0ab11b5382a4d58654e7d7e004543d1bfce7707
Reviewed-on: https://gerrit.chromium.org/gerrit/66169
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
14 months agoAdd JoinStrings to postinst utils. 04/66004/3
Don Garrett [Thu, 15 Aug 2013 23:17:12 +0000 (16:17 -0700)]
Add JoinStrings to postinst utils.

For EFI changes, I need an inverse to the SplitString utility function, so
add it and add a test for it.

Also rename util_unittest -> inst_util_unittest to match the files it tests.

BUG=chromium:260512
TEST=Ran unittests

Change-Id: If1c6bd92ba3d604809f7e70660d2f1a7a29fc94f
Reviewed-on: https://gerrit.chromium.org/gerrit/66004
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>

14 months agochromeos-install: fix broken recovery flow 83/64783/3 release-R30-4537.B stabilize-4512.B
Liam McLoughlin [Tue, 6 Aug 2013 16:53:40 +0000 (09:53 -0700)]
chromeos-install: fix broken recovery flow

write_gpt was being loaded from ROOT which wasn't mounted in the
case of recovery where we use a payload_image.

BUG=chromium:268685
TEST=Run normal install and recovery

Change-Id: I059a5ff61ef46e65388afdd8097de6f17b90150f
Reviewed-on: https://gerrit.chromium.org/gerrit/64783
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Liam McLoughlin <lmcloughlin@google.com>
Tested-by: Liam McLoughlin <lmcloughlin@google.com>
14 months agoCorrectly report firmware update failure if RO needs update. 42/63842/2
Don Garrett [Wed, 31 Jul 2013 01:42:49 +0000 (18:42 -0700)]
Correctly report firmware update failure if RO needs update.

If the RO Firmware needs updating, the firmware updater will
return a status code of 4. In that case, give a meaningful
log message, and return the error code back to the update engine
which know how to handle it.

BUG=chromium:218555
TEST=Build/unittests. Did NOT test on hardware with bug.

Change-Id: Ieb5c449e2430b0c31cabedc44c3d99ea131635cd
Reviewed-on: https://gerrit.chromium.org/gerrit/63842
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
14 months agoImprove chromeos-install NAND support 20/61520/8
Liam McLoughlin [Thu, 11 Jul 2013 01:06:14 +0000 (18:06 -0700)]
Improve chromeos-install NAND support

 - nandwrite doesn't appear to write things in a way the bootloader
   can read them, so use mtdblock instead
 - Detect zero sized OEM/ESP and then don't copy
 - Post-install still doesn't work, use skip_postinstall for now

BUG=chromium:236941
TEST=chromeos-install --skip_postinstall works

Change-Id: I860d577867a8517cf22b0e985ac27ea95f41f52d
Reviewed-on: https://gerrit.chromium.org/gerrit/61520
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
Commit-Queue: Liam McLoughlin <lmcloughlin@chromium.org>

14 months agochromeos-install: initial mtd support (ubi/nand) 56/49956/9
Mike Frysinger [Thu, 9 May 2013 19:36:36 +0000 (15:36 -0400)]
chromeos-install: initial mtd support (ubi/nand)

This needs a bit more polish before merging, but the bones are there.

BUG=chromium:236941
TEST=`chromeos-install` works on an embedded device

Change-Id: I85a4bdb906984c5da471defb20317ecad98c8876
Reviewed-on: https://gerrit.chromium.org/gerrit/49956
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
Commit-Queue: Liam McLoughlin <lmcloughlin@chromium.org>

14 months agoMake copy onto stateful whitelist more generic. 06/63406/4
Don Garrett [Thu, 25 Jul 2013 23:04:44 +0000 (16:04 -0700)]
Make copy onto stateful whitelist more generic.

We currently copy files in a whitelist onto stateful during installation if
in dev mode. This change readjusts the logic slightly so it's easy to add
more directories to the whitelist, even if not in dev mode.

BUG=chromium:259593
TEST=Many manual installs with/without whitelist entries.

Change-Id: Ie3f648d4584961c97daf8c9e27829e10eb0ddb7a
Reviewed-on: https://gerrit.chromium.org/gerrit/63406
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>

15 months agoMake setgoodkernel work with both EFI and coreboot 44/63044/2 factory-4455.B factory-pit-4471.B firmware-pit-4482.B
Paul Drews [Wed, 10 Jul 2013 00:37:21 +0000 (17:37 -0700)]
Make setgoodkernel work with both EFI and coreboot

The chromeos-setgoodkernel script is used at the end of an
update cycle to mark the booted partition "successful" in
the GUID Partition Table (GPT).  The previous version of
this script was hard-coded to extract the booted partition
from a coreboot-style kernel invocation command-line.  For
boot from UEFI bios, the kernel command line specification
of the booted partition has a slightly different syntax.
This was causing the chromeos-setgoodkernel script to fail
and terminate without doing the "successful" marking.  Since
the autotest procedure looks for this success marker, all
autotests were failing on EFI-boot systems.

This change makes the chromeos-setgoodkernel script work for
both EFI-boot systems and coreboot systems.

BUG=none
TEST=/usr/sbin/chromeos-setgoodkernel ; cgpt show /dev/sda

Change-Id: Idba102db5c1b76235e0b183361b926190aa151c5
Reviewed-on: https://gerrit.chromium.org/gerrit/63044
Tested-by: paul drews <paul.drews@intel.com>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>

16 months agoIgnore empty card reader slots when looking for USB disks 54/60254/2 factory-pit-4390.B firmware-falco_peppy-4389.B firmware-leon-4389.26.B firmware-wolf-4389.24.B stabilize-4443.B
Vadim Bendebury [Thu, 27 Jun 2013 17:44:02 +0000 (10:44 -0700)]
Ignore empty card reader slots when looking for USB disks

Certain card readers (Transcend TS-RDF8W for instance) present
themselves as multiple removable devices, one per card slot, even if
there is no card in the slot. This causes a stall in 'image_to_usb'
flow - the utility stops to ask which device to use even though there
is only one device present.

Checking the size of removable device allows to filter empty slots.

BUG=none
TEST=manual

   . tried running ~/trunk/scripts/image_to_usb.sh in several
     experiments:

    - attach the empty TS-RDF8W card reader, get

      No target device specified, autodetecting...
      ERROR   : No USB/MMC devices could be detected

    (it was showing three phantom devices before the change)

   - plug in an SD card into the reader, get

      No target device specified, autodetecting...
      Found /dev/sdd: TS-RDF8  Transcend    , 15.9 GB

   - plug a USB flash drive into another USB port, get

      No target device specified, autodetecting...
      1) /dev/sdd: TS-RDF8  Transcend    , 15.9 GB
      2) /dev/sdf: Patriot Memory, 8011 MB
      Select a target device:

Change-Id: If1263981505cd4f5d1eb9a9633cb8d8ab1826d13
Reviewed-on: https://gerrit.chromium.org/gerrit/60254
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
16 months agoAdded new pattern to post install for legacy 71/59571/3
Paul Taysom [Fri, 21 Jun 2013 17:37:16 +0000 (10:37 -0700)]
Added new pattern to post install for legacy

Because we are changing the format of UUIDs to confrom with
the linux kernel usage, PARTUUID=%U[/PARNTOFF=%d], we need
to change the post installer for legacy to fill in the uuid
correctly.

Right now, the post installer for legacy doesn't hangle the
kern_guid, so a pattern isn't needed for it.

BUG=chromium:224066
TEST=Installed and ran on Dell Latitude, ran cbuildbot

Change-Id: I44cf29a410abaf1e53cf2a349bea8a9f4255ec7a
Reviewed-on: https://gerrit.chromium.org/gerrit/59571
Tested-by: Paul Taysom <taysom@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Paul Taysom <taysom@chromium.org>

16 months agoOWNERS: drop jaysri 44/60144/2
Mike Frysinger [Wed, 26 Jun 2013 22:05:02 +0000 (18:05 -0400)]
OWNERS: drop jaysri

He has run away from us all.

BUG=None
TEST=None

Change-Id: I6dd779324faa433d6634ef453c787c3b69a97275
Reviewed-on: https://gerrit.chromium.org/gerrit/60144
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
16 months agoUse write_gpt.sh from payload image, if specified 08/58408/2 factory-4290.B release-R29-4319.B stabilize-4287.B
Michael Spang [Wed, 12 Jun 2013 19:04:07 +0000 (15:04 -0400)]
Use write_gpt.sh from payload image, if specified

This fixes running chromeos-install from the chroot, in which case
write_gpt.sh is found within the image mounted at ${ROOT}.

BUG=chromium:217621
TEST=image_to_usb.sh --install

Change-Id: I9c5650dd0a4666c14c0e6740e5d622e5033faa9d
Reviewed-on: https://gerrit.chromium.org/gerrit/58408
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Michael Spang <spang@chromium.org>
Tested-by: Michael Spang <spang@chromium.org>
16 months agochromeos-common.sh: add shebang as documentation of shell standard 52/57352/2 factory-pit-4280.B factory-spring-4262.B stabilize-4255.B
Mike Frysinger [Mon, 3 Jun 2013 18:01:35 +0000 (14:01 -0400)]
chromeos-common.sh: add shebang as documentation of shell standard

This file is used on the device and needs to be usable from POSIX shells.
Add a /bin/sh shebang to document that bash won't work.

BUG=None
TEST=`bash -n chromeos-common.sh` works

Change-Id: Ib95ada29fe5bb52873988ff60cfa9c65939c98b5
Reviewed-on: https://gerrit.chromium.org/gerrit/57352
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
17 months agoReduce sudo calls in chromeos-setgoodkernel 28/56128/3
Don Garrett [Fri, 17 May 2013 21:07:05 +0000 (14:07 -0700)]
Reduce sudo calls in chromeos-setgoodkernel

This both simplifies and should (slightly) speed up chromeos-setgoodkernel
by performing sudo once instead of repeatedly.

BUG=None (found while investigating chromium:198589)
TEST=Unittests, push_live, trybots

Change-Id: Ic98e425ab6efcd6aee1b812de5b09867b022eefe
Reviewed-on: https://gerrit.chromium.org/gerrit/56128
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
17 months agoBackground dev_debug_vboot to speed up chromeos-setgoodkernel. 35/56535/3
Don Garrett [Thu, 23 May 2013 20:52:29 +0000 (13:52 -0700)]
Background dev_debug_vboot to speed up chromeos-setgoodkernel.

dev_debug_vboot adds handy logs to the update_engine.log, but also adds
about 10 seconds to setgoodkernel. This is a problem during OOBE when
the first update is blocked until after setgoodkernel.

This change runs dev_debug_vboot in the background. System logs will still
be created, but not be dumped into the UE log.

BUG=chromium:198589
TEST=unittests, push to manual system + cgpt examination, checked chrome://system/ verified boot

Change-Id: I31c22ced3597afcf6be6372cbda4ddc4bfa6785f
Reviewed-on: https://gerrit.chromium.org/gerrit/56535
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>

17 months agoRunCommand in postinst was confused by signal exit codes. 51/51351/4
Don Garrett [Wed, 15 May 2013 20:40:18 +0000 (13:40 -0700)]
RunCommand in postinst was confused by signal exit codes.

Update postinst RunCommand to more properly deal with exit codes based on
signals.

BUG=chromium:240738
TEST=trybot

Change-Id: Ie2d488950b70b7aa7a6e0a53b16bf6e0c2e09715
Reviewed-on: https://gerrit.chromium.org/gerrit/51351
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
17 months agoRemove excessive sudo's. 33/51233/2
Don Garrett [Tue, 14 May 2013 21:30:12 +0000 (14:30 -0700)]
Remove excessive sudo's.

chromeos-install has been modified to sudo itself if it's not root, so the
rest of the sudo operations are unneccessary.

BUG=chromium:240860
TEST=manual install to CR48, trybots

Change-Id: If2096f07849ede57d7f96641c6b829f22a20c8fb
Reviewed-on: https://gerrit.chromium.org/gerrit/51233
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
17 months agochromeos-install: move hardcoded partition numbers to vars 04/50704/3 factory-4128.B factory-spring-4131.B
Mike Frysinger [Thu, 9 May 2013 19:32:59 +0000 (15:32 -0400)]
chromeos-install: move hardcoded partition numbers to vars

This makes it a bit easier to keep track of what part number to use
as we can refer to the pretty variables.

BUG=chromium:235068
TEST=chromeos-install still works on x86-alex

Change-Id: I2e08d0d4f5a81e483b95e12674d8a88e3e0f00d8
Reviewed-on: https://gerrit.chromium.org/gerrit/50704
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
17 months agochromeos-install: do not run smartctl if it is not installed 45/50345/3
Mike Frysinger [Tue, 7 May 2013 19:09:36 +0000 (15:09 -0400)]
chromeos-install: do not run smartctl if it is not installed

If we're on a system that lacks smartctl (because it doesn't have any
devices that are SMART capable), then don't bother running it.

This also tweaks the badblocks logging style to use `tee`.

BUG=chromium:235068
TEST=ran chromeos-install on embedded and saw an error, but smartctl did not run

Change-Id: Iff80606d07e317fe23e33261e1318514b0dbe4eb
Reviewed-on: https://gerrit.chromium.org/gerrit/50345
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
17 months agoRun hw diagnostics when we fail chromeos-install. 99/49999/3
Chris Sosa [Fri, 3 May 2013 01:19:32 +0000 (18:19 -0700)]
Run hw diagnostics when we fail chromeos-install.

We run hw diagnostics and store them in /tmp. These hw diagnostics
give us the state of the disk. These can be passed to ninjas etc
if a device fails.

BUG=chromium:235068
TEST=Running install on a device -- check logs.

Change-Id: Ibcf80d4cc75d6947fb131879b011045fcf265532
Reviewed-on: https://gerrit.chromium.org/gerrit/49999
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

17 months agochromeos-install: do not check dest removable when we have skipped it 55/49955/3
Mike Frysinger [Thu, 2 May 2013 22:15:50 +0000 (18:15 -0400)]
chromeos-install: do not check dest removable when we have skipped it

We have a --skip_dst_removable flag that the code mostly supports, but
the initial variable setup is done outside of that check.  Move it in
the if statement since that is the only place that uses this variable.

BUG=chromium:236941
TEST=`chromeos-install --skip_dst_removable` no longer checks
TEST=`chromeos-install` still checks and works

Change-Id: I89c582d254f1163d9fd0eca24b66f40d9337f4a7
Reviewed-on: https://gerrit.chromium.org/gerrit/49955
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
17 months agoIf postinst fails, return the firmware failure code to the UE. 38/49338/3
Don Garrett [Thu, 17 Jan 2013 19:30:46 +0000 (11:30 -0800)]
If postinst fails, return the firmware failure code to the UE.

This preserves the error exit code of the firmware updater (if any) as the
result code of postinst.

BUG=chromium:219154
TEST=Unittest, manual push to CR48.

Change-Id: Ic7bd042f237964e574ba532700a32ecb10d45dc0
Reviewed-on: https://gerrit.chromium.org/gerrit/49338
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>

17 months agochromeos-install: clean up help output 53/49653/2
Mike Frysinger [Tue, 30 Apr 2013 20:24:23 +0000 (16:24 -0400)]
chromeos-install: clean up help output

There is no need to manually describe the default as shflags does this
automatically.  This also fixes spacing on a few options.

BUG=chromium:236941
TEST=`chromeos-install --help` looks better

Change-Id: Iba641037caadf508948a71111fc0d62c98a5b6a6
Reviewed-on: https://gerrit.chromium.org/gerrit/49653
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
18 months agochromeos-install: quiet down harmless prepare_disk warnings 54/49654/2
Mike Frysinger [Tue, 30 Apr 2013 20:25:42 +0000 (16:25 -0400)]
chromeos-install: quiet down harmless prepare_disk warnings

These can be confusing when they crop up, so scrub the output in the
common case.  This happens on all devices.

BUG=chromium:236941
TEST=`chromeos-install` on x86-alex no longer warns

Change-Id: I09c98765903c3a422235a2ad0cc1c7699f245a4a
Reviewed-on: https://gerrit.chromium.org/gerrit/49654
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
18 months agochromeos-install: use case statements to simplify arch parsing 52/49652/2
Mike Frysinger [Tue, 30 Apr 2013 19:59:02 +0000 (15:59 -0400)]
chromeos-install: use case statements to simplify arch parsing

This is easier to read/extend, and we only have to run `uname` once.

BUG=chromium:236941
TEST=`chromeos-install` works on x86-alex
TEST=`chromeos-install --arch=ARM` did not complain about ARCH
TEST=`chromeos-install --arch=INTEL` did not complain about ARCH
TEST=`chromeos-install --arch=asd` rejected the ARCH

Change-Id: I621270210c5a74df9a712ae992e9b43e6a1b44d4
Reviewed-on: https://gerrit.chromium.org/gerrit/49652
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
18 months agoMake postinst time logging a little more generic. 13/49113/2 stabilize-4068.0.B
Don Garrett [Wed, 24 Apr 2013 22:18:02 +0000 (15:18 -0700)]
Make postinst time logging a little more generic.

Instead of just logging the time taken to do the firmware update, be a little
more generic.

Created the helper methods:
  LoggingTimerStart()
  LoggingTimerFinish()

Use them for:
  RunCommand (which covers firmware updates),
  Final sync to disk.
  verity hash generation.

BUG=chromium:234308
TEST=Unittests, manual build/push to CR48.

Change-Id: I5da2469894760b7b00b4e5a67dd96182f398ddb9
Reviewed-on: https://gerrit.chromium.org/gerrit/49113
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
18 months agoLog time for external commands. 17/49017/2
Don Garrett [Tue, 23 Apr 2013 23:37:05 +0000 (16:37 -0700)]
Log time for external commands.

Add logging in RunCommand that shows how long a command takes to run.
This will be used to show how long firmware updates take. It should
have no other impact for secure bios machines.

BUG=chromium:234308
TEST=Ran unittests, update to a physical CR48.

Change-Id: I94f880ee79907d40a46e3e03c13e71f6b63f453a
Reviewed-on: https://gerrit.chromium.org/gerrit/49017
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
18 months agoLog lsb-release from stateful partition also. 67/47067/2 stabilize-4008.0.B stabilize-4035.0.B
Jay Srinivasan [Mon, 1 Apr 2013 23:02:59 +0000 (16:02 -0700)]
Log lsb-release from stateful partition also.

We were dumping the lsb-release from the rootfs of the source partition.
But we also need to dump the values in stateful for debugging features
such as channel changing since the stateful lsb-release values play a
vital role in such features.

BUG=chromium:222617
TEST=Tested on ZGB, works fine.

Change-Id: Ia160463ba88dcef92e9340033691dc23c18ad0c4
Reviewed-on: https://gerrit.chromium.org/gerrit/47067
Tested-by: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
18 months agoAdapt to vboot's change in header file names. 19/47019/4
Bill Richardson [Fri, 29 Mar 2013 21:29:31 +0000 (14:29 -0700)]
Adapt to vboot's change in header file names.

The names of the header files exported from vboot_reference have changed
slightly. This adjusts.

BUG=chromium:221544
BRANCH=none
TEST=manual, trybots
CQ-DEPEND=CL:47021,CL:47022,CL:47023

  FEATURES=test emerge-$BOARD vboot_reference chromeos-installer

Change-Id: I176bb400b2244dfeb4ce3a64a45219f888bbd54d
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47019
Reviewed-by: Randall Spangler <rspangler@chromium.org>
19 months agoAdapt to changed FindKernelConfig() calling convention. 35/46835/3
Bill Richardson [Thu, 28 Mar 2013 22:57:44 +0000 (15:57 -0700)]
Adapt to changed FindKernelConfig() calling convention.

The calling conventions for vboot_reference's FindKernelConfig() function
have changed. This adapts to the change. It's simpler, too.

BUG=chromium:221544
BRANCH=none
TEST=manual
CQ-DEPEND=CL:46834

  FEATURES=test emerge-$BOARD chromeos-installer

Change-Id: I2dd1cdbb9419157a73dd44ef4ae0397c151ee1f3
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46835
Reviewed-by: Don Garrett <dgarrett@chromium.org>
19 months agoEdit efi grub configuration in EFI post-install 85/46285/4
Paul Drews [Mon, 25 Mar 2013 15:37:35 +0000 (08:37 -0700)]
Edit efi grub configuration in EFI post-install

This adds code to edit the EFI grub configuration during the
post-install step when the BIOS type is EFI.  Partitions on
the hard drive are created with new partition UUIDs that are
different from the USB-key partition UUIDS.  The EFI grub
configuration needs to get edited in a corresponding way to
refer to those hard-drive partition UUIDs.

BUG=none
TEST=EFI-boot from USB ; chromeos-install ; remove USB ; EFI-boot

Change-Id: Ic8f86414abd7987c37c619af24a619c56f5da78d
Reviewed-on: https://gerrit.chromium.org/gerrit/46285
Tested-by: paul drews <paul.drews@intel.com>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: paul drews <paul.drews@intel.com>

19 months agoinstaller: Calculate gmock/gtest library dependencies programatically 39/46439/5 release-R27-3912.B stabilize-3912.79.B toolchainA
Gaurav Shah [Mon, 25 Mar 2013 21:31:18 +0000 (14:31 -0700)]
installer: Calculate gmock/gtest library dependencies programatically

(gmock/gtest doesn't generate pkg-config metadata, calculating lib
 dependencies this way makes it easier to upgrade gmock/gtest packages.)

BUG=chromium:211445
TEST=build tests for package using gtest 1.6

Change-Id: I65ea10bfe1e760cf2068cbeac853a07953ad4161
Reviewed-on: https://gerrit.chromium.org/gerrit/46439
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Gaurav Shah <gauravsh@chromium.org>
19 months agoIncrease sleep in postinst for sync purposes from 5 to 10 seconds. 92/46192/3
Don Garrett [Fri, 22 Mar 2013 00:44:37 +0000 (17:44 -0700)]
Increase sleep in postinst for sync purposes from 5 to 10 seconds.

BUG=chromium:222967
TEST=Remote tryjob x86-mario.

Change-Id: Ic7e67ee4e591dc6e02e9855b55ea1cb43d8ae173
Reviewed-on: https://gerrit.chromium.org/gerrit/46192
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
19 months agoAdapt to changes in the vboot_reference function names. 45/46045/2
Bill Richardson [Wed, 20 Mar 2013 22:09:36 +0000 (15:09 -0700)]
Adapt to changes in the vboot_reference function names.

Code cleanup in vboot_reference changed the names of some exported
functions.

BUG=chromium:221544
BRANCH=none
TEST=buildbot
CQ-DEPEND=CL:46044

Renaming functions only; no functional changes.

Change-Id: I7b2fc59e37fe5476c81f593ddf28bede576f3e53
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46045
Reviewed-by: Randall Spangler <rspangler@chromium.org>
19 months agochromeos-install: fixes required to work with busybox 02/44602/3 factory-spring-3842.B firmware-spring-3824.4.B firmware-spring-3824.55.B firmware-spring-3824.84.B firmware-spring-3824.B firmware-spring-3833.B stabilize-3881.0.B
Mandeep Singh Baines [Tue, 5 Mar 2013 02:29:49 +0000 (18:29 -0800)]
chromeos-install: fixes required to work with busybox

busybox cp does not support -u.
busybox losetup does not support -f --show.

BUG=chromium-os:39384
TEST=Verified that chromeos-install now works for embedded.

Change-Id: I72e449edf3cc4031533a070fc891446cec4cb1cb
Reviewed-on: https://gerrit.chromium.org/gerrit/44602
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Mandeep Singh Baines <msb@chromium.org>
Tested-by: Mandeep Singh Baines <msb@chromium.org>
19 months agoMove CgptManager from vboot_reference to installer 41/44441/3
Bill Richardson [Fri, 1 Mar 2013 20:51:52 +0000 (12:51 -0800)]
Move CgptManager from vboot_reference to installer

The C++ wrapper around various vboot_reference functions doesn't belong in
the vboot repo itself. Put it in the installer repo instead.

BUG=chromium-os:39228
BRANCH=none
TEST=auto
CQ-DEPEND=CL:44442, CL:44443

Refactoring only, no new code. Everything should continue to work as before.

Note that the CgptManagerTests that were created by vboot_reference were
never actually run there, and it turns out that they don't compile for all
platforms (lumpy, for example) in this repo. Obviously there are some
undeclared dependencies. Getting those tests ported over here will have to
be a separate CL.

Change-Id: I170f117370b16a153ff29addedaa0fc49205221b
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44441
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
20 months agoFix a clang warning about sprintf behavior we need in this package. 88/43588/4
Don Garrett [Wed, 20 Feb 2013 02:40:29 +0000 (18:40 -0800)]
Fix a clang warning about sprintf behavior we need in this package.

inst_util.cc accepts a format string and then passes it to vsnprintf. clang
warns about this, even though gcc failed to do so. Add an attribute to
the helper method so that the compiler knows it's a printf style method
and can do format checking.

I have tested that this still builds with gcc, but I don't know if it actually
fixes the warning with clang.

BUG=chromium-os:35541
TEST=Built (since the change is to a build warning, this seems sufficient.)

Change-Id: I965a77dbfa2090b109fb43eddbb79b7cc858750c
Reviewed-on: https://gerrit.chromium.org/gerrit/43588
Reviewed-by: Guozhi Wei <carrot@google.com>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
21 months agoAdd sleep to postinst after sync. 65/41265/3 stabilize-3701.30.0 stabilize-3701.30.0b stabilize-3701.46.B stabilize-bluetooth-smart toolchain-3701.42.B
Don Garrett [Tue, 15 Jan 2013 02:08:13 +0000 (18:08 -0800)]
Add sleep to postinst after sync.

It appears that CGPT updates are not flushed after sync, or on reboot. So,
if you reboot too quickly after applying an update, the CGPT changes are lost.
This boots you into the old version and you have to update again.

This CL works around the problem (probably) by adding a 10 second sleep to
postinst. If someone can give me a sync command I can use instead, that would
be much preferred.

BUG=chromium-os:35992
TEST=Pused to device. No unittests (trouble building outside of ebuild).

Change-Id: Ia5b7daf5fe6fddc0b5a39589036924a5e0da71b4
Reviewed-on: https://gerrit.chromium.org/gerrit/41265
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
23 months agoInstaller fixes for boot cache for legacy machines factory-3536.B release-R25-3428.B stabilize-3428.110.0 stabilize-3428.149 stabilize-3428.149.B stabilize-3428.193 stabilize2 toolchain-3428.65.B
Paul Taysom [Mon, 5 Nov 2012 21:25:40 +0000 (13:25 -0800)]
Installer fixes for boot cache for legacy machines

%U+1 is now replaced by the root device in every
where it is found in the Linux cmdline.
Included unit test for ReplaceAll.

BUG=chromium-os:24551
TEST=stumpy,lucas,dell:current boot image builder and bootcache image builder:with and with out verity.

Change-Id: I5ed5f6cf0f227c091f11bfff13bbe0e868fef713
Reviewed-on: https://gerrit.chromium.org/gerrit/37374
Tested-by: Paul Taysom <taysom@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Paul Taysom <taysom@chromium.org>

2 years agoLog lsb-release contents during postinst for both from/to installs.
Don Garrett [Wed, 24 Oct 2012 19:28:51 +0000 (12:28 -0700)]
Log lsb-release contents during postinst for both from/to installs.

To help diagnose some problems from logs, it's useful to know the version
you are updating from/to. In order to capture everything about the from/to
versions, this CL dumps the entire lsb-release contents (captures omaha
URLs, channels, etc).

BUG=chromium-os:33892
TEST=image_to_live, unittests, visual log inspection.

Change-Id: I1957ba09091301fc353f59cdf6c44c1b0e74ce8c
Reviewed-on: https://gerrit.chromium.org/gerrit/36456
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years agoFix running chromeos-install without root
Liam McLoughlin [Sun, 7 Oct 2012 21:54:05 +0000 (14:54 -0700)]
Fix running chromeos-install without root

BUG=chromium-os:34783
TEST=Run chromeos-install without root

Change-Id: I1a43abd39ab7abd4a2df3932ef015b97804d51b3
Reviewed-on: https://gerrit.chromium.org/gerrit/34859
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
2 years agofix typo in rootfs var name factory-2985.B factory-2993.B factory-3004.B
Mike Frysinger [Mon, 24 Sep 2012 22:47:05 +0000 (18:47 -0400)]
fix typo in rootfs var name

Copy & paste bites.

BUG=chromium-os:34715
TEST=None

Change-Id: I79c2afac590c2133063bdc394f30edae66abea24
Reviewed-on: https://gerrit.chromium.org/gerrit/33945
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>

2 years agoUse write_gpt.sh instead of install_gpt
Liam McLoughlin [Mon, 13 Aug 2012 20:49:34 +0000 (13:49 -0700)]
Use write_gpt.sh instead of install_gpt

This file gets written as part of the build process and is board
and image type specific

BUG=none
TEST=none
CQ-DEPEND=I8a596728a4d1845c930e837bea627f5b6a11c098

Change-Id: Ida9adb48fc585ce90a58349d8dc2bee419f7e427
Reviewed-on: https://gerrit.chromium.org/gerrit/30029
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Liam McLoughlin <lmcloughlin@chromium.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
2 years agoCleanup of installer code to remove dead scripts.
Don Garrett [Fri, 14 Sep 2012 01:10:20 +0000 (18:10 -0700)]
Cleanup of installer code to remove dead scripts.

These scripts were intentionally left behind when we converted to C++ in
case there were problems. However, the conversion was finished in R19 but
the extra files were never cleaned up.

Got rid of everything extra from the installer directory.

BUG=None
TEST=Ran unittests, built base/test/recovery images, ran image_to_live, and
     run release trybot run.

Change-Id: I39eb944beae8bf5f671941318162d80f80b17ca2
Reviewed-on: https://gerrit.chromium.org/gerrit/33261
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>

2 years agoAdjust installer Makefile to use OUT correctly. factory-2914.B
Don Garrett [Mon, 17 Sep 2012 18:58:17 +0000 (11:58 -0700)]
Adjust installer Makefile to use OUT correctly.

Clean up the installer make file slightly so that build artifacts are put
in a build subdirectory instead of littered in amoung the source code.

BUG=None (but it's annoyed me for a long time)
TEST=Built by hand, and emerged the installer package. Will do a trybot run.

Change-Id: I1a9a7b09c42d3200c416f21d65f29fbb225c7480
Reviewed-on: https://gerrit.chromium.org/gerrit/33442
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years agoChanged installer to handle bootcache
Paul Taysom [Mon, 10 Sep 2012 18:20:33 +0000 (11:20 -0700)]
Changed installer to handle bootcache

The bootcache changes the device numbers assigned to mapper devices.
/dev/dm-0 -> bootcache
/dev/dm-1 -> verity
But must maintain backwards compatibility. e.g dm-0 -> verity
THe decision was if the root device has the prefix /dev/dm*
treat it as a read-only device.

BUG=chromium-os:25441
TEST=Tested installed with verity turned on and with verity turned off

Change-Id: I05acb7025b744166ca29c475660946aa8b7ffff8
Reviewed-on: https://gerrit.chromium.org/gerrit/32770
Commit-Ready: Paul Taysom <taysom@chromium.org>
Reviewed-by: Paul Taysom <taysom@chromium.org>
Tested-by: Paul Taysom <taysom@chromium.org>
2 years agoRevert "install: do ext4 itable initialization during install"
Sonny Rao [Thu, 6 Sep 2012 17:57:36 +0000 (10:57 -0700)]
Revert "install: do ext4 itable initialization during install"

This reverts commit 02e06eb1dd4be50d5d82dd2d29a60deb251c26af.

It didn't provide the expected benefit in user-percieved
performance.

BUG=chrome-os-partner:12883
TEST=none for revert

Change-Id: I8e1f31833bd1ad34b42df51792b2bc6936ee26ab
Reviewed-on: https://gerrit.chromium.org/gerrit/32408
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Sonny Rao <sonnyrao@chromium.org>
Tested-by: Sonny Rao <sonnyrao@chromium.org>
2 years agochromeos-install: Fixed parted not being found
Derek Basehore [Wed, 5 Sep 2012 00:00:19 +0000 (17:00 -0700)]
chromeos-install: Fixed parted not being found

We call parted with sudo so that we do not get an error when we run
chromeos-install without root.

I also redirect the error output of parted to /dev/null and check the return
value of expr with -z instead of comparing to 0 which was wrong.

BUG=chromium-os:34142
TEST=/usr/sbin/chromeos-install as chronos

Change-Id: I8e5332668d9350dbb7dbf871e3e54585add9d57b
Reviewed-on: https://gerrit.chromium.org/gerrit/32193
Tested-by: Derek Basehore <dbasehore@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Ready: Derek Basehore <dbasehore@chromium.org>

2 years agoPostinst removes /var/lib/preload-network-drivers. factory-2846.B factory-2848.B
Don Garrett [Thu, 30 Aug 2012 00:18:24 +0000 (17:18 -0700)]
Postinst removes /var/lib/preload-network-drivers.

A cache file created on stateful to speed loading of wifi drivers is sometimes
incorrect after a reboot which will prevent the correct wifi driver from
loading. This change deletes the file in question during postinst to avoid
the corruption problem.

This will slow the next boot slightly, but should be safe since the cache
file is simply recreated during boot if not present.

BUG=chrome-os-partner:13259
TEST=image_to_live, verify file missing, reboot, verify it returned.

Change-Id: Ic4aa1c162944a72d9e7ee4283035bfc331e05c31
Reviewed-on: https://gerrit.chromium.org/gerrit/31772
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years agochromeos-install: install to first ATA device
Derek Basehore [Sat, 25 Aug 2012 23:25:48 +0000 (16:25 -0700)]
chromeos-install: install to first ATA device

Created a temporary fix where we install to the first ATA device as listed from
'parted -l -s -m' instead of assuming /dev/sda

BUG=chrome-os-partner:12934
TEST=chromeos-install

Change-Id: Ib78682d3d0a593d0ea3d0784d50bc4694667f5bb
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/31433

2 years agoinstall: do ext4 itable initialization during install firmware-stout-2817.B
Sonny Rao [Fri, 24 Aug 2012 17:47:38 +0000 (10:47 -0700)]
install: do ext4 itable initialization during install

This should help on systems with large rotating disks where on first
boot we see a lot of disk activity from lazy itable initialization that
may be competing with sync during the first login and makes for a bad
user experience.

BUG=chrome-os-partner:12883
TEST=manual: install device, run this command as root:
 dumpe2fs /dev/sda1 | grep ^Group | grep -v ITABLE_ZEROED
 should result in no lines besides "dumpe2fs ..."

Change-Id: I85f367f6107654dc2cd3ecb4670a38bde8714d58
Reviewed-on: https://gerrit.chromium.org/gerrit/31350
Reviewed-by: Paul Taysom <taysom@chromium.org>
Reviewed-by: Jay Kim <yongjaek@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Ready: Sonny Rao <sonnyrao@chromium.org>

2 years agofix out-of-tree tests firmware-butterfly-2788.B
Mike Frysinger [Mon, 13 Aug 2012 21:53:05 +0000 (17:53 -0400)]
fix out-of-tree tests

The current tests assume they are run in the source tree, but when we
try to build out-of-tree, they all fail.  Add a helper to look up the
source tree via the $SRC env var which common.mk exports for us.

BUG=chromium-os:33327
TEST=`cros_run_unit_tests --board x86-alex -p chromeos-installer` passes

Change-Id: I3c0c382d07590c430fdf1b550a80caf87e487a3b
Reviewed-on: https://gerrit.chromium.org/gerrit/30038
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2 years agodo not bind-mount /var on recovery images
Kees Cook [Wed, 15 Aug 2012 19:40:36 +0000 (12:40 -0700)]
do not bind-mount /var on recovery images

There is no need to have /var mounted from the stateful partition any
more, so remove it from the install process.

BUG=chromium-os:32774
TEST=lumpy build, recovery with both --minimize and --nominimize.
STATUS=Fixed

Change-Id: Ieb2162d9860bec2f061a257cdd980c70dcece061
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/30487
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
2 years agoinstall_gpt: move rootfs to beginning of disk on rotating media
Sonny Rao [Thu, 9 Aug 2012 05:13:39 +0000 (22:13 -0700)]
install_gpt: move rootfs to beginning of disk on rotating media

This adds a flag and detection to to the install_gpt function
which provides an alternative disk layout for machines which are
using a rotating disk.  We move the rootfs partitions to be before
the stateful partition in order to get better sequential disk
performance.

BUG=chrome-os-partner:12203
TEST=ad hoc: install an image via chromeos-install on a system with
 a rotating disk, inspect partition layout, rootfs should be before
 stateful
TEST=ad hoc: install an image via chromeos-install on a system with
 a non-rotating disk, inspect partition layout, layout should be
 identical to an install from before this change
TEST=`cbuildbot amd64-generic-full`

Change-Id: I637de54be9deba18dc75cbe2a476d999dc83576c
Reviewed-on: https://gerrit.chromium.org/gerrit/29726
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Tested-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Ready: Sonny Rao <sonnyrao@chromium.org>

2 years agochromeos-setdevpasswd: Make the 'etc' dir if needed
Doug Anderson [Wed, 8 Aug 2012 20:35:28 +0000 (13:35 -0700)]
chromeos-setdevpasswd: Make the 'etc' dir if needed

On my canary device this directory didn't exist.  Add it.

BUG=chromium-os:33389
TEST=run chromeos-setdevpasswd

Change-Id: Ia8fa6054e03b323a97aace59396a84a5d2787c77
Reviewed-on: https://gerrit.chromium.org/gerrit/29648
Commit-Ready: Doug Anderson <dianders@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
2 years agocros_installer: Temporarily return success for EFI installation. factory-2717.B factory-2723.14.B firmware-link-2695.2.B firmware-link-2695.B firmware-parrot-2685.B firmware-snow-2695.90.B firmware-snow-2695.B
Hung-Te Lin [Fri, 27 Jul 2012 02:12:43 +0000 (10:12 +0800)]
cros_installer: Temporarily return success for EFI installation.

Although EFI is not fully supported yet, we don't want it to return failure for
factory installation.

BUG=none
TEST=emerge-x86_generic chromeos-installer

Change-Id: I5f1387432ac6ed556dcf1a1da8d2a55bdca1a993
Reviewed-on: https://gerrit.chromium.org/gerrit/28557
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agochromeos-install accepts --target_bios
Don Garrett [Fri, 29 Jun 2012 22:01:51 +0000 (15:01 -0700)]
chromeos-install accepts --target_bios

chromeos-install now accepts the --target_bios argument. This is a wrapper
for the postinst --bios argument. It's intended to be used in the odd
environments where the bios type needed for the next boot cannot be
properly detected.

BUG=chromium-os:31942
TEST=Booted CR48 from USB and installed with default/explict secure
     specification, and watched explicit EFI specification fail.

Change-Id: Iccbdafbf2ec4804a5c8823a8f14461738ced6241
Reviewed-on: https://gerrit.chromium.org/gerrit/26498
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years agoRevert "Use payload's stateful var_overlay for recovery /var"
Richard Barnette [Thu, 26 Jul 2012 22:27:51 +0000 (15:27 -0700)]
Revert "Use payload's stateful var_overlay for recovery /var"

This reverts commit 778084ead491e35c935c00ae590c3ce9e1e083c5

This left recovery of base images DOA.

BUG=chromium-os: 32994

Change-Id: Iccda090fd87a8035d3dc500a149fa5fd6b8a6f47
Reviewed-on: https://gerrit.chromium.org/gerrit/28524
Commit-Ready: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
2 years agoUse payload's stateful var_overlay for recovery /var
Kees Cook [Wed, 25 Jul 2012 21:18:06 +0000 (14:18 -0700)]
Use payload's stateful var_overlay for recovery /var

Since the stateful partition's "var" is now "var_overlay", use it during
recovery.

BUG=chromium-os:32774
TEST=snow build

Change-Id: I8736e34ed8facbaac3a7b0f21ec04dfab3e89b37
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28425
Reviewed-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
2 years agoAdd skip postinstall option and move hybrid MBR creation code
Liam McLoughlin [Tue, 10 Jul 2012 00:45:06 +0000 (17:45 -0700)]
Add skip postinstall option and move hybrid MBR creation code

BUG=none
TEST=Build an image for an arch that isn't the same as the host arch

Change-Id: I8cdf6694782357162188020217bc2350116c3a6d
Reviewed-on: https://gerrit.chromium.org/gerrit/26991
Commit-Ready: Liam McLoughlin <lmcloughlin@chromium.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
2 years agoinstaller: Fix RemovePackFiles failure on factory install.
Hung-Te Lin [Fri, 13 Jul 2012 03:14:31 +0000 (11:14 +0800)]
installer: Fix RemovePackFiles failure on factory install.

The translation from script to C++ should not return error if the temporary
folder does not exist in factory mode.

BUG=chrome-os-partner:11234
TEST=Manually finished factory installation

Change-Id: I06294df68df02355941a423dc480567c0f9c5c10
Reviewed-on: https://gerrit.chromium.org/gerrit/27345
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Ricky Liang <jcliang@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agoRevert "Remove seemingly incorrect "correction" of rootfs size"
Don Garrett [Thu, 12 Jul 2012 20:50:21 +0000 (13:50 -0700)]
Revert "Remove seemingly incorrect "correction" of rootfs size"

This reverts commit 39f9895a2c219ba63d34f828fab61235d83b3ac0

Change-Id: Ia4cbde1ada1ed46792c62c0f14ebc782177c4902
Reviewed-on: https://gerrit.chromium.org/gerrit/27318
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years agoRemove seemingly incorrect "correction" of rootfs size
Liam McLoughlin [Tue, 19 Jun 2012 22:55:02 +0000 (15:55 -0700)]
Remove seemingly incorrect "correction" of rootfs size

This causes building an image with a rootfs size smaller than the default to fail spectacularly

BUG=none
TEST=Build an image with a rootfs smaller than the default size

Change-Id: I0983dd2085adb110e4e4367956e1e2e24015f81d
Reviewed-on: https://gerrit.chromium.org/gerrit/25678
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Liam McLoughlin <lmcloughlin@chromium.org>

2 years agochromeos-install: copy from var_overlay instead of var
Kees Cook [Wed, 27 Jun 2012 21:26:41 +0000 (14:26 -0700)]
chromeos-install: copy from var_overlay instead of var

Since /var is now treated differently with the encrypted partition, move
the parts needed by gmerge into a separate directory that will be
excluded from the encrypted partition migration of the old stateful var
mount point. This directory's contents will be symlinked into the system
/var at runtime on dev images.

BUG=chromium-os:22172
TEST=link build, install, manual verification
CQ-DEPEND=Ie6480a59929818fe5d36a46abf533b648fb78850

Change-Id: I9da0973e05cdfaf991a6041e20c0ef4fc3c92014
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26269
Reviewed-by: Chris Sosa <sosa@chromium.org>
2 years agoFix chromeos-installer gcc-4.7 build problem. factory-2569.B
Han Shen [Tue, 3 Jul 2012 21:05:13 +0000 (14:05 -0700)]
Fix chromeos-installer gcc-4.7 build problem.

TEST=Built using gcc 4.7.
BUG=None

Change-Id: Idf58fedd3f66711827c3feedd865c9f775080085
Reviewed-on: https://gerrit.chromium.org/gerrit/26706
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Han Shen <shenhan@chromium.org>
Commit-Ready: Han Shen <shenhan@chromium.org>

2 years agoRevert "Use the kernel we are installing to detect default bios type."
Olof Johansson [Tue, 26 Jun 2012 06:22:49 +0000 (23:22 -0700)]
Revert "Use the kernel we are installing to detect default bios type."

This reverts commit 8440e3d853529badf9d9d7d383d5c78c43d37a40

It breaks chromeos-install on snow:

No recognized cros_XXX bios option on kernel command line
Configure failed.

Change-Id: I6ffd7927e1ef7100cbf6aae73ab92706eb8e0e0d
Reviewed-on: https://gerrit.chromium.org/gerrit/26087
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Commit-Ready: Olof Johansson <olofj@chromium.org>
Tested-by: Olof Johansson <olofj@chromium.org>
2 years agoUse the kernel we are installing to detect default bios type.
Don Garrett [Wed, 20 Jun 2012 01:40:11 +0000 (18:40 -0700)]
Use the kernel we are installing to detect default bios type.

We have been using current kernel to detect what type of bios to install for
in postinst, but for some factory installers, this can be wrong (we boot EFI,
install secure boot, reboot). So, this change uses the kernel we are planning
to boot into to decide how to run postinst.

BUG=chromium-os:31942 (should solve chromium-os:31407 as well)
TEST=image_to_live on a CR48.

Change-Id: I46ea0a397a1fc10aa363894b37e190f08d739038
Reviewed-on: https://gerrit.chromium.org/gerrit/25699
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years agoSupport legacy u-boot image files.
Don Garrett [Thu, 10 May 2012 01:18:05 +0000 (18:18 -0700)]
Support legacy u-boot image files.

If we are on arm, and cros_legacy is set, it means we are using U-Boot but
not secure boot. This MAY need a uboot image file copied in to place to tell
u-boot which kernel to boot.

BUG=chromium-os:30507
TEST=No arm device, no unittests at this level.

Change-Id: I8759bfa94ca9a5f07d797b8286c148cb641c8ae3
Reviewed-on: https://gerrit.chromium.org/gerrit/22319
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>

2 years agoCreate gtest tests for installer C++ code. factory-2475.B release-R21-2465.B
Don Garrett [Sat, 9 Jun 2012 01:52:50 +0000 (18:52 -0700)]
Create gtest tests for installer C++ code.

There were problems getting gtest tests to run when the binary version of
postinst was created, so I created tests by bundling them into the main
binary and running then when --test was passed in.

This change gets gtest unittests building correctly and converts existing
tests to our standard framework. This should shrink the size of our
shipping executable since tests are no longer bundled into it.

BUG=chromium-os:25637
TEST=Built and ran tests.

Change-Id: I51c4c7af5ef80cf082d43759e1e0627c4fc29b4b
Reviewed-on: https://gerrit.chromium.org/gerrit/24937
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>

2 years agoAdd command line option to postinst to specify target bios type.
Don Garrett [Thu, 31 May 2012 23:14:28 +0000 (16:14 -0700)]
Add command line option to postinst to specify target bios type.

This change refactors the bios type to be an enum on the InstallConfig
struct so it can be discovered or set in a centralized place. It also
adds a command line option to allow the bios type to be specified
instead of detected.

This is needed in some factory install situations where we boot with
one bios type, but then install another before rebooting.

BUG=chromium-os:31407
TEST=Unittests install/update to a CR48.

Change-Id: I607e9872fa245071a23ee3578fe82290f7493f79
Reviewed-on: https://gerrit.chromium.org/gerrit/24417
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years agoFix chromeos-install gcc-4_7 build problem.
Han Shen [Tue, 5 Jun 2012 00:42:44 +0000 (17:42 -0700)]
Fix chromeos-install gcc-4_7 build problem.

Added "<unistd.h>" inclusion to where needed.

TEST=Built using gcc 4.7
BUG=None

Change-Id: Iebaf14813eddf380b7330f465659bb9cd6622195
Reviewed-on: https://gerrit.chromium.org/gerrit/24461
Tested-by: Han Shen <shenhan@google.com>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
Commit-Ready: Han Shen <shenhan@google.com>

2 years agoFix out of order postinst logs. factory-2394.B
Don Garrett [Sat, 12 May 2012 00:07:12 +0000 (17:07 -0700)]
Fix out of order postinst logs.

Flushing stdout/stderr buffers before calling outside programs should fix our
problem with output appearing out of order.

TEST=None (yet)
BUG=chromium-os:30765

Change-Id: I5f6ec17993d520df0667327f9070bdfe27e14410
Reviewed-on: https://gerrit.chromium.org/gerrit/22509
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>

2 years agoAdd a .gitignore file for build artifacts. factory-2305.B factory-2338.B factory-2368.B firmware-link-2348.B release-R20-2268.B
Don Garrett [Tue, 8 May 2012 23:13:55 +0000 (16:13 -0700)]
Add a .gitignore file for build artifacts.

So git stops complaining about .o, .d, etc files if you build in this tree.

BUG=None
TEST=Used git.

Change-Id: I50ecc683b7a34425ba7b607e02b4b416ebd93d5d
Reviewed-on: https://gerrit.chromium.org/gerrit/22175
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years agoFix 'legacy' bios support in postinst for arm platforms.
Don Garrett [Mon, 7 May 2012 23:45:35 +0000 (16:45 -0700)]
Fix 'legacy' bios support in postinst for arm platforms.

When an arm platform boots with "cros_legacy" that means it's booting
classic U-Boot, not syslinux. The postinstall handling was trying
to configure syslinux, and trying to configure it on /dev/sda12 and
not /dev/mmcblk0p12. This caused everything to just die.

This change modifies ConfigureInstall to use a detected device for the boot
partition, as well as turning off all non-U Boot boot handling for arm
platforms. It adds additional unit testing for ConfigureInstall to test
the device detection code.

TEST=New Unittests, NOT tested on hardware
BUG=chromium-os:30507

Change-Id: I9c177160c38a36b3b77101bf10f7e6f728fc5c5f
Reviewed-on: https://gerrit.chromium.org/gerrit/22062
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
2 years agochromeos_postinst: Disable 32-64 binary compatibility check.
Hung-Te Lin [Thu, 26 Apr 2012 11:44:34 +0000 (19:44 +0800)]
chromeos_postinst: Disable 32-64 binary compatibility check.

The binary compatibility check will be made by firmware updater itself.

BUG=chromium-os:30040
TEST=emerge-x86-zgb chromeos-installer

Change-Id: I84b113fe8f5936d035913284e2f28f9dca1834a6
Reviewed-on: https://gerrit.chromium.org/gerrit/21194
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agoRe-enable Legacy Bios Support
Don Garrett [Thu, 12 Apr 2012 00:38:28 +0000 (17:38 -0700)]
Re-enable Legacy Bios Support

This change adds code to postinstall to correctly update configuration files
for the syslinux boot loader, if the current kernel was booted via syslinux. A
skeleton handler for EFI is present, but it will fail.

The --legacy command line option is removed from cros_installer, and the
chromeos-postinst script no longer tries to use it when it was needed.

The Partition class gained a uuid lookup method.

Overall postinst logic was moved from cros_installer_main.cc to
chromeos_postinst.cc.

inst_utils gained the helpers CopyFile, and SetKernelArg (a match for
ExtractKernelArg).

BUG=chromium-os:25395
TEST=Extended/ran unittests, tested install/image_to_live to an EEPC.

Change-Id: Id6b2ba861ac5301e61138915155a37feedf22d6c
Reviewed-on: https://gerrit.chromium.org/gerrit/21129
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>

2 years agoSync to disk at the end of postinst.
Don Garrett [Wed, 18 Apr 2012 21:02:04 +0000 (14:02 -0700)]
Sync to disk at the end of postinst.

We have a specific case in which CGPT changes aren't being flushed to disk
after an update. It's also just a really good idea to do a flush at the end
of postinst.

BUG=chromium-os:9121
TEST=Unittests/image_to_live to x86-mario.

Change-Id: Ifeadf09e6bca8de46a3eacc64d50368d2b46be2d
Reviewed-on: https://gerrit.chromium.org/gerrit/20498
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years agoAdd WriteStringToFile and ReplaceInFile helper methods.
Don Garrett [Sat, 14 Apr 2012 02:14:31 +0000 (19:14 -0700)]
Add WriteStringToFile and ReplaceInFile helper methods.

Add two more helper methods and tests. One writes out to a file from
a string, and the other does a search and replace inside a file
to replace a string.

This later is a replacement for sed -i, the former is just a helper for
the later.

BUG=None
TEST=New unit tests added (and they caught two bugs in original implementation)

Change-Id: I82738067174642d1946861ec2d1475b1b8295a22
Reviewed-on: https://gerrit.chromium.org/gerrit/20291
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years agoPass configuration information in a struct.
Don Garrett [Tue, 10 Apr 2012 21:06:53 +0000 (14:06 -0700)]
Pass configuration information in a struct.

Create a struct for passing around configuration information for the install,
and create a helper class that makes it easier to get the configuration
information into the various forms we need it in.

This isn't a huge win yet, but I think it will help with restoring legacy
bios support, and restoring non-standard install layouts (install to
/dev/sdb, etc) which are currently broken.

BUG=None (refactor to help with other bugs)
TEST=built and ran unittest + image_to_live.sh.

Change-Id: Ia2fb2981d3f8cb91e20eb856a6ee0488055eb8d6
Reviewed-on: https://gerrit.chromium.org/gerrit/19922
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years agoAdd FileToString utility function.
Don Garrett [Thu, 12 Apr 2012 01:26:36 +0000 (18:26 -0700)]
Add FileToString utility function.

Add a new utility function to read the contents of a file into a string, I need
this in another CL, but thought it made sense to introduce this utility
method first.

Refactor LsbReleaseValue function to use this helper, instead of streams.
Nothing else referred to streams, so this reduces the number of libraries
linked in, and shrinks our stripped executable size by about 300k.

BUG=None
TEST=Added/ran unittests.

Change-Id: I78beaabbc5d6167efa7abede1ce3d3619ede3413
Reviewed-on: https://gerrit.chromium.org/gerrit/20039
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years ago[installer] add OWNERS
Elly Jones [Fri, 6 Apr 2012 19:28:23 +0000 (15:28 -0400)]
[installer] add OWNERS

TEST=None
BUG=chromium-os:22007

Change-Id: I649e45f9c2786c370535952f517c7fc72da9a09e
Signed-off-by: Elly Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/19773

2 years agoRead kernel body load address from preamble instead
Che-Liang Chiou [Thu, 5 Apr 2012 09:55:20 +0000 (17:55 +0800)]
Read kernel body load address from preamble instead

DumpKernelConfig is changed from using fixed kernel body load address to
reading it from kernel preamble because For some ARM boards this address
is not CROS_32BIT_ENTRY_ADDR.

BUG=chromium-os:28077
TEST=Build okay and run unittests

Change-Id: I016395b470334d650e890993d2bc6b33beee269e
Reviewed-on: https://gerrit.chromium.org/gerrit/19659
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>

2 years agoSync disk before marking new partition bootable.
Don Garrett [Thu, 5 Apr 2012 20:58:25 +0000 (13:58 -0700)]
Sync disk before marking new partition bootable.

It's not safe to assume a safe shutdown will always occur, so write
out our updated file system with a sync before marking the new
partition as bootable.

Tweaking this at the same time I remove a sync from update_engine.

BUG=chromium-os:27957
TEST=image_to_live.sh

Change-Id: I698c3ce3e799a768876dc08b83a56f48c21c20ff
Reviewed-on: https://gerrit.chromium.org/gerrit/19696
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years agoIntegrate verity code into setimage functionality
Sonny Rao [Mon, 19 Mar 2012 18:38:47 +0000 (18:38 +0000)]
Integrate verity code into setimage functionality

staticly links in libdm-bht and uses the code in there to compute
the hash and complain if it doesn't match what is expected.

BUG=chromium-os:25377
TEST=cbuildbot VMTests pass
CQ-DEPEND=I0239e3d93e85336d77edfe49eec6ede90bfa5259

Change-Id: Ib74ee7a6047c654450105b60f1d099abb57146ae
Reviewed-on: https://gerrit.chromium.org/gerrit/18536
Tested-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Sonny Rao <sonnyrao@chromium.org>

2 years agochromeos_post: Enable firmware updater (using shell script). factory-1987.B
Hung-Te Lin [Fri, 9 Mar 2012 14:06:15 +0000 (22:06 +0800)]
chromeos_post: Enable firmware updater (using shell script).

Before native code version updater is implemented, we still need firmware
updater enabled in postinst command.

This CL uses existing shell script (chromeos-firmwareupdate) to update firmware.

BUG=chrome-os-partner:8409
TEST=emerge-x86-zgb chromeos-installer;
     cros_installer postinst ... # see firmware updater messages.

Change-Id: If31a055278dd817c671ddf4a3ac5fd31eebe511c
Reviewed-on: https://gerrit.chromium.org/gerrit/17689
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agoRevamp cros_installer command line parsing.
Don Garrett [Thu, 1 Mar 2012 23:15:19 +0000 (15:15 -0800)]
Revamp cros_installer command line parsing.

Start using getopt_long to make it easier to handle additional arguments
to cros_installer. The following arguments are now supported.

  --debug       (does nothing, backwards compatibility, possibly unused)
  --help
  --legacy      (Enable non-chromefirmware handling, does nothing this CL)
  --postcommit  (backwards compatibility requirement, exits with success)
  --test

BUG=chromium-os:26597
TEST=x86-mario image_to_live.sh testing.

Change-Id: I970d05b5ddedfc7c332f9238a06db15ebc4a6b24
Reviewed-on: https://gerrit.chromium.org/gerrit/17190
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years agoFix arm postinstall, by fixing /dev/mmcblk device handling.
Don Garrett [Tue, 28 Feb 2012 23:50:24 +0000 (15:50 -0800)]
Fix arm postinstall, by fixing /dev/mmcblk device handling.

Unlike most devices, memory card devices use device partition names
of the form "/dev/mccblk12p34" where 12 is the device number and 34 is
the partition number.

This broke a number of our utility methods. This CL fixes the utility
methods, but may or may not fix arm installs.

BUG=chromium-os:27011
TEST=Ran unittests, including new cases added.

Change-Id: I7afcac9b423f357fd38ef15b8b853e1a4899f7a8
Reviewed-on: https://gerrit.chromium.org/gerrit/17022
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Sonny Rao <sonnyrao@chromium.org>
2 years agoTurn binary postinst back on.
Don Garrett [Sat, 25 Feb 2012 00:13:15 +0000 (16:13 -0800)]
Turn binary postinst back on.

We are disabling VM tests that we now expect to break with binary
postinst. It's okay, really. We thought about this, and it's okay.
I hope.

BUG=chromium-os:25370
TEST=Built and ran x86-mario. Several engineers have tested this by hand
     for auto-update, USB install, USB recover, but not for any factory
     install.

Change-Id: Ic657a51b2c53ad0c9ac36297fc21d3fad8be9aa3
Reviewed-on: https://gerrit.chromium.org/gerrit/16767
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
2 years agoRevert "Turn on binary postinst."
Zachary Kuznia [Fri, 24 Feb 2012 04:41:17 +0000 (20:41 -0800)]
Revert "Turn on binary postinst."

This reverts commit 8140146ee4ef738a2797ea241b4b08c8fa51cbbf

This patch seems to be causing VMTests to fail on the wipe stateful step

Change-Id: I81ad2cc2d862a0bbbe2b3b71f3c968d95163b54e
Reviewed-on: https://gerrit.chromium.org/gerrit/16607
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Zachary Kuznia <zork@chromium.org>
Tested-by: Zachary Kuznia <zork@chromium.org>
2 years agoTurn on binary postinst.
Don Garrett [Thu, 23 Feb 2012 22:05:28 +0000 (14:05 -0800)]
Turn on binary postinst.

This change switches to the binary postinstall handler.

BUG=chromium-os:25370
TEST=Built and ran x86-mario. Several engineers have tested this by hand
     for auto-update, USB install, USB recover, but not for any factory
     install.

Change-Id: I7e5b1182ad32962e7dd41c7eddb5383e5ae09ee2
Reviewed-on: https://gerrit.chromium.org/gerrit/16543
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>

2 years agoUpdate Post-installer to use vboot libraries.
Jay Srinivasan [Thu, 23 Feb 2012 22:57:49 +0000 (14:57 -0800)]
Update Post-installer to use vboot libraries.

Uses libcgpt-cc.a library instead of cgpt binary.

BUG=chromium-os:25374
TEST=Tested integrated code on ZGB.
CQ-DEPEND=I2b2c591ba7f411c3f37763461bd8386e33ee8f81
Change-Id: I200d80a60b17ec4c5c794a5d79b16a9c2b45bff6
Reviewed-on: https://gerrit.chromium.org/gerrit/16446
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>

2 years agoRemove libbase dependancies from chromeos-installer.
Don Garrett [Sat, 18 Feb 2012 00:08:17 +0000 (16:08 -0800)]
Remove libbase dependancies from chromeos-installer.

Implement two new helper methods to replace the last of the libbase
dependancies.

TEST=x86-mario && Ran update
BUG=chromium-os:25372

Change-Id: I7acd9b0cadb35044d989f9251418df0de2854747
Reviewed-on: https://gerrit.chromium.org/gerrit/16203
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>

2 years agoRevert "Post-installer using cgpt C++ library instead of command-line."
David James [Sat, 18 Feb 2012 05:02:36 +0000 (21:02 -0800)]
Revert "Post-installer using cgpt C++ library instead of command-line."

I4c5a8b0f needs to be reverted to match Brian's revert of I0cc89177,
which broke the tree.

TBR=ferringb
This reverts commit b42ea0a9c523d6933ea875d14eec4a8170b1add8

Change-Id: I97150edc5ad3f968e3b69c1d84f1d2bd8b7f1c2b
Reviewed-on: https://gerrit.chromium.org/gerrit/16216
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2 years agoPost-installer using cgpt C++ library instead of command-line.
Jay Srinivasan [Sat, 18 Feb 2012 02:10:37 +0000 (18:10 -0800)]
Post-installer using cgpt C++ library instead of command-line.

Uses libcgpt-cc.a library instead of cgpt binary.

BUG=chromium-os:25374
TEST=Tested integrated code on ZGB.
CQ-DEPEND=I0cc891773ac24508cf0ca242c40b3c2c635bfee5
Change-Id: I4c5a8b0fdb5998bbc5d88ebce0faa1fddadad2fa
Reviewed-on: https://gerrit.chromium.org/gerrit/15810
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
2 years agoCreate initial C++ conversion of chromeos-chroot-postinst.
Don Garrett [Mon, 30 Jan 2012 17:51:14 +0000 (09:51 -0800)]
Create initial C++ conversion of chromeos-chroot-postinst.

This is the first pass of a static postinstall script to support the 32 to 64
bit transition. This is DISABLED, but should be ready for use, but with these
limitations:

1) Breaks installs on non-Chrome hardware
2) Shells out for verity
3) Shells out for cgpt
4) Unittests are linked into main executable
5) Extra library dependancies (libbase, especially)

All of these problems should be addressed in follow on CLs over the next few
days.

To ENABLE uncomment two lines at the beginning of chromeos-postinst.

BUG=chromium-os:25372
TEST=x86-mario live updates, 64 bit testing, and USB install

Change-Id: I40d27dcef36720febc4d03e4be785e438a961431
Reviewed-on: https://gerrit.chromium.org/gerrit/15026
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2 years agodo not use full paths to libs
Mike Frysinger [Mon, 13 Feb 2012 20:21:05 +0000 (15:21 -0500)]
do not use full paths to libs

Let the compiler driver figure out where these libraries exist by
using the -lfoo form.

While we're here, drop the manual -lc/-lstdc++ linkage since the
compiler driver itself takes care of this.  Further, make sure we
link with cxx_binary rather than cc_binary since this is a C++
project, not C.

BUG=None
TEST=`emerge chromeos-base/chromeos-installer` still works
TEST=`emerge-x86-alex chromeos-base/chromeos-installer` still works

Change-Id: I1b2de3ec8f9be3cefaf70c974341a3919958164c
Reviewed-on: https://gerrit.chromium.org/gerrit/15772
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2 years agoTouch .developer_mode in stateful if the dev switch is enabled.
J. Richard Barnette [Wed, 8 Feb 2012 22:50:16 +0000 (14:50 -0800)]
Touch .developer_mode in stateful if the dev switch is enabled.

When installing a non-developer image with the dev mode switch
enabled, touch /mnt/stateful_partition/.developer_mode; this
prevents the subsequent boot flow from triggering a wipe of the
stateful partition for the transition to developer mode.

This case normally can only occur if installing a standard
(non-developer) image via recovery with the dev-mode switch enabled.
The code is being added so that similar code in initramfs can be
deleted.

BUG=chromium-os:22614
TEST=run via recovery with the dev switch enabled

Change-Id: Ieeb8ed9bb68507e44cbf7d30af5085ca258a1ccb
Reviewed-on: https://gerrit.chromium.org/gerrit/15535
Reviewed-by: Paul Taysom <taysom@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Ready: Richard Barnette <jrbarnette@chromium.org>

2 years agoAdd --sysroot support to cros_installer and link in libbb
Anush Elangovan [Mon, 30 Jan 2012 23:10:06 +0000 (15:10 -0800)]
Add --sysroot support to cros_installer and link in libbb

This allows us to run any programs that haven't been made into a library just
yet. Also link in libbb.a so that we can use libbb functions.

BUG=chromium-os:24264
TEST=emerge-x86-zgb | emerge-arm-generic cros_installer

Change-Id: I83ef6cfd3a82c303f1074b23604c0e5cb9ca95dc
Reviewed-on: https://gerrit.chromium.org/gerrit/15057
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Anush Elangovan <anush@chromium.org>
Tested-by: Anush Elangovan <anush@chromium.org>