diff options
author | Alistair Delva <adelva@google.com> | 2022-03-01 15:27:13 -0800 |
---|---|---|
committer | Alistair Delva <adelva@google.com> | 2022-03-01 15:27:17 -0800 |
commit | 82627b72bb62aebca3e1c454e90c065903b4b7ff (patch) | |
tree | b12c8c69720eeade15ace2cd98b56d9a55dcdefd | |
parent | 0f81b485b8dc1b35753516c1378f50ac60e20f54 (diff) | |
download | tests-82627b72bb62aebca3e1c454e90c065903b4b7ff.tar.gz |
build_rootfs.sh: Avoid out of space issues in stage2
The iptables and cuttlefish-common use different sets of a large number
of build dependencies. Remove them incrementally as we are building to
conserve space on the small target disk image.
Change-Id: Icf89787d133f30fdb7e3d63cad48e2b06f5f38a8
-rw-r--r-- | net/test/rootfs/bullseye-common.sh | 16 | ||||
-rwxr-xr-x | net/test/rootfs/bullseye-cuttlefish.sh | 7 | ||||
-rwxr-xr-x | net/test/rootfs/bullseye-rockpi.sh | 8 |
3 files changed, 16 insertions, 15 deletions
diff --git a/net/test/rootfs/bullseye-common.sh b/net/test/rootfs/bullseye-common.sh index 3bf0b1c..39f31d9 100644 --- a/net/test/rootfs/bullseye-common.sh +++ b/net/test/rootfs/bullseye-common.sh @@ -22,6 +22,8 @@ debian_iptables=1.8.7-1 cuttlefish=android-cuttlefish setup_and_build_iptables() { + get_installed_packages >/root/originally-installed + # Install everything needed from bullseye to build iptables apt-get install -y \ build-essential \ @@ -68,6 +70,10 @@ setup_and_build_iptables() { # Build debian packages from the integrated iptables source dpkg-buildpackage -F -d -us -uc cd - + + get_installed_packages >/root/installed + remove_installed_packages /root/originally-installed /root/installed + apt-get clean } install_and_cleanup_iptables() { @@ -91,6 +97,8 @@ install_and_cleanup_iptables() { } setup_and_build_cuttlefish() { + get_installed_packages >/root/originally-installed + # Install everything needed from bullseye to build cuttlefish-common apt-get install -y \ cdbs \ @@ -100,11 +108,19 @@ setup_and_build_cuttlefish() { git \ golang + if [ "$(uname -m)" = "arm64" ]; then + apt-get install -y libc6-dev:amd64 + fi + # Fetch cuttlefish and build it for cuttlefish-common git clone https://github.com/google/android-cuttlefish.git /usr/src/$cuttlefish cd /usr/src/$cuttlefish dpkg-buildpackage -d -uc -us cd - + + get_installed_packages >/root/installed + remove_installed_packages /root/originally-installed /root/installed + apt-get clean } install_and_cleanup_cuttlefish() { diff --git a/net/test/rootfs/bullseye-cuttlefish.sh b/net/test/rootfs/bullseye-cuttlefish.sh index 0771ac1..4ac5248 100755 --- a/net/test/rootfs/bullseye-cuttlefish.sh +++ b/net/test/rootfs/bullseye-cuttlefish.sh @@ -28,18 +28,11 @@ update_apt_sources bullseye setup_cuttlefish_user -get_installed_packages >/root/originally-installed - setup_and_build_cuttlefish setup_and_build_iptables -get_installed_packages >/root/installed - -remove_installed_packages /root/originally-installed /root/installed - install_and_cleanup_cuttlefish sed -i "s,^#\(bridge_interface=\),\1br0," /etc/default/cuttlefish-common - install_and_cleanup_iptables create_systemd_getty_symlinks ttyS0 hvc1 diff --git a/net/test/rootfs/bullseye-rockpi.sh b/net/test/rootfs/bullseye-rockpi.sh index e8188c3..6974099 100755 --- a/net/test/rootfs/bullseye-rockpi.sh +++ b/net/test/rootfs/bullseye-rockpi.sh @@ -370,17 +370,9 @@ update_apt_sources bullseye setup_cuttlefish_user -get_installed_packages >/root/originally-installed - -apt-get install -y libc6-dev:amd64 - setup_and_build_cuttlefish setup_and_build_iptables -get_installed_packages >/root/installed - -remove_installed_packages /root/originally-installed /root/installed - install_and_cleanup_cuttlefish install_and_cleanup_iptables |