Commit Graph

48 Commits

Author SHA1 Message Date
Anush Elangovan
84e72fab23 Revert "Factored out the code to copy an image and modify it for test"
Reverting for now since preflight fails.

This reverts commit 4fc5227fac.

TBR=sjg

Change-Id: I0ada89c15d0f5ecc07cb15b22d4084a37fa4ddb8
2010-12-08 23:22:15 -08:00
Simon Glass
4fc5227fac Factored out the code to copy an image and modify it for test
into mod_image_for_test.sh rather than slightly different versions
of the same in image_to_usb.sh and image_to_vm.sh

Added a function to get a test image into common.sh

Added --inplace option to mod_image_for_test, which is the default,
and preserves the original behaviour. But using --noinplace it will
now do the copy for you.

Found that chromiumos_image.bin appears throughout the scripts, so added it and the test variant to common.sh

BUG=chromiumos-10126
TEST=run mod_image_for_test.sh with and without --noinplace
run image_to_usb.sh and image_to_vm.sh with both options
test on Seaboard that correct image is provided

Really we should have automated testing for these scripts

Change-Id: I5cfa91792c7fded35e7f4ca8f8f27c6b270817fb

Review URL: http://codereview.chromium.org/5271010
2010-12-08 14:22:11 -08:00
David Rochberg
3b9107014b restart_in_chroot_if_needed can run scripts from bin/. cros_workon_now does this
BUG=chromium-os:9877
TEST=ran bin/cros_workon_now, cros_workon, set_shared_user_password

Note---this introduces another bashism to common.sh.  However, despite
comments to the contrary, common.sh does not actually parse under dash
without this change

Change-Id: I1e6b9751afa8341c100f3b8e0b96284835a53d17

Review URL: http://codereview.chromium.org/5444002
2010-12-02 10:45:21 -05:00
David James
ff07201a8c Turn on --fast on official builds.
The --fast support for build_packages is stable now, and should significantly
improve the speed of our official builders. We should turn it on so that
builders can finish their builds in less than 8 hours.

BUG=chromium-os:6706
TEST=Run ./enter_chroot.sh --official_build and verify that --fast is on by
     default now

Change-Id: I6ad126b9b6ce16ffc9887a7af22c2e3f85afbf42

Review URL: http://codereview.chromium.org/3418001
2010-11-30 13:22:05 -08:00
Raja Aluri
d44bcf9a45 Adding a script to generate au-geneate.zip file
Change-Id: Ifc47ed28dc3efc0e7ebd018f6703b36913ffd39c

BUG=8716
TEST=Ran the script inside the chroot to makesure it is generating the package.

Review URL: http://codereview.chromium.org/4425004
2010-11-11 17:46:53 -08:00
Chris Masone
d11ce17167 [crosutils] Mask out /usr/local/autotest-pkgs on install
BUG=8544
TEST=build image with --factory_install, ensure that image does not have data in /usr/local/autotest-pkgs

Change-Id: I5ed17d794392ec654bc122fa15f7ab8a7abbba2d

Review URL: http://codereview.chromium.org/4756001
2010-11-09 14:22:08 -08:00
Raja Aluri
c6e23cdb38 1. Not to assert inside chroot, if so desired.
2. Source shflags, if they are in the current directory

Change-Id: Id22e597a6fb71905f2d0ca5c4a1d94ce5a8a931f

Review URL: http://codereview.chromium.org/4177005
2010-11-02 15:55:57 -07:00
Will Drewry
9b7cb51697 common.sh: switch out echo -ne for printf and fix incorrect offset
echo -ne isn't portable but printf with octals is so this
makes the switch.

In addition, the current offset is off by 3 and is updating the UUID space.
This was from style cleanup and all functional test passed - of course.
This change fixes that too.

TEST=built and installed and checked ro enforcement works
BUG=chromium-os:7972

Change-Id: Ifb3cb2c6f3219af819baff5750453439e1ba6edf

Review URL: http://codereview.chromium.org/3997001
2010-10-20 18:11:24 -05:00
Will Drewry
55b42c94ca cros_make_image_bootable, mount_gpt_image, common.sh: root filesystem changes: ext2, ro by default
This change makes more of the root filesyste metadata static across builds, but
more can be done there.  It also changes the root filesystem to use ext2 as
we don't need journaling in normal mode.  Optionally we could use ext3 for
non-verified if desired (it's an easy change).

In particular, this change cleans up the following:
- clears the rootfs uuid
- labels it C-ROOT (instead of C-KEYFOB)
- removes reserved inodes and blocks

The major feature of this change, however, is that it adds two simple
helpers to common.sh: disable_rw_mount and enable_rw_mount.  They will
set high order byte (le) in the ro compat field to be 0xff.  This will
tell the kernel that the filesystem uses features R24-R31 which are safe
for use on the running kernel iff the filesystem is mounted read-only.

These functions are called in cros_make_image_bootable and
mount_gpt_image, respectively.  mount_gpt_image will always
enable_rw_mount and cros_make_image_bootable will disable_rw_mount if
--enable_rootfs_verification is true.

The approach is ugly but reasonably well contained.  If ext2 ever gets a
new revision and new features in the same range are introduced, then we
would be getting inconsistent behavior.  That said, it is unlikely that
that churmn will happen and if the impact is negative, it will ideally
show up during testing.

N.B., this will likely result in changes needing to be made to the
signing scripts in vboot_reference to ensure that rw mounting is
enabled/disabled in the same way (E.g., during stamping).

BUG=chromium-os:7468
TEST=- built x86-generic, imaged to usb stick, attempted to mount rw /dev/sdc3 on the host and was properly bounced.
     - booted to the image just fine on a dogfood device.
     - mod'd for recovery, then installed and booted.
     - mod_image_for_test runs with no errors; booted the resulting image as well
     - booted a factory_install with the pending dm changes
     - BVT passed with build_image x86-generic (vboot enabled)
     - [in progress] autotest that checks if the rootdev = /dev/dm-0 and
       then does a dumpe2fs | grep -q FEATURE_R31

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

Change-Id: If4dcba7568a110f4e32627c916d9e5741e5e5414
2010-10-20 15:44:11 -05:00
Doug Anderson
0c9e88de6c Added a function to update chroot sudoers automatically.
This function is now called by enter_chroot.sh.  A separate change
will call the function from make_chroot

Change-Id: I4fc07c413e56db3e5e7617428f20f2ffc02790d7

BUG=chromium-os:7072
TEST=Took root out of sudoers and ran enter_chroot.sh script; saw that it was re-added.

Review URL: http://codereview.chromium.org/3909001
2010-10-19 14:49:39 -07:00
Nick Sanders
b3d04a0529 Filter more stuff from shim
Change-Id: I23ee03198acb7a792310799d7a72f8a19ca5445b

Review URL: http://codereview.chromium.org/3331021
2010-09-09 00:01:24 -07:00
Sean O'Connor
d52c5ea1bc Make enter_chroot spew logs to stderr.
It's sometimes useful to run a command in chroot and redirect/pipe stdout. Any objections to having enter_chroot send its chatter to stderr?

Review URL: http://codereview.chromium.org/3160024
2010-08-18 21:18:23 +02:00
David James
71fa14b024 Don't install autotest bits to the image.
Autotest installs stuff to the image via ssh, so there's no need to include
all of this stuff to the image. This saves disk space. Note that
/usr/local/autotest-chrome is currently already excluded from the image
because of a hack in the chrome ebuild, and that /usr/local/autotest is
usually also excluded from the image because autotest is not included
as a dependency of any packages that are installed.

In the factory setting, it looks like the factory has its own code for
installing autotests via rsync. Presumbably, if the factory tests are
managing the autotest directly, they won't want emerge mucking with the
directory as well on the image. Currently, emerge doesn't muck with the same
directory, but we probably want to ensure that it doesn't start doing that in
future to ensure sanity.

TEST=Built images. Modded for factory test. Verified that (a) build directory contains autotests, (b) regular images do not contain autotests; and (c) images modified for factory test do contain autotests

Review URL: http://codereview.chromium.org/3124010
2010-08-11 16:15:16 -07:00
Olof Johansson
6d49138087 fix print of total elapsed time
BUG=none
TEST=run build_image, happen to finish on a time with less than 10 seconds in it, watch the missing 0-padding

Review URL: http://codereview.chromium.org/3050047
2010-08-09 16:05:50 -05:00
Anush Elangovan
56de1dd852 Check for system shflags
This change checks for and sources shflags from /usr/lib before
depending on the gclient-style path.

TEST=None
BUG=4230

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

Change-Id: I3085c2356c40c691a2a72bf79c1d9167162d6dca
2010-08-02 23:56:07 -07:00
David James
0366864a98 Enable fast build by default in build_image and mod_image_for_test.sh.
The fast build is stable enough now that we can enable it for everybody.
I ran the build constantly all weekend on two machines and I only ran into
one (rare) error, which I've fixed in a separate patch.

See <http://codereview.chromium.org/2856048/show>

TEST=Ran lots and lots of fast builds
BUG=none

Review URL: http://codereview.chromium.org/3059001
2010-07-28 17:08:29 -07:00
Anush Elangovan
2c7d19693e Move shflags into crosutils.git
Change-Id: I3aa6275362910addfaa25db9a1578a5496019c9e

Review URL: http://codereview.chromium.org/2983005
2010-07-13 15:24:54 -07:00
David James
fd7403ab89 Revert "Use --fast by default in build_image when --jobs is enabled."
See if this fixes the symlink problems we've been running into.

This reverts commit 8edffbaec5.
2010-07-09 12:00:17 -07:00
David James
8edffbaec5 Revert "Revert "Use --fast by default in build_image when --jobs is enabled.""
parallel_emerge prints a message every 30 seconds now so that buildbot doesn't
kill us early. Per discussion with cmasone, reverting the revert.

This reverts commit debaa3d8cf.
2010-07-08 21:21:41 -07:00
Chris Masone
debaa3d8cf Revert "Use --fast by default in build_image when --jobs is enabled."
This reverts commit f0fb864e8d.

This change needs to be reverted because it suppresses logging output
from the build process.  Thus, when something goes wrong...the
sherriff is left completely helpless in terms of debugging the issue.

TBR: davidjames@chromium.org
2010-07-08 21:10:23 -07:00
David James
f0fb864e8d Use --fast by default in build_image when --jobs is enabled.
Also update eretry to not pass in $EMERGE_JOBS anymore, in coordination with my previous change, which passed it in directly instead of depending on eretry to do so: http://codereview.chromium.org/2944004/show

TEST=Ran build_image --jobs 2 and build_packages --jobs 2
BUG=none

Review URL: http://codereview.chromium.org/2914004
2010-07-08 20:17:45 -07:00
Chris Sosa
d97985240a Check in to run unittests that uses src_test to build and run unittests.
TEST=Ran unittests with 2 test failures (powerd and update engine).
Will check with authors to fix these before moving the default over
to this.

Review URL: http://codereview.chromium.org/2837004
2010-06-16 14:29:50 -07:00
Nick Sanders
d250927093 Add Build Timer
Review URL: http://codereview.chromium.org/2859005
2010-06-16 03:50:04 -07:00
Chris Sosa
d44550272c Cleanup of adding pristine image and fixing of symlinks in developer image.
TEST=Tested with building a new image, looking in the output directory, running
the image and running vi.

Review URL: http://codereview.chromium.org/2075019
2010-05-20 10:14:06 -07:00
Amol Kher
9d2a7980cf Fixing DEFAULT and FACTORY mask to exclude usr/lib/debug folder
I verified that if I whack /usr/lib/debug folder and run build_image, it works fine. This is important since I plan to check in this issue first and then the fix to add debug flags.

Review URL: http://codereview.chromium.org/2113007
2010-05-19 17:30:29 -07:00
Tom Wai-Hong Tam
f87a3678dd Reduce the size of factory install shim.
Temporary approach to using INSTALL_MASK to suppress some non-relevant paths.
It reduces the size from ~426MB to ~163MB. Eventually, will remove it and
create a clean and separated ebuild for chromeos-factoryinstall.

Review URL: http://codereview.chromium.org/2084001
2010-05-17 16:06:33 +08:00
Chris Sosa
702618ff2b Move to using chromeos-test to emerge test dependencies in mod_image_for_test.
In addition unifies changes in mount_gpt_image and one-offs in mod_image_for_test
to consolidate gpt / var mounting.

Review URL: http://codereview.chromium.org/2064001
2010-05-14 12:52:32 -07:00
Olof Johansson
00171bdab6 Add /etc/init.d to INSTALL_MASK
Since we're using upstart, don't let packages drop startup scripts into
/etc/init.d.

BUG=none
TEST=Build image, inspect contents of /etc/init.d (or lack thereof, after this patch)

Review URL: http://codereview.chromium.org/2023006
2010-05-11 11:38:09 -07:00
Don Garrett
640a0585f5 Added restart_in_chroot_if_needed to common.sh.
Add restart_in_chroot_if_needed to common.sh, and modify the build scripts which referred to assert_inside_chroot to use it instead. The effect is that you don't ever have to explicitly enter_chroot.sh to build (still can, it work's fine).

