5 if [ $DEBIAN_ARCH = arm64
]; then
6 ARCH_PACKAGES
="firmware-qcom-media"
7 elif [ $DEBIAN_ARCH = amd64
]; then
8 # Upstream LLVM package repository
9 apt-get
-y install --no-install-recommends gnupg ca-certificates
10 apt-key add
/llvm-snapshot.gpg.key
11 echo "deb https://apt.llvm.org/buster/ llvm-toolchain-buster-9 main" >/etc
/apt
/sources.list.d
/llvm9.list
14 ARCH_PACKAGES
="libelf1
26 apt-get
-y install --no-install-recommends \
47 if [ -n "$INCLUDE_VK_CTS" ]; then
48 apt-get
install -y libvulkan1
56 export PS1=lava-shell:
61 mkdir
-p /lib
/firmware
/rtl_nic
62 wget https
://git.kernel.org
/pub
/scm
/linux
/kernel
/git
/firmware
/linux-firmware.git
/tree
/rtl_nic
/rtl8153a-3.fw
-O /lib
/firmware
/rtl_nic
/rtl8153a-3.fw
64 #######################################################################
65 # Strip the image to a small minimal system without removing the debian
68 # xz compress firmware so it doesn't waste RAM at runtime. Except db820c's
69 # GPU firmware, due to using a precompiled kernel without compression support.
70 find /lib
/firmware
-type f
-print0 | \
72 xargs -0r -P4 -n4 xz
-T1 -C crc32
73 ln -s /lib
/firmware
/qcom
/a530
* /lib
/firmware
/
75 # Copy timezone file and remove tzdata package
77 cp /usr
/share
/zoneinfo
/Etc
/UTC
/etc
/localtime
79 UNNEEDED_PACKAGES
="libfdisk1
84 export DEBIAN_FRONTEND
=noninteractive
86 # Removing unused packages
87 for PACKAGE
in ${UNNEEDED_PACKAGES}
90 if ! apt-get remove
--purge --yes "${PACKAGE}"
92 echo "WARNING: ${PACKAGE} isn't installed"
96 apt-get autoremove
--yes || true
101 # Dropping documentation, localization, i18n files, etc
102 rm -rf /usr
/share
/doc
/*
103 rm -rf /usr
/share
/locale
/*
104 rm -rf /usr
/share
/X11
/locale
/*
105 rm -rf /usr
/share
/man
106 rm -rf /usr
/share
/i18n
/*
107 rm -rf /usr
/share
/info
/*
108 rm -rf /usr
/share
/lintian
/*
109 rm -rf /usr
/share
/common-licenses
/*
110 rm -rf /usr
/share
/mime
/*
112 # Dropping reportbug scripts
113 rm -rf /usr
/share
/bug
115 # Drop udev hwdb not required on a stripped system
116 rm -rf /lib
/udev
/hwdb.bin
/lib
/udev
/hwdb.d
/*
118 # Drop all gconv conversions && binaries
120 rm -rf usr
/sbin
/iconvconfig
121 rm -rf usr
/lib
/*/gconv
/
123 # Remove libusb database
124 rm -rf usr
/sbin
/update-usbids
125 rm -rf var
/lib
/usbutils
/usb.ids
126 rm -rf usr
/share
/misc
/usb.ids
128 #######################################################################
129 # Crush into a minimal production image to be deployed via some type of image
131 # IMPORTANT: The Debian system is not longer functional at this point,
132 # for example, apt and dpkg will stop working
134 UNNEEDED_PACKAGES
="apt libapt-pkg6.0 "\
135 "ncurses-bin ncurses-base libncursesw6 libncurses6 "\
137 "debconf libdebconfclient0 "\
138 "e2fsprogs e2fslibs libfdisk1 "\
141 "init-system-helpers "\
146 "libsemanage1 libsemanage-common "\
151 "debian-archive-keyring "\
157 "libgles2-mesa-dev "\
162 # Removing unneeded packages
163 for PACKAGE
in ${UNNEEDED_PACKAGES}
165 echo "Forcing removal of ${PACKAGE}"
166 if ! dpkg
--purge --force-remove-essential --force-depends "${PACKAGE}"
168 echo "WARNING: ${PACKAGE} isn't installed"
172 # Show what's left package-wise before dropping dpkg itself
173 COLUMNS
=300 dpkg-query
-W --showformat='${Installed-Size;10}\t${Package}\n' |
sort -k1,1n
176 dpkg
--purge --force-remove-essential --force-depends dpkg
178 # No apt or dpkg, no need for its configuration archives
182 # Drop directories not part of ostree
183 # Note that /var needs to exist as ostree bind mounts the deployment /var over
185 rm -rf var
/* opt srv share
187 # ca-certificates are in /etc drop the source
188 rm -rf usr
/share
/ca-certificates
190 # No bash, no need for completions
191 rm -rf usr
/share
/bash-completion
193 # No zsh, no need for comletions
194 rm -rf usr
/share
/zsh
/vendor-completions
196 # drop gcc-6 python helpers
197 rm -rf usr
/share
/gcc-6
199 # Drop sysvinit leftovers
201 rm -rf etc
/rc
[0-6S].d
203 # Drop upstart helpers
206 # Various xtables helpers
207 rm -rf usr
/lib
/xtables
210 # TODO: only remaining locale is actually "C". Should we really remove it?
211 rm -rf usr
/lib
/locale
/*
214 rm -rf usr
/sbin
/*fdisk
217 rm -rf usr
/bin
/localedef
219 # Systemd dns resolver
220 find usr etc
-name '*systemd-resolve*' -prune -exec rm -r {} \
;
222 # Systemd network configuration
223 find usr etc
-name '*networkd*' -prune -exec rm -r {} \
;
226 find usr etc
-name '*timesyncd*' -prune -exec rm -r {} \
;
228 # systemd hw database manager
229 find usr etc
-name '*systemd-hwdb*' -prune -exec rm -r {} \
;
232 find usr etc
-name '*fuse*' -prune -exec rm -r {} \
;
234 # lsb init function leftovers
237 # Only needed when adding libraries
238 rm -rf usr
/sbin
/ldconfig
*
243 # Remove pam module to authenticate against a DB
244 # plus libdb-5.3.so that is only used by this pam module
245 rm -rf usr
/lib
/*/security
/pam_userdb.so
246 rm -rf usr
/lib
/*/libdb-5.3.so
248 # remove NSS support for nis, nisplus and hesiod
249 rm -rf usr
/lib
/*/libnss_hesiod
*
250 rm -rf usr
/lib
/*/libnss_nis
*