mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-29 09:31:06 +02:00
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
This commit is contained in:
parent
9c5e5ecad3
commit
f87a3678dd
26
build_image
26
build_image
@ -39,6 +39,9 @@ DEFINE_boolean statefuldev $FLAGS_TRUE \
|
|||||||
"Install development packages on stateful partition rather than the rootfs"
|
"Install development packages on stateful partition rather than the rootfs"
|
||||||
DEFINE_string to "" \
|
DEFINE_string to "" \
|
||||||
"The target image file or device"
|
"The target image file or device"
|
||||||
|
DEFINE_boolean factory_install $FLAGS_FALSE \
|
||||||
|
"Build a smaller image to overlay the factory install shim on; this argument \
|
||||||
|
is also required in image_to_usb."
|
||||||
DEFINE_string arm_extra_bootargs "" \
|
DEFINE_string arm_extra_bootargs "" \
|
||||||
"Additional command line options to pass to the ARM kernel."
|
"Additional command line options to pass to the ARM kernel."
|
||||||
|
|
||||||
@ -180,7 +183,12 @@ fi
|
|||||||
|
|
||||||
# Create root file system disk image to fit on a 1GB memory stick.
|
# Create root file system disk image to fit on a 1GB memory stick.
|
||||||
# 1 GB in hard-drive-manufacturer-speak is 10^9, not 2^30. 950MB < 10^9 bytes.
|
# 1 GB in hard-drive-manufacturer-speak is 10^9, not 2^30. 950MB < 10^9 bytes.
|
||||||
ROOT_SIZE_BYTES=$((1024 * 1024 * 720))
|
if [[ $FLAGS_factory_install -eq ${FLAGS_TRUE} ]] ; then
|
||||||
|
ROOT_SIZE_BYTES=$((1024 * 1024 * 180))
|
||||||
|
else
|
||||||
|
ROOT_SIZE_BYTES=$((1024 * 1024 * 720))
|
||||||
|
fi
|
||||||
|
|
||||||
dd if=/dev/zero of="$ROOT_FS_IMG" bs=1 count=1 seek=$((ROOT_SIZE_BYTES - 1))
|
dd if=/dev/zero of="$ROOT_FS_IMG" bs=1 count=1 seek=$((ROOT_SIZE_BYTES - 1))
|
||||||
sudo losetup "$LOOP_DEV" "$ROOT_FS_IMG"
|
sudo losetup "$LOOP_DEV" "$ROOT_FS_IMG"
|
||||||
sudo mkfs.ext3 "$LOOP_DEV"
|
sudo mkfs.ext3 "$LOOP_DEV"
|
||||||
@ -259,6 +267,12 @@ if [[ $FLAGS_installmask -eq ${FLAGS_TRUE} ]] ; then
|
|||||||
INSTALL_MASK="$DEFAULT_INSTALL_MASK"
|
INSTALL_MASK="$DEFAULT_INSTALL_MASK"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Reduce the size of factory install shim.
|
||||||
|
# TODO: Build a separated ebuild for the factory install shim to reduce size.
|
||||||
|
if [[ $FLAGS_factory_install -eq ${FLAGS_TRUE} ]] ; then
|
||||||
|
INSTALL_MASK="$INSTALL_MASK $FACTORY_INSTALL_MASK"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $FLAGS_jobs -ne -1 ]]; then
|
if [[ $FLAGS_jobs -ne -1 ]]; then
|
||||||
EMERGE_JOBS="--jobs=$FLAGS_jobs"
|
EMERGE_JOBS="--jobs=$FLAGS_jobs"
|
||||||
fi
|
fi
|
||||||
@ -349,8 +363,7 @@ EOF
|
|||||||
|
|
||||||
# By default, dev mode should be activated for either development builds or
|
# By default, dev mode should be activated for either development builds or
|
||||||
# test builds.
|
# test builds.
|
||||||
if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ||\
|
if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then
|
||||||
[[ $FLAGS_withtest -eq $FLAGS_TRUE ]]; then
|
|
||||||
sudo touch "$ROOT_FS_DIR/root/.dev_mode"
|
sudo touch "$ROOT_FS_DIR/root/.dev_mode"
|
||||||
|
|
||||||
# Re-run ldconfig to fix /etc/ldconfig.so.cache.
|
# Re-run ldconfig to fix /etc/ldconfig.so.cache.
|
||||||
@ -363,10 +376,13 @@ fi
|
|||||||
--target="$ARCH" \
|
--target="$ARCH" \
|
||||||
--board="$BOARD"
|
--board="$BOARD"
|
||||||
|
|
||||||
# Check that the image has been correctly created.
|
# Don't test the factory install shim.
|
||||||
"${SCRIPTS_DIR}/test_image" \
|
if [[ $FLAGS_factory_install -eq ${FLAGS_FALSE} ]] ; then
|
||||||
|
# Check that the image has been correctly created.
|
||||||
|
"${SCRIPTS_DIR}/test_image" \
|
||||||
--root="$ROOT_FS_DIR" \
|
--root="$ROOT_FS_DIR" \
|
||||||
--target="$ARCH"
|
--target="$ARCH"
|
||||||
|
fi
|
||||||
|
|
||||||
# Clean up symlinks so they work on a running target rooted at "/".
|
# Clean up symlinks so they work on a running target rooted at "/".
|
||||||
# Here development packages are rooted at /usr/local. However, do not
|
# Here development packages are rooted at /usr/local. However, do not
|
||||||
|
@ -123,6 +123,12 @@ DEFAULT_INSTALL_MASK="/usr/include /usr/man /usr/share/man /usr/share/doc \
|
|||||||
/usr/share/pkgconfig /usr/share/gettext /usr/share/readline /etc/runlevels \
|
/usr/share/pkgconfig /usr/share/gettext /usr/share/readline /etc/runlevels \
|
||||||
/usr/share/openrc /lib/rc *.a *.la /etc/init.d"
|
/usr/share/openrc /lib/rc *.a *.la /etc/init.d"
|
||||||
|
|
||||||
|
FACTORY_INSTALL_MASK="/opt/google/chrome /opt/google/o3d /opt/netscape \
|
||||||
|
/usr/lib/dri /usr/lib/python2.6/test /usr/share/chewing /usr/share/fonts \
|
||||||
|
/usr/share/ibus-pinyin /usr/share/libhangul /usr/share/locale \
|
||||||
|
/usr/share/m17n /usr/share/mime /usr/share/sounds /usr/share/tts \
|
||||||
|
/usr/share/X11 /usr/share/zoneinfo"
|
||||||
|
|
||||||
# Check to ensure not running old scripts
|
# Check to ensure not running old scripts
|
||||||
V_REVERSE='[7m'
|
V_REVERSE='[7m'
|
||||||
V_VIDOFF='[m'
|
V_VIDOFF='[m'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user