Update mod_image_for_test.sh to use restart_in_chroot_if_needed

Review URL: http://codereview.chromium.org/1736025
2010-05-04 16:54:28 -07:00
Nasser Grainawi
cb5f3ebe52 Retry N-1 times with the --jobs flag, then drop it
Review URL: http://codereview.chromium.org/1545043
Patch from Nasser Grainawi <nasserg@quicinc.com>.
2010-04-21 08:46:49 -06:00
Chris Sosa
3d9a10b393 Fix install mask and move dev_mode to true when dev packages are installed
Review URL: http://codereview.chromium.org/1553028
2010-04-13 15:00:46 -07:00
robotboy
9891221b6e Add a safe_unmount function and use it in enter_chroot.
The safe_unmount function first tries a regular unmount,  If that
fails it warns and tries a lazy unmount.  If the lazy unmount fails
it dies.

Both unmounts take the -d option in case the mount is a loop device.

BUG=None
TEST=Entered and exited multiple chroots

Review URL: http://codereview.chromium.org/1593021
2010-04-12 14:08:14 -07:00
tedbo
373c3903c2 Add sudo_clobber and sudo_append functions so that we can "echo"
and "cat" stuff and pipe it to something that can write to a
file as root. For example:

echo "foo" | sudo_append /tmp/bar

