Commit Graph

31 Commits

Author SHA1 Message Date
J. Richard Barnette
e4e3decfc0 Extract some common code for sharing with build_image, et al.
BUG=None
TEST=build regular, test, and recovery images

Change-Id: I2d7d073c27d14fb88be6a63953dcc77fc76a0807
Reviewed-on: http://gerrit.chromium.org/gerrit/5512
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
2011-08-11 09:51:31 -07:00
David James
0ea96e4fd6 Install recovery kernel directly to image, not to build dir.
The recovery kernel is different from the regular kernel, and
should be kept sandboxed so that it does not mess with our
build directory.

We also need to give the recovery kernel a different PKGDIR so
that it does not overwrite our prebuilts for the ordinary
kernel.

BUG=chromium-os:18691
TEST=build_image --factory_install, mod_image_for_recovery.sh

Change-Id: I678a94305d5f30bc2c95bf4e53cfe81b2ae9d8ef
Reviewed-on: http://gerrit.chromium.org/gerrit/5305
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2011-08-05 12:33:15 -07:00
Che-Liang Chiou
e51bdf284c Obsolete --crosbug12352_arm_kernel_signing flag
This reverts commit 451f36e4a8.

Last time I removed the --crosbug12352_arm_kernel_signing flag, buildbot
failed. The reason seemed to be that buildbot still passing this flag to
build_image. However, I cannot find anywhere in the log that indicates
buildbot did pass this flag to build_image. So I think the last failure
should be transient and it is good to obsolete this flag.

BUG=chromium-os:12352
TEST=build_image
TEST=load_kernel_test -b 2 /path/to/image /path/to/recovery_key.vbpubk

Change-Id: Ic757eb2dc4304e7205b483063335f8816b536433
Reviewed-on: http://gerrit.chromium.org/gerrit/4794
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2011-07-26 21:40:13 -07:00
J. Richard Barnette
8447777820 Simplify standard boilerplate for selected scripts
This shortens the standard boilerplate for finding and sourcing
shell function libraries for build_image, mod_image_for_test.sh and
mod_image_for_recovery.sh.

As a side effect of the change, both mod_image_for_test.sh and
mod_image_for_recovery.sh will now restart inside the chroot if
invoked from outside; this is consistent with the pre-existing
behavior of build_image.

BUG=None
TEST=run the three scripts, from both inside and outside the chroot

Change-Id: Idd91cbee323346a871b49deea31a76875f5ee3c4
Reviewed-on: http://gerrit.chromium.org/gerrit/4675
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Vince Laviano <vlaviano@chromium.org>
2011-07-26 14:05:43 -07:00
J. Richard Barnette
f16e1028d6 Delete resize_stateful_partition.sh
The file was written as a script, but in fact was merely a shell
library of mostly unused functions.  Remove the file, and move the
one function actually used to the one place it was used in
mod_image_for_recovery.sh.

BUG=None
TEST=run mod_image_for_recovery.sh
TEST=grep all relevant scripts for references to the deleted file

Change-Id: I424f6986089467d2b8cd95bb033851171c1d1e3a
Reviewed-on: http://gerrit.chromium.org/gerrit/4681
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
2011-07-26 10:17:12 -07:00
Brian Harring
d5d5dbffa1 Fix/standardize exiting if common.sh can't be found
The problem here is that most were doing their exiting w/in a subshell;
exit within a subshell kills the subshell, not the parent.  Not all scripts
were using set -e (which would pick up the failing subshell); as such
just rewriting them to remove the potential via eliminateing the subshelling.

Beyond that, removed a couple of custom (working, although non-standard)
approaches, and removed a duplicate common.sh sourc'ing w/in mk_memento_images.sh

TEST=force 'find_common_sh' to fail, note the scripts fails to exit
BUG=none

Change-Id: Ia1108a091a6399ad6aedd3cade4a107f4411686c
Reviewed-on: http://gerrit.chromium.org/gerrit/3905
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
2011-07-22 12:06:59 -07:00
David James
8b9643f7d8 Fix losetup race condition.
The following pattern creates a race condition:

   LOOP_DEV=$(sudo losetup -f)
   ...
   sudo losetup "${LOOP_DEV}" "${ROOT_FS_IMG}"

If two steps similar to the above run in parallel, and both steps pick up
the same free loop device, they may try to mount different images with the
same loop device and one of the two stages will get a "device is busy" error.

To fix this, we should switch to the following pattern:
   LOOP_DEV=$(sudo losetup --show -f "${ROOT_FS_IMG}")

This CL implements the above.`

BUG=chromium-os:18046
TEST=Run buildbot run. Test case where we run out of loop devices and verify
     logic still works.

Change-Id: Ie457701fda61e5fc3b9112c1bfef9fb9713ea265
Reviewed-on: http://gerrit.chromium.org/gerrit/4555
Tested-by: David James <davidjames@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
2011-07-22 00:02:53 -07:00
Che-Liang Chiou
451f36e4a8 Revert "obsolete --crosbug12352_arm_kernel_signing flag"
This reverts commit 2d2e825247.

Change-Id: I62d68c063aeab6beca4393ed51a4e754c8d9cc6a
Reviewed-on: http://gerrit.chromium.org/gerrit/4487
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2011-07-21 04:54:47 -07:00
Che-Liang Chiou
2d2e825247 obsolete --crosbug12352_arm_kernel_signing flag
BUG=chromium-os:12352
TEST=manual

./build_image --board {tegra2_seaboard,x86-mario}
load_kernel_test -b 2 /path/to/chromiumos_image.bin \
  /usr/share/vboot/devkeys/recovery_key.vbpubk

Change-Id: Ide2b641842ce08ec5540c5195356821afaf7d048
Reviewed-on: http://gerrit.chromium.org/gerrit/2864
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2011-07-21 03:02:30 -07:00
Che-Liang Chiou
93b6effb0b arm: kernel cmdline use root=PARTUUID=UUID/PARTNROFF=%d
Since now the arm firmware can parse %U as x86 bios, and kernel can
parse PARTNROFF=%d, we are able to generate kernel command line with
such construct.

BUG=chromium-os:14022,15683
TEST=manual

1. Build image with root filesystem verification turns off
2. Boot successfully
3. Run 'cat /proc/cmdline' and validate its output
4. Run 'rootdev' and validate its output

Change-Id: I11de0a30928efe9d9b0149feb3389a2f30063516
Reviewed-on: http://gerrit.chromium.org/gerrit/1104
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: <nsanders@google.com>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
2011-07-01 01:33:10 -07:00
Elly Jones
8d87dbfb28 mod_image_for_recovery: be noisy if build_kernel_image fails.
This will prevent nasty surprises when it fails silently and one ends up with a
non-bootable recovery image.

BUG=chromium-os:16366
TEST=Adhoc
Hack /usr/lib/crosutils/build_kernel_image.sh to exit 1, run
mod_image_for_recovery

Change-Id: If23d181959aecf75044cb4581e25f8851d1b9840
Signed-off-by: Elly Jones <ellyjones@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/3097
Reviewed-by: Will Drewry <wad@chromium.org>
2011-06-23 11:13:48 -07:00
Nick Sanders
b795deba76 Cherry-pick: ARM: enable kernel signing by default
This commit is a part of transition to enable ARM kernel signing. It is
at first an option that is enabled manually, and then (in this commit)
enabled by default. After more tests, the scripts that generate unsigned
ARM kernel partition will probably be removed.

BUG=chromium-os:12352
TEST=./build_image && load_kernel_test -b 2 /path/to/chromiumos_image.bin /usr/share/vboot/devkeys/recovery_key.vbpubk

Change-Id: I7d4ecc566f9c5cc0106a7af59255fc63fdfe017a
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/1319
Tested-by: Nick Sanders <nsanders@chromium.org>
2011-05-25 02:56:21 -07:00
Stéphane Marchesin
2d331404a0 Add 64bit support to the build scripts.
Change-Id: Ibbc743981b4d1d2dd4e1ceb586f2f0a092559a27
Reviewed-on: http://gerrit.chromium.org/gerrit/1098
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Anush Elangovan <anush@chromium.org>
2011-05-18 10:07:46 -07:00
Tom Wai-Hong Tam
a4395b5b1c Revert "ARM: enable kernel signing by default"
This reverts commit 9c5d88573f.

Change-Id: Ica876e1be20dc9ab60666af476294e093fd59498
Reviewed-on: http://gerrit.chromium.org/gerrit/762
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
2011-05-12 12:39:53 -07:00
Che-Liang Chiou
9c5d88573f ARM: enable kernel signing by default
This commit is a part of transition to enable ARM kernel signing. It is
at first an option that is enabled manually, and then (in this commit)
enabled by default. After more tests, the scripts that generate unsigned
ARM kernel partition will probably be removed.

BUG=chromium-os:12352
TEST=./build_image && load_kernel_test -b 2 /path/to/chromiumos_image.bin /usr/share/vboot/devkeys/recovery_key.vbpubk

Change-Id: I6d48d1603cd7c96514892bcbbf8994b2d4cc2a08
Reviewed-on: http://gerrit.chromium.org/gerrit/512
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-05-09 03:13:56 -07:00
Mandeep Singh Baines
118692ab3f src/scripts: remove all references to verity_depth
This option is now deprecated. Remove from all scripts

To understand the impact of this change ran the following searches:

http://codesearch.google.com/codesearch?as_q=package%3Achromiumos+verity_depth
http://codesearch.google.com/codesearch?hl=en&lr=&q=package%3Achromiumos+verity_tree_depth

BUG=chromium-os:14357
TEST=Ran build_image, mod_image_for_test.sh, chromeos-install, and mod_image_for_recovery.sh.

Change-Id: I79e0e5fe1c917fbb54cc7c7f152d3c97d5f5c9b5

R=wad@chromium.org,scottz@chromium.org,gauravsh@chromium.org

Review URL: http://codereview.chromium.org/6901005
2011-04-28 13:50:33 -07:00
Tom Wai-Hong Tam
1f6a0ba388 Enable fbconsole in recovery and factory shims
This CL depends on http://codereview.chromium.org/6765018 which adds fbconsole
USE flag.

Change-Id: I159680e2cd53b6493545f6c0b1caaa8a7e833cb3

BUG=chromium-os:13607
TEST=run mod_image_for_recovery.sh and boot to recovery image to see messages
showed on framebuffer console.

Review URL: http://codereview.chromium.org/6814041
2011-04-26 18:09:16 +08:00
Tom Wai-Hong Tam
b42af678be Add transitional flag for ARM kernel signing in mod_image_for_recovery.sh.
Enable the ARM kernel signing procedure in the recovery image. Will remove it
when the procedure is stable.

BUG=chromium-os:12352,chromium-os:1305
TEST=run "build_image" and "mod_image_for_recovery.sh
--crosbug12352_arm_kernel_signing" to create a recovery image.
Then use u-boot recovery mode to boot the recovery image. Successfully verify
and boot the kernel.

Change-Id: I1bf911176c6f3adaebf3aa9abc86488a48a60494

Review URL: http://codereview.chromium.org/6635010
2011-03-08 09:55:10 +08:00
Will Drewry
b910de849c kernel build: use %U+1 for dm-verity booting
Using %U+1 will ensure that we avoid device enumeration issues during recovery mode
boots.

TEST=build_image+dev recovery kernel and boot to it on new cros fw / fixed enumeration problem
         used build with mp recovery kernel on cr-48 -> installed then booted fine
         used dev recovery kernel on a legacy machine; installed fine, booted fine
         tested with cr-48, mp recovery kernel, and noenable_rootfs_verification to ensure /dev/sd%D%P still worked as normal.

Change-Id: I5b1277a47536738a78c18988fd912cc05ebddd4b

BUG=chromium-os:5470

Review URL: http://codereview.chromium.org/6549034
2011-02-23 13:26:50 -06:00
Greg Spencer
798d75f3be This starts to fix the scripts so that they load from /usr/lib/crosutils
from within the chroot.

It also fixes a number of style issues.

It changes the meaning of cros_workon "list-all" to list all available
packages, and adds "list-live" to list all live packages.

It changes things that load chromeos-common.sh from the installer to
load it from /usr/lib/installer.

BUG=chromium-os:4230
TEST=synced, rebuilt chroot, made packages, made images, built chrome
from source, and wrote an image to a USB stick.

Review URL: http://codereview.chromium.org/6240018

Change-Id: I90c34420af1a64020402bafef8e9e77f56837c02
2011-02-01 22:04:49 -08:00
David Hendricks
6edcc4d952 Copy recovery kernel to syslinux path only on x86.
This is intended to fix a build error seen on ARM platforms where
the path "$esp_mnt/syslinux" does not exist.

Change-Id: I0b9e2d1fae376a7137d7e196901fbea4f2e796bc

BUG=http://code.google.com/p/chromium-os/issues/detail?id=9713
TEST=Not tested.

Review URL: http://codereview.chromium.org/5404001
2010-11-30 17:21:39 -08:00
Gaurav Shah
dc4a6446e9 Set success=1 for the recovery kernel
This will prevent the firmware from updating the tries flag on a USB recovery image.

Change-Id: I47bf276eab5b40ae54b732d0e082e4c9f58bfed3

BUG=chromium-os:6550
TEST=build_package, build_image, cgpt show recovery_image.bin (successful flag should be set to 1)

Review URL: http://codereview.chromium.org/4979007
2010-11-17 14:11:43 -08:00
Will Drewry
16106bade8 mod_image_for_recovery: keep the stateful partition around.
Developer images may have data on stateful they want to keep. In that case, just swap the kernels.

BUG=chromium-os:7451
TEST=tested with a --withdev build and stateful was intact and the recovery install worked.

Change-Id: I59d7f2e99892448d1eaf964e6292611accb2035c

Review URL: http://codereview.chromium.org/4418002
2010-11-05 10:10:22 -05:00
Will Drewry
53320366b5 mod_image_for_recovery: supprt new recovery model
With a change for chromeos-installer and http://codereview.chromium.org/4120005,
switched to a kernel image based approach.

BUG=chromium-os:7451
TEST= See http://codereview.chromium.org/4120005

Review URL: http://codereview.chromium.org/4107003

Change-Id: I84ac794dae652578682c04fdfdbfaa3f0c5c8b33
2010-11-01 17:34:14 -05:00
Tan Gao
e1e306566a Issue 6759: reduce size of stateful partition for non-developer recovery image
Change-Id: I636f3156e549508230515174edffaff650c9d46e

BUG=chromium-os:6759
TEST=(1)manually built a non-developer recovery image and verified recovery install
completes on an agz device and the device is able to boot from HD upon reboot
(2) repeat for a developer recovery image and verified dev image from dev_payload is installed onto target and the target is able to boot from HD

Review URL: http://codereview.chromium.org/3391018
2010-10-08 15:22:51 -07:00
Tan Gao
4515028a2d Issue 5871: support user-specified output image name in mod_image_for_recovery.sh
Change-Id: Ibd1990747d20b3f11a8bf9d5b558405067589d0e

BUG=chromium-os:5871
TEST=manually ran the script with and without --output flag and verified output
image took default name and user-specified name, respectively

Review URL: http://codereview.chromium.org/3155042
2010-08-25 12:51:07 -07:00
Tan Gao
2fcfbbe8cf replace mod_image_for_recovery.sh with new --recovery flag to build_image
Change-Id: I407d39ca461bbe609812e2b3bd2a51e67e331659

TEST=manually built a recovery image (non-dev mode, --withnodev) and verified
chromeos-install completed successfully when installing from USB to target HD

Review URL: http://codereview.chromium.org/3174005
2010-08-16 11:25:51 -07:00
Will Drewry
7ab698d713 build_image, mod_image_for_*: break out make_image_bootable
Breaks make_image_bootable out of build_image into a separate
script.  In addition, it make a helper .sh in the OUTPUT_DIR
to let make_image_bootable be re-run on an image with the same
arguments that were passed in via build_image.

This change also removes the use of the boot/ directory in
OUTPUT_DIR.

TEST=build_image verified; image_to_usb --test_image; booted l13
           build_image; image_to_vm; qemu booted
           build_image verified; image_to_usb; booted l13
BUG=chromium-os:5081

Review URL: http://codereview.chromium.org/3066037

Change-Id: I627d678089aa71c353347f387ad5b14063fd4e7b
2010-08-05 13:57:52 -05:00
Tan Gao
7ead6c4fa1 issue 2825046
Change-Id: I8eb21d76e75f97270596907fb309b81e8b6c8d2e

Review URL: http://codereview.chromium.org/3007005
2010-07-19 10:12:37 -07:00
Tan Gao
8ae113bb42 remove handling of kernel verification block from recovery image
Change-Id: I749dc652651fdb02b49b290863e2fa9adc6b904e

Review URL: http://codereview.chromium.org/2948005
2010-07-13 07:04:48 -07:00
Tan Gao
40551cd9ca recovery installer: fix build_gpt and build_image
Change-Id: I3cbb62827a33894f47d26dd047134b6c39c6667b

Review URL: http://codereview.chromium.org/2813029
2010-06-24 16:33:32 -07:00