This removes some spurious noise from the build_image output.
BUG=None
TEST=`./build_image` still worked and is quieter
Change-Id: Ic5d89a462dc137a1a710f77dc16cee401e0083b2
Reviewed-on: https://gerrit.chromium.org/gerrit/35426
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Specifically, detect if the umount failed due to current access, if so,
give it up to 9 more runs (w/ 1s pauses) continuing only if it's still
failing due to currently open files.
Via this, it should suppress the race of gvfs/trashd looking at
quick mounted/umounted pathways.
This CL is a two parter; this adds the script, and converts common.sh
consumers over to using the override.
The next CL will modify the chroot itself to ensure our script gets
picked up/used.
BUG=chromium-os:23443
TEST=trybot, manul validation.
Change-Id: I92dedd91d6133c2063b1e5dbbc1a68366844801d
Reviewed-on: https://gerrit.chromium.org/gerrit/32087
Commit-Ready: Brian Harring <ferringb@chromium.org>
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
Rather than forcing all consumers of DEFAULT_BOARD to remember to call
get_default_board, just do it for them automatically.
BUG=None
TEST=`cbuildbot {arm,amd64,x86}-generic-full` works
TEST=`./build_packages --help` shows correct default
Change-Id: I8d6ccb83babb2764a50692318eb9193c45fb3b39
Reviewed-on: https://gerrit.chromium.org/gerrit/17868
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Currently, the scripts in src/scripts have multiple implementations
for handling when common.sh fails to load, some of which are buggy.
To simplify the boilerplate, these scripts now just exit if common.sh
fails to load. The shell itself will print the following message if
common.sh is not found:
/usr/lib/crosutils/common.sh: No such file or directory
BUG=chromium-os:32442
TEST=Run these scripts with and without common.sh installed.
Change-Id: Ie54420b6c649774f9cb039c14c80f4cf6c6ebc07
Reviewed-on: https://gerrit.chromium.org/gerrit/27058
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
Originally, I patched enter_chroot.sh to stop the gvfs daemons to work
around an issue where these daemons would prevent loop devices from being
unmounted. See https://bugzilla.gnome.org/show_bug.cgi?id=677648
Unfortunately, temporarily stopping gvfs daemons has a bad side effects:
other GUI applications that rely on these daemons responding start hanging.
This can be reproduced, for example, by starting 'gedit'.
To fix these hangs, I'm just reverting my patches to enter_chroot.sh and
restoring the scripts to where they were before.
This reverts the following patches:
1. Stop gvfs daemons earlier during enter_chroot.
This reverts commit 0079158f73.
2. Revert "Stop the gvfsd-trash daemon during enter_chroot."
This reverts commit 654a00bd61.
3. Revert "Stop the automounting daemon whenever we're inside the chroot."
This reverts commit fae0a59e8b.
4. Revert "Clean up update_bootloaders.sh to avoid sleeping."
This reverts commit 0103b59138.
BUG=chromium-os:23443
TEST=Trybot run.
Change-Id: Ie9ff222fe5fc7232fd1fc39af129cc18531118c6
Reviewed-on: https://gerrit.chromium.org/gerrit/26922
Reviewed-by: Chris Wolfe <cwolfe@chromium.org>
Reviewed-by: Jon Kliegman <kliegs@chromium.org>
Reviewed-by: Brian Harring <ferringb@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
Right now update_bootloaders.sh occasionally sleeps for 5 seconds if the
developer machine has gvfs-gdu-volume-monitor installed. This sleep was
only necessary because the script pointlessly mounted the device and then
immediately unmounted it, thus triggering a race condition.
In this commit, I've removed the pointless mount/unmount, thus avoiding this
race. This removes the need for the sleep and for retrying the umount.
I also cleaned up the error checking so that failures to cleanup fail
the whole script now.
BUG=none
TEST=Run build_image.sh several times, verify it doesn't sleep for 5 seconds
anymore. Also run remote trybot runs.
Change-Id: Iaa715e9644292f97356a341d17b147be2a5178d9
Reviewed-on: https://gerrit.chromium.org/gerrit/24632
Commit-Ready: David James <davidjames@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@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>
This is needed on some ARM boards where ext2 filesystem reading isn't an option,
and where verified boot isn't in use, i.e. with legacy firmware. x86 stores the
kernel here as well.
BUG=none
TEST=build_image on an arm board and check contents for vmlinuz.A and vmlinuz.uimg.A on
partition 12
Change-Id: I89b652cb6ea7ece1627b20be30492100f8db0770
Signed-off-by: Olof Johansson <olofj@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/13441
This reverts commit 1d20fe6813b991899900aaa4f92b965a8f0b511d
Change-Id: I2d07c4c16e56841e397ee62d0371c5edc85c8364
Reviewed-on: https://gerrit.chromium.org/gerrit/13439
Commit-Ready: Olof Johansson <olofj@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Tested-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Ryan Cui <rcui@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
This is needed on some ARM boards where ext2 filesystem reading isn't an option,
and where verified boot isn't in use, i.e. with legacy firmware. x86 stores the
kernel here as well.
BUG=none
TEST=build_image on an arm board and check contents for vmlinuz.A and vmlinuz.uimg.A on
partition 12
CQ-DEPEND=I81df8471fba34e264ada8fd6f12122d87fbf22d9
Change-Id: I39541644845dde4ff6ddc288afa0ed339ab0d05b
Signed-off-by: Olof Johansson <olofj@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/12996
Race conditions could prevent /tmp/esp.* from being properly unmounted
if it was quickly mounted then unmounted. If the umount fails,
sleep briefly and then retry.
BUG=chromium-os:23442,chromium-os:23443
TEST=Ran build_image --test, saw umount failure but after script finished
saw that directory was unmounted on second attempt so no leakage
Change-Id: I5b2260f5c99fcfa66027ebcfd69b6e3d5afe4b91
Reviewed-on: https://gerrit.chromium.org/gerrit/12115
Tested-by: Jon Kliegman <kliegs@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Ready: Jon Kliegman <kliegs@chromium.org>
BUG=chromium-os:14127,chromium-os:17184
TEST=Adhoc
Build a regular image (for Alex) and boot it on a Dogfood machine (which uses
legacy boot). Check dmesg for PARTUUID. Unpack partitions, mount partition 12,
and check for root=PARTUUID= in /efi/grub/grub.cfg (it should be there instead
of root=/dev/$linuxpart).
Change-Id: Ie403632f227d514a5876f8338afa4ad80708ed55
Signed-off-by: Elly Jones <ellyjones@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/5668
Reviewed-by: Will Drewry <wad@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>
When building a VM or USB-run image the boot args come from a preset template
which does not include the cros_debug flag. If this flag is present we maintain
it in this new boot configuration. The way we do it is by replacing the string
"cros_legacy" (which originates with the template) with
"cros_legacy cros_debug".
TEST=Build VM from a developer and test image and check grep "cros_debug"
/proc/cmdline.
BUG=chromium-os:17392
Change-Id: I2cb578274cf9596bf863ec835b1c921fff252a04
Reviewed-on: http://gerrit.chromium.org/gerrit/3808
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Arkaitz Ruiz Alvarez <arkaitzr@chromium.org>
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
The update_bootloaders needs to unmount file system first for syslinux to
manipulate the raw device file, but the real "umount+losetup -d" in
cleanup stage would cause failure.
This CL remounts partition again so that cleanup can be executed
successfully.
BUG=chromium-os:9278
TEST=Manually executed ./build_image;
Before fix: seeing "umount: /tmp/esp.2q8fSn: not mounted" in last page.
After fix: no such error.
The output image is verified to be bootable successfully.
Change-Id: I19e2e062ad814e7bcd54777b5c3cee31f2b92e81
Review URL: http://codereview.chromium.org/5165001
- I looked at all of the x86 and ARM paths through out build image scripts,
these changes clean up stale comments, stale code, and unforks some small
things.
BUG=none
TEST=Built images for x86-generic, arm-generic and tegra2-seaboard, booted tegra2-seaboard image.
Review URL: http://codereview.chromium.org/3448022
Change-Id: Ibad2774ff2cbf5f15528454506542b87e43e24a2
- Build a "kernel image" which contains a uboot script and a uboot kernel
image.
- Fix some sd* assumptions.
- Remove cruft that has never done anything usefull from update_bootloaders
BUG=none
TEST=Built, booted, and updated on tegra2_dev-board
Review URL: http://codereview.chromium.org/3396011
Change-Id: I00ecf57faa5fe64c8e33dd4c042f1dbed806c10a
This change adds
- --rootfs_hash_pad to specify the MBs reserved for the pad
- the implementation of the above flag
- check if total fs size + pad size exceeds the partition size
- hash appending in make_image_bootable()
Fixes:
- a style for ROOT_FS_HASH usage
- bad mount|grep
- bad bash subst for root devices in all boot paths
- fixed a typo in the update_bootloaders table creation
- disables verified usb for now
Adding the padding argument ensures that the generated hash tree for the root filesystem is appended to the image. Assuming the rootfs is _never_ mounted read-write
again, that hash tree will be valid and vboot will be able to proceed.
BUG=chromium-os:2693
TEST=manual build_image
Review URL: http://codereview.chromium.org/3043011
Change-Id: I67d9b0f91cacdefa309c0cc2dd7fed1d2eddd7a7
Instead of playing mount and loop device games, this change adds support for
update_bootloaders.sh to directly update the EFI system partition living in the
image if a file, offset, and size is supplied.
TEST=build_image for x86-generic; booted resulting image
BUG=broken build
Change-Id: I3d891fd965df6fb4abfc63d660e314c497a4184d
Review URL: http://codereview.chromium.org/3006006
Right now, the created arm.mbr is the size of the ESP
partition. It should be truncated though to just the mbr size.
In addition, dm= doesnt do anything on arm yet so replacing use with a todo and adding a check if it isn't there.
TEST=manually ran
BUG=none
TBR=fes
Adds two helpers that are not used yet. They will be
used in the next CL to unify the bootloaders in use
in build_image.
TEST=used in the next CL but otherwise not called.
BUG=chromium-os:327
Review URL: http://codereview.chromium.org/2829039