will append "foo" to the file /tmp/bar as root. While

echo "foo" | sudo_clobber /tmp/bar

will truncate /tmp/bar and then write "foo" to the file.

Review URL: http://codereview.chromium.org/1610021
2010-04-12 10:52:40 -07:00
Chris Sosa
aa1a7fd63d Adds gmergefs. A method of remoting to a target and pushing new
packages using emerge from the host

Review URL: http://codereview.chromium.org/1515011
2010-04-02 14:06:29 -07:00
Darin Petkov
b2a21e7ecf Make errors and warnings a bit more obvious.
Review URL: http://codereview.chromium.org/1342001
2010-03-25 11:33:41 -07:00
David James
546747b982 Update enter_chroot.sh to exit with error messages when mount/unmount fails.
This is necessary for two reasons:
   1) It's nice to get an error message when mount/unmount fails
   2) set -e mode doesn't have any effect when you're in a subshell

Note that these mount/unmount failures do happen regularly in development,
so folks who depended on mount/umount failing silently will no longer be
able to rely on this and will have to kill the mounts manually.

Also fix subtle bugs in regexes for matching mount paths. (E.g. where the
regex for $HOME/chroot also matches $HOME/chroot2).

TEST=Tested mount/unmount with concurrently open shells.
     Tested mount/unmount when mount is being used by a process but the
     lock file does not reflect this.
