##// END OF EJS Templates
Added: ENABLE_REDUCE - down to 160MB used space,fix-resolve,fix-machineid
Jan Wagner -
r73:62453b92723b
parent child
Show More
@@ -0,0 +1,2
1 Dir::Cache::pkgcache "";
2 Dir::Cache::srcpkgcache "";
@@ -0,0 +1,2
1 Acquire::GzipIndexes "true";
2 Acquire::CompressionTypes::Order:: "gz";
@@ -0,0 +1,2
1 APT::Install-Suggests "0";
2 APT::Install-Recommends "0";
@@ -0,0 +1,9
1 path-exclude /usr/share/doc/*
2 path-include /usr/share/doc/*/copyright
3 path-exclude /usr/share/man/*
4 path-exclude /usr/share/groff/*
5 path-exclude /usr/share/info/*
6 path-exclude /usr/share/lintian/*
7 path-exclude /usr/share/linda/*
8 path-exclude /usr/share/locale/*
9 path-include /usr/share/locale/en*
@@ -0,0 +1,9
1 path-exclude=/usr/share/doc/*
2 path-include=/usr/share/doc/*/copyright
3 path-exclude=/usr/share/man/*
4 path-exclude=/usr/share/groff/*
5 path-exclude=/usr/share/info/*
6 path-exclude=/usr/share/lintian/*
7 path-exclude=/usr/share/linda/*
8 path-exclude=/usr/share/locale/*
9 path-include=/usr/share/locale/en*
@@ -0,0 +1,3
1 logger -t "rc.firstboot" "Generating D-Bus machine-id"
2 rm -f /var/lib/dbus/machine-id
3 dbus-uuidgen --ensure
@@ -0,0 +1,4
1 logger -t "rc.firstboot" "Creating /etc/resolv.conf symlink"
2 if [ -f "/run/systemd/resolve/resolv.conf" ] ; then
3 ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
4 fi
@@ -20,6 +20,7 APT_SERVER=ftp.de.debian.org APT_PROXY="http://127.0.0.1:3142/" ./rpi2-gen-image
20 20 ENABLE_MINBASE=true ./rpi2-gen-image.sh
21 21 BUILD_KERNEL=true ENABLE_MINBASE=true ENABLE_IPV6=false ./rpi2-gen-image.sh
22 22 BUILD_KERNEL=true KERNEL_SRCDIR=/tmp/linux ./rpi2-gen-image.sh
23 ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi2-gen-image.sh
23 24 ```
24 25
25 26 #### APT settings:
@@ -129,6 +130,9 Install a user defined window manager for the X Window System. To make sure all
129 130 ##### `ENABLE_MINBASE`=false
130 131 Use debootstrap script variant `minbase` which only includes essential packages and apt. This will reduce the disk usage by about 65 MB.
131 132
133 ##### `ENABLE_REDUCE`=false
134 Reduce the disk usage by deleting all man pages and doc files (harsh). APT will be configured to use compressed package repository lists and no package caching files. If `ENABLE_MINGPU`=true unnecessary start.elf and fixup.dat files will also be removed from the boot partition. This will make it possible to generate output OS images with about 160MB of used disk space. It's recommended to use this parameter in combination with `ENABLE_MINBASE`=true.
135
132 136 ##### `ENABLE_UBOOT`=false
133 137 Replace default RPi2 second stage bootloader (bootcode.bin) with U-Boot bootloader. U-Boot can boot images via the network using the BOOTP/TFTP protocol.
134 138
@@ -204,6 +208,7 All the required configuration files that will be copied to the generated OS ima
204 208 | Directory | Description |
205 209 | --- | --- |
206 210 | `boot` | Boot and RPi2 configuration files |
211 | `dpkg` | Package Manager configuration |
207 212 | `firstboot` | Scripts that get executed on first boot |
208 213 | `iptables` | Firewall configuration files |
209 214 | `locales` | Locales configuration |
@@ -52,7 +52,11 if [ "$BUILD_KERNEL" = true ] ; then
52 52 fi
53 53
54 54 # Install kernel modules
55 make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} INSTALL_MOD_PATH=../../.. modules_install
55 if [ "$ENABLE_REDUCE" = true ] ; then
56 make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install
57 else
58 make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} INSTALL_MOD_PATH=../../.. modules_install
59 fi
56 60
57 61 # Install kernel headers
58 62 if [ "$KERNEL_HEADERS" = true ] ; then
@@ -19,6 +19,12 if [ "$EXPANDROOT" = true ] ; then
19 19 cat files/firstboot/22-expandroot.sh >> $R/etc/rc.firstboot
20 20 fi
21 21
22 # Ensure that dbus machine-id exists
23 cat files/firstboot/23-generate-machineid.sh >> $R/etc/rc.firstboot
24
25 # Create /etc/resolv.conf symlink
26 cat files/firstboot/24-create-resolv-symlink.sh >> $R/etc/rc.firstboot
27
22 28 # Finalize rc.firstboot script
23 29 cat files/firstboot/99-finish.sh >> $R/etc/rc.firstboot
24 30 chmod +x $R/etc/rc.firstboot
@@ -89,6 +89,7 ENABLE_ROOT_SSH=${ENABLE_ROOT_SSH:=false}
89 89
90 90 # Advanced settings
91 91 ENABLE_MINBASE=${ENABLE_MINBASE:=false}
92 ENABLE_REDUCE=${ENABLE_REDUCE:=flase}
92 93 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
93 94 ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
94 95 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
@@ -296,8 +297,44 EOF
296 297 rm -rf "${R}/chroot_scripts"
297 298 fi
298 299
299 ## Cleanup
300 chroot_exec apt-get purge -q -y --force-yes apt-utils
300 # Remove apt-utils
301 chroot_exec apt-get purge -qq -y --force-yes apt-utils
302
303 # Reduce the image size by removing and compressing
304 if [ "$ENABLE_REDUCE" = true ] ; then
305 # Install dpkg configuration fragment file
306 install_readonly files/dpkg/01nodoc $R/etc/dpkg/dpkg.cfg.d/01nodoc
307
308 # Install APT configuration fragment files
309 install_readonly files/apt/02nocache $R/etc/apt/apt.conf.d/02nocache
310 install_readonly files/apt/03compress $R/etc/apt/apt.conf.d/03compress
311 install_readonly files/apt/04norecommends $R/etc/apt/apt.conf.d/04norecommends
312
313 # Remove APT cache files
314 rm -fr $R/var/cache/apt/pkgcache.bin
315 rm -fr $R/var/cache/apt/srcpkgcache.bin
316
317 # Remove all doc and man files
318 find $R/usr/share/doc -depth -type f ! -name copyright | xargs rm || true
319 find $R/usr/share/doc -empty | xargs rmdir || true
320 rm -rf $R/usr/share/man $R/usr/share/groff $R/usr/share/info $R/usr/share/lintian $R/usr/share/linda $R/var/cache/man
321
322 # Remove all translation files
323 find $R/usr/share/locale -mindepth 1 -maxdepth 1 ! -name 'en' | xargs rm -r
324
325 # Clean APT list of repositories
326 rm -fr $R/var/lib/apt/lists/*
327 chroot_exec apt-get -qq -y update
328
329 if [ "$ENABLE_MINGPU" = true ] ; then
330 rm -f $R/boot/firmware/start.elf
331 rm -f $R/boot/firmware/fixup.dat
332 rm -f $R/boot/firmware/start_x.elf
333 rm -f $R/boot/firmware/fixup_x.dat
334 fi
335 fi
336
337 # APT Cleanup
301 338 chroot_exec apt-get -y clean
302 339 chroot_exec apt-get -y autoclean
303 340 chroot_exec apt-get -y autoremove
@@ -306,19 +343,21 chroot_exec apt-get -y autoremove
306 343 umount -l $R/proc
307 344 umount -l $R/sys
308 345
346 # Clean up directories
347 rm -rf $R/run
348 rm -rf $R/tmp/*
349
309 350 # Clean up files
310 351 rm -f $R/etc/apt/sources.list.save
311 352 rm -f $R/etc/resolvconf/resolv.conf.d/original
312 rm -rf $R/run
313 mkdir -p $R/run
314 353 rm -f $R/etc/*-
315 354 rm -f $R/root/.bash_history
316 rm -rf $R/tmp/*
317 355 rm -f $R/var/lib/urandom/random-seed
318 [ -L $R/var/lib/dbus/machine-id ] || rm -f $R/var/lib/dbus/machine-id
356 rm -f $R/var/lib/dbus/machine-id
319 357 rm -f $R/etc/machine-id
320 rm -fr $R/etc/apt/apt.conf.d/10proxy
358 rm -f $R/etc/apt/apt.conf.d/10proxy
321 359 rm -f $R/etc/resolv.conf
360 rm -f "${R}${QEMU_BINARY}"
322 361
323 362 # Calculate size of the chroot directory in KB
324 363 CHROOT_SIZE=$(expr `du -s $R | awk '{ print $1 }'`)
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant