We are about to separate VFAT support from 'initramfs' flag. Let's add
'vfat' flag first so that when this happens nothing gets broken.
BUG=chrome-os-partner:9805
TEST=Build success. Factory install shim still works.
Change-Id: Ia432e3b1a6186f4f7c817a1283c86066ced5fef1
Reviewed-on: https://gerrit.chromium.org/gerrit/23193
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Currently, if set -e spots a nonzero exit we basically have
no real debug information- it just stops immediately without stating
where or why. This forces our scripts to be stupidly verbose so
we can track roughly where they were, thus when they fail we can
use that information to localize the rough exit point.
Instead we should be traping that set -e induced exit and
outputing necessary debug information to run it down. This includes
outputing the relevant stack trace, or at least what we can get of
it.
The 'die' function is now enhanced to automatically dump the trace
that lead to it. For most consumers this is desired- however for
commandline parsing induced dies ("--board is missing" for example),
the trace is noise. For those cases, a 'die_notrace' function was
added that retains the original non-backtrace behaviour.
Example output via instrumenting cros_generate_breakpad_symbols
w/ the failing command '/bin/false' (nonzero exit code).
Before:
./cros_generate_breakpad_symbols monkeys --board=x86-alex
<no output at all, just exit code 1>
With this CL:
./cros_generate_breakpad_symbols monkeys --board=x86-alex
ERROR : script called: ./cros_generate_breakpad_symbols 'monkeys' '--board=x86-alex'
ERROR : Backtrace: (most recent call is last)
ERROR : file cros_generate_breakpad_symbols, line 207, called: main 'monkeys' '--board=x86-alex'
ERROR : file cros_generate_breakpad_symbols, line 163, called: die_err_trap '/bin/false' '1'
ERROR :
ERROR : Command failed:
ERROR : Command '/bin/false' exited with nonzero code: 1
BUG=chromium-os:30598
TEST=inject a failing command into a script, verify the output.
TEST=inject a 'command not found', verify the output
TEST=cbuildbot x86-generic-full --remote
TEST=cbuildbot arm-tegra2-full --remote
TEST=cbuildbot chromiumos-sdk --remote
Change-Id: I517ffde4d1bb7e2310a74f5a6455b53ba2dea86c
Reviewed-on: https://gerrit.chromium.org/gerrit/17225
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
Commit-Ready: Brian Harring <ferringb@chromium.org>
Rather than trying to use an old/stale common.sh, use the common.sh
from the invocation point- if invoked via /usr/lib/crosutils, use that
common.sh. If invoked via src/scripts/, use that, etc.
Trying to intermix it just introduces potential for bugs and invalidly
freezes common.sh api, thus the efforts to revert this and ultimately
revert the existing of a crosutils ebuild.
BUG=chromium-os:27201
TEST=cbuildbot x86-generic-full
Change-Id: I4c6c5fbade3d28c71752bd4c44dccad49af52ec0
Reviewed-on: https://gerrit.chromium.org/gerrit/18303
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
The -d option to umount is unnecessary in cases where the original
mount was created with '-o loop' (it says so in the man page).
Moreover, there's a demonstrable bug when using 'umount -d' in this
case: umount complains that it's unable to delete the loop device
in this case. This change silences those messages.
The demonstrated bug in umount is a plausible explanation for build
failures characterized by unexpected failures of 'mount -o loop';
see the BUG, below.
BUG=chromium-os:24975
TEST=run the changed commands, see no loopback devices leaked
Change-Id: I1df9f60b40eabd279164b79ee66994ff9f644ee9
Reviewed-on: https://gerrit.chromium.org/gerrit/15998
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Richard Barnette <jrbarnette@chromium.org>
Motivated by the need to share the default recovery image name across
scripts (image_to_usb.sh in this case) and have it setup in common.sh.
Includes some general cleanup steps such flags and usage strings,
migrating function definitions to the beginning of the script, etc.
BUG=chromium-os:26010
TEST=Tested mod_image_for_recovery.sh on local host.
Change-Id: Ife3731915302a2e7be8beb750501d0ae9a0c43a4
Reviewed-on: https://gerrit.chromium.org/gerrit/15523
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
* Since dm-verity arguments are now read from the install image upon
recovery, we need not use them in build_kernel_image.
* Also, don't expect or remove /tmp/rootfs.hash, which will not be
generated by build_kernel_image.
* Cleanup of dead code following the elimination of use of root_dev.
* Updated ASCII art for success/failure condition.
* See corresponding changes to initramfs script (extract verity args
from install kernel) and chromeos-initramfs ebuild (pull
dump_kernel_config).
BUG=chromium-os:22530
TEST=Built and successfully installed recovery image on CR-48
Change-Id: I3536c88537bbce277f79f17b676231b67337a0d1
Reviewed-on: https://gerrit.chromium.org/gerrit/12646
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
This reverts commit 99182997f90041870db9038837c04be973999800
CL was committed unintentionally; it depends on two other CLs that were not committed yet.
Change-Id: Ica5820b31d7f6857c0553cedb642ee17f5109da9
Reviewed-on: https://gerrit.chromium.org/gerrit/12587
Commit-Ready: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
* Since dm-verity arguments are now read from the install image upon
recovery, we need not use them in build_kernel_image.
* Also, don't expect or remove /tmp/rootfs.hash, which will not be
generated by build_kernel_image.
* Cleanup of dead code following the elimination of use of root_dev.
* Updated ASCII art for success/failure condition.
* See corresponding changes to initramfs script (extract verity args
from install kernel) and chromeos-initramfs ebuild (pull
dump_kernel_config).
BUG=chromium-os:22530
TEST=Built and successfully installed recovery image on CR-48
Change-Id: I146b6ad707d96c9fbc8731a73ae079e80902a565
Reviewed-on: https://gerrit.chromium.org/gerrit/12335
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
We have problems with loopdev leaks occasionally (see crosbug.com/16651); this
will help us figure out what we're leaking and to whom.
BUG=chromium-os:16651
TEST=build,mod_image_for_recovery
Change-Id: I12ae1fe433f54ffee0ec18bf1ce4db111b53f13d
Signed-off-by: Elly Jones <ellyjones@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/10301
Convert image_to_usb.sh, mod_image_for_recovery.sh, and
mod_image_for_test.sh to use get_latest image; previously these
scripts wouldn't honor the 'latest' symlink.
BUG=None
TEST=re-link 'latest' to an alternate directory; test scripts
Change-Id: Ibb56bb993eae9b6ff9dbfea5090c7cae46f2c133
Reviewed-on: http://gerrit.chromium.org/gerrit/10267
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Ready: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
The current code will silence stderr when operating in non-verbose mode
because it always turns on shell tracing with `set -x`. Unfortunately,
this also ends up killing error messages from a bunch of places in the
script as well:
- look for all the "1>&2" uses in mod_image_for_recovery.sh
- look at missing error() override
- look at duplication of die() just to undo things
A really simple example:
$ ./mod_image_for_recovery.sh
$
Did it work? Or did I do something wrong? Who knows!
So undo the stderr silencing and simply turn on `set -x` only when
requested (verbose mode).
BUG=None
TEST=forced some errors in non-verbose mode and saw no output before change, but saw it after change; made a working recovery image
Change-Id: I31578fba091e390a56a437af97782a621e2137fb
Reviewed-on: http://gerrit.chromium.org/gerrit/6904
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
This CL adds a new option to mod_image_for_recovery that allows a dev to pass
in another recovery image as an option and have mod_image_for_recovery use
the kernel provided in that image when building a new recovery image.
BUG=chromium-os:19189
TEST=Built using option on image signed with non-dev keys using appropriate
recovery image as base.
Change-Id: I02a3c3bf458fb3c9fee556364005d7eaff5acccc
Reviewed-on: http://gerrit.chromium.org/gerrit/6031
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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
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
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
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
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
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
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
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
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