BUG=none

Review URL: http://codereview.chromium.org/1211001
2010-03-23 15:19:43 -07:00
Luigi Semenzato
1f82e12eae Auxiliary function for args checks.
Review URL: http://codereview.chromium.org/1141010
2010-03-23 12:43:08 -07:00
Chris Sosa
acada7387b Changes to use default board when set by setup_board
Review URL: http://codereview.chromium.org/656023
2010-02-23 15:20:03 -08:00
Sam Leffler
a92ecd6718 fix finding overlays from the dev-server
Review URL: http://codereview.chromium.org/650182
2010-02-23 08:25:38 -08:00
David McMahon
4930294039 Fix archive_build.sh to work with new build using board subdirs.
Add some sane and useful defaults to common.sh for BOARDS.

Review URL: http://codereview.chromium.org/647053
2010-02-18 16:55:35 -08:00
robotboy
2ea03ac0fc Add warn and error functions to color warning and error output.
Review URL: http://codereview.chromium.org/601050
2010-02-11 15:30:55 -08:00
David McMahon
b7eb3a2be6 Add a warning to users trying to run old build scripts.
Add an exception for chrome-bot user for continuous builders.

Review URL: http://codereview.chromium.org/595009
2010-02-09 14:07:40 -08:00
Bill Richardson
10d27c2540 Rewrite make_chroot.sh to use local mirrors directly.
Use our karmic mirror for creating the build chroot, removing the need for
make_local_repo.sh and the repo_list_*.txt files. If a local repo exists
when build_chroot.sh is run it will be used, but it's no longer necessary.

This change does not remove make_local_repo.sh or the repo_list_*.txt files.

Review URL: http://codereview.chromium.org/548083
2010-01-20 13:38:50 -08:00
Steve VanDeBogart
8174ba0782 Move is_whitelisted to the common script so that all users get the previous fix
Fix typo to enable preinst scripts to run

Review URL: http://codereview.chromium.org/542097
2010-01-15 19:45:30 -08:00
tedbo
4f44d9e104 Use local apt cache instead of local_repo when mastering an image.
This change switches to mastering an image without using debootstrap.
We turn on the previously experimental bits that install a small
set of packages manually before handing things over to apt. In both
cases we use apt to download the packages so that it can populate
it's local package cache.

With this change we will no longer depend on the local_repo when
mastering an image. Developers will not have to rebuild their
local repo when repo_list_image.txt changes. Instead we will use
and lazy-fill the local apt-cache. The first time you build_image.sh
it will be slow since it needs to download the packages. Subsequent
runs should be as before since it will use the local cache. If
packages are added they should be lazily fetched in the next image
build.

Until we have a fully populated external mirror, developers will
still have to add packages to repo_list_image.txt. Also, until
make_chroot is switched over to use the external repo then
developers will have to redo their local repo when the
repo_list_dev.txt changes.

Review URL: http://codereview.chromium.org/521073
2010-01-08 17:26:11 -08:00
Alexey Marinichev
63c42aa811 Simplified counting CPUs.
Review URL: http://codereview.chromium.org/501153
2009-12-21 11:42:39 -08:00
derat@google.com
86dcc8e68b build: Make enter_chroot.sh fail if run as root.
BUG=684

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

git-svn-id: svn://chrome-svn/chromeos/trunk@304 06c00378-0e64-4dae-be16-12b19f9950a1
2009-11-21 19:49:49 +00:00
rspangler@google.com
d74220d772 Start copying over source.
git-svn-id: svn://chrome-svn/chromeos/trunk@4 06c00378-0e64-4dae-be16-12b19f9950a1
2009-10-09 20:56:14 +00:00