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 \
48 if [ -n "$INCLUDE_VK_CTS" ]; then
49 apt-get
install -y libvulkan1
57 export PS1=lava-shell:
62 mkdir
-p /lib
/firmware
/rtl_nic
63 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
65 #######################################################################
66 # Strip the image to a small minimal system without removing the debian
69 # xz compress firmware so it doesn't waste RAM at runtime. Except db820c's
70 # GPU firmware, due to using a precompiled kernel without compression support.
71 find /lib
/firmware
-type f
-print0 | \
73 xargs -0r -P4 -n4 xz
-T1 -C crc32
74 ln -s /lib
/firmware
/qcom
/a530
* /lib
/firmware
/
76 # Copy timezone file and remove tzdata package
78 cp /usr
/share
/zoneinfo
/Etc
/UTC
/etc
/localtime
80 UNNEEDED_PACKAGES
="libfdisk1
85 export DEBIAN_FRONTEND
=noninteractive
87 # Removing unused packages
88 for PACKAGE
in ${UNNEEDED_PACKAGES}
91 if ! apt-get remove
--purge --yes "${PACKAGE}"
93 echo "WARNING: ${PACKAGE} isn't installed"
97 apt-get autoremove
--yes || true
102 # Dropping documentation, localization, i18n files, etc
103 rm -rf /usr
/share
/doc
/*
104 rm -rf /usr
/share
/locale
/*
105 rm -rf /usr
/share
/X11
/locale
/*
106 rm -rf /usr
/share
/man
107 rm -rf /usr
/share
/i18n
/*
108 rm -rf /usr
/share
/info
/*
109 rm -rf /usr
/share
/lintian
/*
110 rm -rf /usr
/share
/common-licenses
/*
111 rm -rf /usr
/share
/mime
/*
113 # Dropping reportbug scripts
114 rm -rf /usr
/share
/bug
116 # Drop udev hwdb not required on a stripped system
117 rm -rf /lib
/udev
/hwdb.bin
/lib
/udev
/hwdb.d
/*
119 # Drop all gconv conversions && binaries
121 rm -rf usr
/sbin
/iconvconfig
122 rm -rf usr
/lib
/*/gconv
/
124 # Remove libusb database
125 rm -rf usr
/sbin
/update-usbids
126 rm -rf var
/lib
/usbutils
/usb.ids
127 rm -rf usr
/share
/misc
/usb.ids
129 #######################################################################
130 # Crush into a minimal production image to be deployed via some type of image
132 # IMPORTANT: The Debian system is not longer functional at this point,
133 # for example, apt and dpkg will stop working
135 UNNEEDED_PACKAGES
="apt libapt-pkg6.0 "\
136 "ncurses-bin ncurses-base libncursesw6 libncurses6 "\
138 "debconf libdebconfclient0 "\
139 "e2fsprogs e2fslibs libfdisk1 "\
142 "init-system-helpers "\
147 "libsemanage1 libsemanage-common "\
152 "debian-archive-keyring "\
158 "libgles2-mesa-dev "\
163 # Removing unneeded packages
164 for PACKAGE
in ${UNNEEDED_PACKAGES}
166 echo "Forcing removal of ${PACKAGE}"
167 if ! dpkg
--purge --force-remove-essential --force-depends "${PACKAGE}"
169 echo "WARNING: ${PACKAGE} isn't installed"
173 # Show what's left package-wise before dropping dpkg itself
174 COLUMNS
=300 dpkg-query
-W --showformat='${Installed-Size;10}\t${Package}\n' |
sort -k1,1n
177 dpkg
--purge --force-remove-essential --force-depends dpkg
179 # No apt or dpkg, no need for its configuration archives
183 # Drop directories not part of ostree
184 # Note that /var needs to exist as ostree bind mounts the deployment /var over
186 rm -rf var
/* opt srv share
188 # ca-certificates are in /etc drop the source
189 rm -rf usr
/share
/ca-certificates
191 # No bash, no need for completions
192 rm -rf usr
/share
/bash-completion
194 # No zsh, no need for comletions
195 rm -rf usr
/share
/zsh
/vendor-completions
197 # drop gcc-6 python helpers
198 rm -rf usr
/share
/gcc-6
200 # Drop sysvinit leftovers
202 rm -rf etc
/rc
[0-6S].d
204 # Drop upstart helpers
207 # Various xtables helpers
208 rm -rf usr
/lib
/xtables
211 # TODO: only remaining locale is actually "C". Should we really remove it?
212 rm -rf usr
/lib
/locale
/*
215 rm -rf usr
/sbin
/*fdisk
218 rm -rf usr
/bin
/localedef
220 # Systemd dns resolver
221 find usr etc
-name '*systemd-resolve*' -prune -exec rm -r {} \
;
223 # Systemd network configuration
224 find usr etc
-name '*networkd*' -prune -exec rm -r {} \
;
227 find usr etc
-name '*timesyncd*' -prune -exec rm -r {} \
;
229 # systemd hw database manager
230 find usr etc
-name '*systemd-hwdb*' -prune -exec rm -r {} \
;
233 find usr etc
-name '*fuse*' -prune -exec rm -r {} \
;
235 # lsb init function leftovers
238 # Only needed when adding libraries
239 rm -rf usr
/sbin
/ldconfig
*
244 # Remove pam module to authenticate against a DB
245 # plus libdb-5.3.so that is only used by this pam module
246 rm -rf usr
/lib
/*/security
/pam_userdb.so
247 rm -rf usr
/lib
/*/libdb-5.3.so
249 # remove NSS support for nis, nisplus and hesiod
250 rm -rf usr
/lib
/*/libnss_hesiod
*
251 rm -rf usr
/lib
/*/libnss_nis
*