##// END OF EJS Templates
Added: KERNELSRC_PREBUILT, KERNELSRC_ rename, fix-quotes
Jan Wagner -
r75:24bd7e97cf9d
parent child
Show More
@@ -1,3 +1,4
1 1 images
2 2 custom.d
3 3 *.swp
4 *.log
@@ -19,7 +19,7 ENABLE_HARDNET=true ENABLE_IPTABLES=true /rpi2-gen-image.sh
19 19 APT_SERVER=ftp.de.debian.org APT_PROXY="http://127.0.0.1:3142/" ./rpi2-gen-image.sh
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 BUILD_KERNEL=true KERNEL_SRCDIR=/tmp/linux ./rpi2-gen-image.sh
22 BUILD_KERNEL=true KERNELSRC_DIR=/tmp/linux ./rpi2-gen-image.sh
23 23 ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi2-gen-image.sh
24 24 ```
25 25
@@ -165,9 +165,6 Path to a directory with scripts that should be run in the chroot before the ima
165 165 ##### `BUILD_KERNEL`=false
166 166 Build and install the latest RPi2 Linux kernel. Currently only the default RPi2 kernel configuration is used. Detailed configuration parameters for customizing the kernel and minor bug fixes still need to get implemented. feel free to help.
167 167
168 ##### `KERNEL_SRCDIR`=""
169 Path to a directory of [RaspberryPi Linux kernel sources](https://github.com/raspberrypi/linux) that will be copied, configured, build and installed inside the chroot.
170
171 168 ##### `KERNEL_THREADS`=1
172 169 Number of parallel kernel building threads. If the parameter is left untouched the script will automatically determine the number of CPU cores to set the number of parallel threads to speed the kernel compilation.
173 170
@@ -177,14 +174,20 Install kernel headers with built kernel.
177 174 ##### `KERNEL_MENUCONFIG`=false
178 175 Start `make menuconfig` interactive menu-driven kernel configuration. The script will continue after `make menuconfig` was terminated.
179 176
180 ##### `KERNEL_CONFIGSRC`=true
181 Run `make bcm2709_defconfig` (and optional `make menuconfig`) to configure the kernel sources before building. This setting is automatically set to `true` if no existing kernel sources directory was specified using `KERNEL_SRCDIR`.
177 ##### `KERNEL_REMOVESRC`=true
178 Remove all kernel sources from the generated OS image after it was built and installed.
182 179
183 ##### `KERNEL_CLEANSRC`=false
184 Clean the existing kernel sources directory `KERNEL_SRCDIR` (using `make mrproper`) after it was copied to the chroot and before the compilation of the kernel has started. This setting will be ignored if no `KERNEL_SRCDIR` was specified.
180 ##### `KERNELSRC_DIR`=""
181 Path to a directory of [RaspberryPi Linux kernel sources](https://github.com/raspberrypi/linux) that will be copied, configured, build and installed inside the chroot.
185 182
186 ##### `KERNEL_RMSRC`=true
187 Remove all kernel sources from the generated OS image after it was built and installed.
183 ##### `KERNELSRC_CLEAN`=false
184 Clean the existing kernel sources directory `KERNELSRC_DIR` (using `make mrproper`) after it was copied to the chroot and before the compilation of the kernel has started. This setting will be ignored if no `KERNELSRC_DIR` was specified or if `KERNELSRC_PREBUILT`=true.
185
186 ##### `KERNELSRC_CONFIG`=true
187 Run `make bcm2709_defconfig` (and optional `make menuconfig`) to configure the kernel sources before building. This setting is automatically set to `true` if no existing kernel sources directory was specified using `KERNELSRC_DIR`. This settings is ignored if `KERNELSRC_PREBUILT`=true.
188
189 ##### `KERNELSRC_PREBUILT`=false
190 With this parameter set to true the script expects the existing kernel sources directory to be already successfully cross-compiled. The parameters `KERNELSRC_CLEAN`, `KERNELSRC_CONFIG` and `KERNEL_MENUCONFIG` are ignored and no kernel compilation tasks are performed.
188 191
189 192 ## Understanding the script
190 193 The functions of this script that are required for the different stages of the bootstrapping are split up into single files located inside the `bootstrap.d` directory. During the bootstrapping every script in this directory gets executed in lexicographical order:
@@ -7,22 +7,22
7 7
8 8 # Base debootstrap (unpack only)
9 9 if [ "$ENABLE_MINBASE" = true ] ; then
10 http_proxy=${APT_PROXY} debootstrap --arch=${RELEASE_ARCH} --variant=minbase --foreign --include=${APT_INCLUDES} ${RELEASE} $R http://${APT_SERVER}/debian
10 http_proxy=${APT_PROXY} debootstrap --arch="${RELEASE_ARCH}" --variant=minbase --foreign --include="${APT_INCLUDES}" "${RELEASE}" "$R" "http://${APT_SERVER}/debian"
11 11 else
12 http_proxy=${APT_PROXY} debootstrap --arch=${RELEASE_ARCH} --foreign --include=${APT_INCLUDES} ${RELEASE} $R http://${APT_SERVER}/debian
12 http_proxy=${APT_PROXY} debootstrap --arch="${RELEASE_ARCH}" --foreign --include="${APT_INCLUDES}" "${RELEASE}" "$R" "http://${APT_SERVER}/debian"
13 13 fi
14 14
15 15 # Copy qemu emulator binary to chroot
16 cp ${QEMU_BINARY} $R/usr/bin
16 cp "${QEMU_BINARY}" "$R/usr/bin"
17 17
18 18 # Copy debian-archive-keyring.pgp
19 mkdir -p $R/usr/share/keyrings
20 cp /usr/share/keyrings/debian-archive-keyring.gpg $R/usr/share/keyrings/debian-archive-keyring.gpg
19 mkdir -p "$R/usr/share/keyrings"
20 cp /usr/share/keyrings/debian-archive-keyring.gpg "$R/usr/share/keyrings/debian-archive-keyring.gpg"
21 21
22 22 # Complete the bootstrapping process
23 23 chroot_exec /debootstrap/debootstrap --second-stage
24 24
25 25 # Mount required filesystems
26 mount -t proc none $R/proc
27 mount -t sysfs none $R/sys
28 mount --bind /dev/pts $R/dev/pts
26 mount -t proc none "$R/proc"
27 mount -t sysfs none "$R/sys"
28 mount --bind /dev/pts "$R/dev/pts"
@@ -7,22 +7,22
7 7
8 8 # Install and setup APT proxy configuration
9 9 if [ -z "$APT_PROXY" ] ; then
10 install_readonly files/apt/10proxy $R/etc/apt/apt.conf.d/10proxy
11 sed -i "s/\"\"/\"${APT_PROXY}\"/" $R/etc/apt/apt.conf.d/10proxy
10 install_readonly files/apt/10proxy "$R/etc/apt/apt.conf.d/10proxy"
11 sed -i "s/\"\"/\"${APT_PROXY}\"/" "$R/etc/apt/apt.conf.d/10proxy"
12 12 fi
13 13
14 14 # Install APT pinning configuration for flash-kernel package
15 install_readonly files/apt/flash-kernel $R/etc/apt/preferences.d/flash-kernel
15 install_readonly files/apt/flash-kernel "$R/etc/apt/preferences.d/flash-kernel"
16 16
17 17 # Upgrade collabora package index and install collabora keyring
18 echo "deb https://repositories.collabora.co.uk/debian ${RELEASE} rpi2" >$R/etc/apt/sources.list
18 echo "deb https://repositories.collabora.co.uk/debian ${RELEASE} rpi2" > "$R/etc/apt/sources.list"
19 19 chroot_exec apt-get -qq -y update
20 20 chroot_exec apt-get -qq -y --force-yes install collabora-obs-archive-keyring
21 21
22 22 # Install APT sources.list
23 install_readonly files/apt/sources.list $R/etc/apt/sources.list
24 sed -i "s/\/ftp.debian.org\//\/${APT_SERVER}\//" $R/etc/apt/sources.list
25 sed -i "s/ jessie/ ${RELEASE}/" $R/etc/apt/sources.list
23 install_readonly files/apt/sources.list "$R/etc/apt/sources.list"
24 sed -i "s/\/ftp.debian.org\//\/${APT_SERVER}\//" "$R/etc/apt/sources.list"
25 sed -i "s/ jessie/ ${RELEASE}/" "$R/etc/apt/sources.list"
26 26
27 27 # Upgrade package index and update all installed packages and changed dependencies
28 28 chroot_exec apt-get -qq -y update
@@ -6,7 +6,7
6 6 . ./functions.sh
7 7
8 8 # Install and setup timezone
9 echo ${TIMEZONE} >$R/etc/timezone
9 echo ${TIMEZONE} > "$R/etc/timezone"
10 10 chroot_exec dpkg-reconfigure -f noninteractive tzdata
11 11
12 12 # Install and setup default locale and keyboard configuration
@@ -19,40 +19,40 if [ "$ENABLE_MINBASE" = false ] ; then
19 19 else
20 20 # en_US.UTF-8 should be available anyway : https://www.debian.org/doc/manuals/debian-reference/ch08.en.html#_the_reconfiguration_of_the_locale
21 21 chroot_exec echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8, ${DEFLOCAL} UTF-8" | debconf-set-selections
22 sed -i "/en_US.UTF-8/s/^#//" $R/etc/locale.gen
22 sed -i "/en_US.UTF-8/s/^#//" "$R/etc/locale.gen"
23 23 fi
24 24
25 sed -i "/${DEFLOCAL}/s/^#//" $R/etc/locale.gen
25 sed -i "/${DEFLOCAL}/s/^#//" "$R/etc/locale.gen"
26 26 chroot_exec echo "locales locales/default_environment_locale select ${DEFLOCAL}" | debconf-set-selections
27 27 chroot_exec locale-gen
28 chroot_exec update-locale LANG=${DEFLOCAL}
28 chroot_exec update-locale LANG="${DEFLOCAL}"
29 29
30 30 # Install and setup default keyboard configuration
31 31 if [ "$XKB_MODEL" != "" ] ; then
32 sed -i "s/^XKBMODEL.*/XKBMODEL=\"${XKB_MODEL}\"/" $R/etc/default/keyboard
32 sed -i "s/^XKBMODEL.*/XKBMODEL=\"${XKB_MODEL}\"/" "$R/etc/default/keyboard"
33 33 fi
34 34 if [ "$XKB_LAYOUT" != "" ] ; then
35 sed -i "s/^XKBLAYOUT.*/XKBLAYOUT=\"${XKB_LAYOUT}\"/" $R/etc/default/keyboard
35 sed -i "s/^XKBLAYOUT.*/XKBLAYOUT=\"${XKB_LAYOUT}\"/" "$R/etc/default/keyboard"
36 36 fi
37 37 if [ "$XKB_VARIANT" != "" ] ; then
38 sed -i "s/^XKBVARIANT.*/XKBVARIANT=\"${XKB_VARIANT}\"/" $R/etc/default/keyboard
38 sed -i "s/^XKBVARIANT.*/XKBVARIANT=\"${XKB_VARIANT}\"/" "$R/etc/default/keyboard"
39 39 fi
40 40 if [ "$XKB_OPTIONS" != "" ] ; then
41 sed -i "s/^XKBOPTIONS.*/XKBOPTIONS=\"${XKB_OPTIONS}\"/" $R/etc/default/keyboard
41 sed -i "s/^XKBOPTIONS.*/XKBOPTIONS=\"${XKB_OPTIONS}\"/" "$R/etc/default/keyboard"
42 42 fi
43 43 chroot_exec dpkg-reconfigure -f noninteractive keyboard-configuration
44 44
45 45 # Install and setup font console
46 46 case "${DEFLOCAL}" in
47 47 *UTF-8)
48 sed -i 's/^CHARMAP.*/CHARMAP="UTF-8"/' $R/etc/default/console-setup
48 sed -i 's/^CHARMAP.*/CHARMAP="UTF-8"/' "$R/etc/default/console-setup"
49 49 ;;
50 50 *)
51 sed -i 's/^CHARMAP.*/CHARMAP="guess"/' $R/etc/default/console-setup
51 sed -i 's/^CHARMAP.*/CHARMAP="guess"/' "$R/etc/default/console-setup"
52 52 ;;
53 53 esac
54 54 chroot_exec dpkg-reconfigure -f noninteractive console-setup
55 55 else # ENABLE_MINBASE=true
56 56 # Install POSIX default locale
57 install_readonly files/locales/locale $R/etc/default/locale
57 install_readonly files/locales/locale "$R/etc/default/locale"
58 58 fi
@@ -8,88 +8,99
8 8 # Fetch and build latest raspberry kernel
9 9 if [ "$BUILD_KERNEL" = true ] ; then
10 10 # Setup source directory
11 mkdir -p $R/usr/src
11 mkdir -p "$R/usr/src"
12 12
13 13 # Copy existing kernel sources into chroot directory
14 if [ -n "$KERNEL_SRCDIR" ] && [ -d "$KERNEL_SRCDIR" ] ; then
14 if [ -n "$KERNELSRC_DIR" ] && [ -d "$KERNELSRC_DIR" ] ; then
15 15 # Copy kernel sources
16 cp -r "${KERNEL_SRCDIR}" "${R}/usr/src"
16 cp -r "${KERNELSRC_DIR}" "${R}/usr/src"
17 17
18 18 # Clean the kernel sources
19 if [ "$KERNEL_CLEANSRC" = true ] ; then
20 make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} mrproper
19 if [ "$KERNELSRC_CLEAN" = true ] && [ "$KERNELSRC_PREBUILT" = false ] ; then
20 make -C "$R/usr/src/linux" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" mrproper
21 21 fi
22 else # KERNEL_SRCDIR=""
22 else # KERNELSRC_DIR=""
23 23 # Fetch current raspberrypi kernel sources
24 git -C $R/usr/src clone --depth=1 https://github.com/raspberrypi/linux
24 git -C "$R/usr/src" clone --depth=1 https://github.com/raspberrypi/linux
25 25 fi
26 26
27 27 # Calculate optimal number of kernel building threads
28 if [ "$KERNEL_THREADS" = "1" ] ; then
29 if [ -r /proc/cpuinfo ] ; then
28 if [ "$KERNEL_THREADS" = "1" ] && [ -r /proc/cpuinfo ] ; then
30 29 KERNEL_THREADS=$(grep -c processor /proc/cpuinfo)
31 30 fi
32 fi
33 31
34 if [ "$KERNEL_CONFIGSRC" = true ] ; then
32 if [ "$KERNELSRC_PREBUILT" = false ] ; then
33 if [ "$KERNELSRC_CONFIG" = true ] ; then
35 34 # Load default raspberry kernel configuration
36 make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} ${KERNEL_DEFCONFIG}
35 make -C "$R/usr/src/linux" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
37 36
38 37 # Start menu-driven kernel configuration (interactive)
39 38 if [ "$KERNEL_MENUCONFIG" = true ] ; then
40 make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} menuconfig
39 make -C "$R/usr/src/linux" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" menuconfig
41 40 fi
42 41 fi
43 42
44 43 # Cross compile kernel and modules
45 make -C $R/usr/src/linux -j${KERNEL_THREADS} ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} zImage modules dtbs
44 make -C "$R/usr/src/linux" -j${KERNEL_THREADS} ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" zImage modules dtbs
45 fi
46 46
47 47 # Check if kernel compilation was successful
48 if [ ! -r $R/usr/src/linux/arch/${KERNEL_ARCH}/boot/zImage ] ; then
49 echo "error: kernel compilation failed!"
48 if [ ! -r "$R/usr/src/linux/arch/${KERNEL_ARCH}/boot/zImage" ] ; then
49 echo "error: kernel compilation failed! (zImage not found)"
50 50 cleanup
51 51 exit 1
52 52 fi
53 53
54 54 # Install kernel modules
55 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
56 make -C "$R/usr/src/linux" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install
57 57 else
58 make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} INSTALL_MOD_PATH=../../.. modules_install
58 make -C "$R/usr/src/linux" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install
59
60 # Install kernel firmware
61 make -C "$R/usr/src/linux" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install
59 62 fi
60 63
61 64 # Install kernel headers
62 65 if [ "$KERNEL_HEADERS" = true ] ; then
63 make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} INSTALL_HDR_PATH=../.. headers_install
66 make -C "$R/usr/src/linux" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_HDR_PATH=../.. headers_install
64 67 fi
65 68
66 # Copy and rename compiled kernel to boot directory
67 mkdir $R/boot/firmware/
68 $R/usr/src/linux/scripts/mkknlimg $R/usr/src/linux/arch/${KERNEL_ARCH}/boot/zImage $R/boot/firmware/kernel7.img
69 # Prepare boot (firmware) directory
70 mkdir "$R/boot/firmware/"
71
72 # Get kernel release version
73 KERNEL_VERSION=`cat "$R/usr/src/linux/include/config/kernel.release"`
74
75 # Copy kernel configuration file to the boot directory
76 cp "$R/usr/src/linux/.config" "$R/boot/config-${KERNEL_VERSION}"
77
78 # Copy dts and dtb device tree sources and binaries
79 mkdir "$R/boot/firmware/overlays/"
80 cp "$R/usr/src/linux/arch/${KERNEL_ARCH}/boot/dts/"*.dtb "$R/boot/firmware/"
81 cp "$R/usr/src/linux/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtb* "$R/boot/firmware/overlays/"
82 cp "$R/usr/src/linux/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "$R/boot/firmware/overlays/"
69 83
70 # Copy dts and dtb device definitions
71 mkdir $R/boot/firmware/overlays/
72 cp $R/usr/src/linux/arch/${KERNEL_ARCH}/boot/dts/*.dtb $R/boot/firmware/
73 cp $R/usr/src/linux/arch/${KERNEL_ARCH}/boot/dts/overlays/*.dtb* $R/boot/firmware/overlays/
74 cp $R/usr/src/linux/arch/${KERNEL_ARCH}/boot/dts/overlays/README $R/boot/firmware/overlays/
84 # Convert kernel zImage and copy it to the boot directory
85 "$R/usr/src/linux/scripts/mkknlimg" "$R/usr/src/linux/arch/${KERNEL_ARCH}/boot/zImage" "$R/boot/firmware/kernel7.img"
75 86
76 87 # Remove kernel sources
77 if [ "$KERNEL_RMSRC" = true ] ; then
78 rm -fr $R/usr/src/linux
88 if [ "$KERNEL_REMOVESRC" = true ] ; then
89 rm -fr "$R/usr/src/linux"
79 90 fi
80 91
81 92 # Install raspberry bootloader and flash-kernel packages
82 93 chroot_exec apt-get -qq -y --no-install-recommends install raspberrypi-bootloader-nokernel
83 94 else # BUILD_KERNEL=false
84 95 # Kernel installation
85 chroot_exec apt-get -qq -y --no-install-recommends install linux-image-${COLLABORA_KERNEL} raspberrypi-bootloader-nokernel
96 chroot_exec apt-get -qq -y --no-install-recommends install linux-image-"${COLLABORA_KERNEL}" raspberrypi-bootloader-nokernel
86 97
87 98 # Install flash-kernel last so it doesn't try (and fail) to detect the platform in the chroot
88 99 chroot_exec apt-get -qq -y install flash-kernel
89 100
90 101 VMLINUZ="$(ls -1 $R/boot/vmlinuz-* | sort | tail -n 1)"
91 102 [ -z "$VMLINUZ" ] && exit 1
92 cp $VMLINUZ $R/boot/firmware/kernel7.img
103 cp "$VMLINUZ" "$R/boot/firmware/kernel7.img"
93 104 fi
94 105
95 106 # Setup firmware boot cmdline
@@ -110,43 +121,43 if [ "$ENABLE_IPV6" = false ] ; then
110 121 fi
111 122
112 123 # Install firmware boot cmdline
113 echo "${CMDLINE}" >$R/boot/firmware/cmdline.txt
124 echo "${CMDLINE}" > "$R/boot/firmware/cmdline.txt"
114 125
115 126 # Install firmware config
116 install_readonly files/boot/config.txt $R/boot/firmware/config.txt
127 install_readonly files/boot/config.txt "$R/boot/firmware/config.txt"
117 128
118 129 # Setup minimal GPU memory allocation size: 16MB (no X)
119 130 if [ "$ENABLE_MINGPU" = true ] ; then
120 echo "gpu_mem=16" >>$R/boot/firmware/config.txt
131 echo "gpu_mem=16" >> "$R/boot/firmware/config.txt"
121 132 fi
122 133
123 134 # Create firmware configuration and cmdline symlinks
124 ln -sf firmware/config.txt $R/boot/config.txt
125 ln -sf firmware/cmdline.txt $R/boot/cmdline.txt
135 ln -sf firmware/config.txt "$R/boot/config.txt"
136 ln -sf firmware/cmdline.txt "$R/boot/cmdline.txt"
126 137
127 138 # Install and setup kernel modules to load at boot
128 mkdir -p $R/lib/modules-load.d/
129 install_readonly files/modules/rpi2.conf $R/lib/modules-load.d/rpi2.conf
139 mkdir -p "$R/lib/modules-load.d/"
140 install_readonly files/modules/rpi2.conf "$R/lib/modules-load.d/rpi2.conf"
130 141
131 142 # Load hardware random module at boot
132 143 if [ "$ENABLE_HWRANDOM" = true ] ; then
133 sed -i "s/^# bcm2708_rng/bcm2708_rng/" $R/lib/modules-load.d/rpi2.conf
144 sed -i "s/^# bcm2708_rng/bcm2708_rng/" "$R/lib/modules-load.d/rpi2.conf"
134 145 fi
135 146
136 147 # Load sound module at boot
137 148 if [ "$ENABLE_SOUND" = true ] ; then
138 sed -i "s/^# snd_bcm2835/snd_bcm2835/" $R/lib/modules-load.d/rpi2.conf
149 sed -i "s/^# snd_bcm2835/snd_bcm2835/" "$R/lib/modules-load.d/rpi2.conf"
139 150 fi
140 151
141 152 # Install kernel modules blacklist
142 mkdir -p $R/etc/modprobe.d/
143 install_readonly files/modules/raspi-blacklist.conf $R/etc/modprobe.d/raspi-blacklist.conf
153 mkdir -p "$R/etc/modprobe.d/"
154 install_readonly files/modules/raspi-blacklist.conf "$R/etc/modprobe.d/raspi-blacklist.conf"
144 155
145 156 # Install and setup fstab
146 install_readonly files/mount/fstab $R/etc/fstab
157 install_readonly files/mount/fstab "$R/etc/fstab"
147 158 if [ "$ENABLE_SPLITFS" = true ] ; then
148 sed -i 's/mmcblk0p2/sda1/' $R/etc/fstab
159 sed -i 's/mmcblk0p2/sda1/' "$R/etc/fstab"
149 160 fi
150 161
151 162 # Install sysctl.d configuration files
152 install_readonly files/sysctl.d/81-rpi-vm.conf $R/etc/sysctl.d/81-rpi-vm.conf
163 install_readonly files/sysctl.d/81-rpi-vm.conf "$R/etc/sysctl.d/81-rpi-vm.conf"
@@ -6,37 +6,37
6 6 . ./functions.sh
7 7
8 8 # Install and setup hostname
9 install_readonly files/network/hostname $R/etc/hostname
10 sed -i "s/^rpi2-jessie/${HOSTNAME}/" $R/etc/hostname
9 install_readonly files/network/hostname "$R/etc/hostname"
10 sed -i "s/^rpi2-jessie/${HOSTNAME}/" "$R/etc/hostname"
11 11
12 12 # Install and setup hosts
13 install_readonly files/network/hosts $R/etc/hosts
14 sed -i "s/rpi2-jessie/${HOSTNAME}/" $R/etc/hosts
13 install_readonly files/network/hosts "$R/etc/hosts"
14 sed -i "s/rpi2-jessie/${HOSTNAME}/" "$R/etc/hosts"
15 15
16 16 # Setup hostname entry with static IP
17 17 if [ "$NET_ADDRESS" != "" ] ; then
18 NET_IP=$(echo ${NET_ADDRESS} | cut -f 1 -d'/')
19 sed -i "s/^127.0.1.1/${NET_IP}/" $R/etc/hosts
18 NET_IP=$(echo "${NET_ADDRESS}" | cut -f 1 -d'/')
19 sed -i "s/^127.0.1.1/${NET_IP}/" "$R/etc/hosts"
20 20 fi
21 21
22 22 # Remove IPv6 hosts
23 23 if [ "$ENABLE_IPV6" = false ] ; then
24 sed -i -e "/::[1-9]/d" -e "/^$/d" $R/etc/hosts
24 sed -i -e "/::[1-9]/d" -e "/^$/d" "$R/etc/hosts"
25 25 fi
26 26
27 27 # Install hint about network configuration
28 install_readonly files/network/interfaces $R/etc/network/interfaces
28 install_readonly files/network/interfaces "$R/etc/network/interfaces"
29 29
30 30 # Install configuration for interface eth0
31 install_readonly files/network/eth.network $R/etc/systemd/network/eth.network
31 install_readonly files/network/eth.network "$R/etc/systemd/network/eth.network"
32 32
33 33 if [ "$ENABLE_DHCP" = true ] ; then
34 34 # Enable DHCP configuration for interface eth0
35 sed -i -e "s/DHCP=.*/DHCP=yes/" -e "/DHCP/q" $R/etc/systemd/network/eth.network
35 sed -i -e "s/DHCP=.*/DHCP=yes/" -e "/DHCP/q" "$R/etc/systemd/network/eth.network"
36 36
37 37 # Set DHCP configuration to IPv4 only
38 38 if [ "$ENABLE_IPV6" = false ] ; then
39 sed -i "s/DHCP=.*/DHCP=v4/" $R/etc/systemd/network/eth.network
39 sed -i "s/DHCP=.*/DHCP=v4/" "$R/etc/systemd/network/eth.network"
40 40 fi
41 41
42 42 else # ENABLE_DHCP=false
@@ -50,23 +50,23 else # ENABLE_DHCP=false
50 50 -e "s|Domains=\$|Domains=${NET_DNS_DOMAINS}|"\
51 51 -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_1}|"\
52 52 -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_2}|"\
53 $R/etc/systemd/network/eth.network
53 "$R/etc/systemd/network/eth.network"
54 54 fi
55 55
56 56 # Remove empty settings from network configuration
57 sed -i "/.*=\$/d" $R/etc/systemd/network/eth.network
57 sed -i "/.*=\$/d" "$R/etc/systemd/network/eth.network"
58 58
59 59 # Enable systemd-networkd service
60 60 chroot_exec systemctl enable systemd-networkd
61 61
62 62 # Install host.conf resolver configuration
63 install_readonly files/network/host.conf $R/etc/host.conf
63 install_readonly files/network/host.conf "$R/etc/host.conf"
64 64
65 65 # Enable network stack hardening
66 66 if [ "$ENABLE_HARDNET" = true ] ; then
67 67 # Install sysctl.d configuration files
68 install_readonly files/sysctl.d/82-rpi-net-hardening.conf $R/etc/sysctl.d/82-rpi-net-hardening.conf
68 install_readonly files/sysctl.d/82-rpi-net-hardening.conf "$R/etc/sysctl.d/82-rpi-net-hardening.conf"
69 69
70 70 # Setup resolver warnings about spoofed addresses
71 sed -i "s/^# spoof warn/spoof warn/" $R/etc/host.conf
71 sed -i "s/^# spoof warn/spoof warn/" "$R/etc/host.conf"
72 72 fi
@@ -10,13 +10,13 if [ "$ENABLE_IPTABLES" = true ] ; then
10 10 mkdir -p "$R/etc/iptables"
11 11
12 12 # Install iptables systemd service
13 install_readonly files/iptables/iptables.service $R/etc/systemd/system/iptables.service
13 install_readonly files/iptables/iptables.service "$R/etc/systemd/system/iptables.service"
14 14
15 15 # Install flush-table script called by iptables service
16 install_exec files/iptables/flush-iptables.sh $R/etc/iptables/flush-iptables.sh
16 install_exec files/iptables/flush-iptables.sh "$R/etc/iptables/flush-iptables.sh"
17 17
18 18 # Install iptables rule file
19 install_readonly files/iptables/iptables.rules $R/etc/iptables/iptables.rules
19 install_readonly files/iptables/iptables.rules "$R/etc/iptables/iptables.rules"
20 20
21 21 # Reload systemd configuration and enable iptables service
22 22 chroot_exec systemctl daemon-reload
@@ -24,12 +24,12 if [ "$ENABLE_IPTABLES" = true ] ; then
24 24
25 25 if [ "$ENABLE_IPV6" = true ] ; then
26 26 # Install ip6tables systemd service
27 install_readonly files/iptables/ip6tables.service $R/etc/systemd/system/ip6tables.service
27 install_readonly files/iptables/ip6tables.service "$R/etc/systemd/system/ip6tables.service"
28 28
29 29 # Install ip6tables file
30 install_exec files/iptables/flush-ip6tables.sh $R/etc/iptables/flush-ip6tables.sh
30 install_exec files/iptables/flush-ip6tables.sh "$R/etc/iptables/flush-ip6tables.sh"
31 31
32 install_readonly files/iptables/ip6tables.rules $R/etc/iptables/ip6tables.rules
32 install_readonly files/iptables/ip6tables.rules "$R/etc/iptables/ip6tables.rules"
33 33
34 34 # Reload systemd configuration and enable iptables service
35 35 chroot_exec systemctl daemon-reload
@@ -39,6 +39,6 fi
39 39
40 40 if [ "$ENABLE_SSHD" = false ] ; then
41 41 # Remove SSHD related iptables rules
42 sed -i "/^#/! {/SSH/ s/^/# /}" $R/etc/iptables/iptables.rules 2> /dev/null
43 sed -i "/^#/! {/SSH/ s/^/# /}" $R/etc/iptables/ip6tables.rules 2> /dev/null
42 sed -i "/^#/! {/SSH/ s/^/# /}" "$R/etc/iptables/iptables.rules" 2> /dev/null
43 sed -i "/^#/! {/SSH/ s/^/# /}" "$R/etc/iptables/ip6tables.rules" 2> /dev/null
44 44 fi
@@ -6,7 +6,7
6 6 . ./functions.sh
7 7
8 8 # Generate crypt(3) password string
9 ENCRYPTED_PASSWORD=`mkpasswd -m sha-512 ${PASSWORD}`
9 ENCRYPTED_PASSWORD=`mkpasswd -m sha-512 "${PASSWORD}"`
10 10
11 11 # Setup default user
12 12 if [ "$ENABLE_USER" = true ] ; then
@@ -19,7 +19,7 if [ "$ENABLE_ROOT" = true ] ; then
19 19 chroot_exec usermod -p "${ENCRYPTED_PASSWORD}" root
20 20
21 21 if [ "$ENABLE_ROOT_SSH" = true ] ; then
22 sed -i "s|[#]*PermitRootLogin.*|PermitRootLogin yes|g" $R/etc/ssh/sshd_config
22 sed -i "s|[#]*PermitRootLogin.*|PermitRootLogin yes|g" "$R/etc/ssh/sshd_config"
23 23 fi
24 24 else
25 25 # Set no root password to disable root login
@@ -7,7 +7,7
7 7
8 8 # Disable rsyslog
9 9 if [ "$ENABLE_RSYSLOG" = false ] ; then
10 sed -i "s|[#]*ForwardToSyslog=yes|ForwardToSyslog=no|g" $R/etc/systemd/journald.conf
10 sed -i "s|[#]*ForwardToSyslog=yes|ForwardToSyslog=no|g" "$R/etc/systemd/journald.conf"
11 11 chroot_exec systemctl disable rsyslog
12 12 chroot_exec apt-get -qq -y --force-yes purge rsyslog
13 13 fi
@@ -13,19 +13,19 fi
13 13 # Fetch and build U-Boot bootloader
14 14 if [ "$ENABLE_UBOOT" = true ] ; then
15 15 # Fetch U-Boot bootloader sources
16 git -C $R/tmp clone git://git.denx.de/u-boot.git
16 git -C "$R/tmp" clone git://git.denx.de/u-boot.git
17 17
18 18 # Build and install U-Boot inside chroot
19 19 chroot_exec make -C /tmp/u-boot/ rpi_2_defconfig all
20 20
21 21 # Copy compiled bootloader binary and set config.txt to load it
22 cp $R/tmp/u-boot/u-boot.bin $R/boot/firmware/
23 printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> $R/boot/firmware/config.txt
22 cp "$R/tmp/u-boot/u-boot.bin" "$R/boot/firmware/"
23 printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> "$R/boot/firmware/config.txt"
24 24
25 25 # Install and setup U-Boot command file
26 install_readonly files/boot/uboot.mkimage $R/boot/firmware/uboot.mkimage
27 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat $R/boot/firmware/uboot.mkimage)" > $R/boot/firmware/uboot.mkimage
26 install_readonly files/boot/uboot.mkimage "$R/boot/firmware/uboot.mkimage"
27 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat $R/boot/firmware/uboot.mkimage)" > "$R/boot/firmware/uboot.mkimage"
28 28
29 29 # Generate U-Boot bootloader image
30 chroot_exec /tmp/u-boot/tools/mkimage -A ${KERNEL_ARCH} -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n RPi2 -d /boot/firmware/uboot.mkimage /boot/firmware/boot.scr
30 chroot_exec /tmp/u-boot/tools/mkimage -A "${KERNEL_ARCH}" -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n RPi2 -d /boot/firmware/uboot.mkimage /boot/firmware/boot.scr
31 31 fi
@@ -7,7 +7,7
7 7
8 8 if [ "$ENABLE_FBTURBO" = true ] ; then
9 9 # Fetch fbturbo driver sources
10 git -C $R/tmp clone https://github.com/ssvb/xf86-video-fbturbo.git
10 git -C "$R/tmp" clone https://github.com/ssvb/xf86-video-fbturbo.git
11 11
12 12 # Install Xorg build dependencies
13 13 chroot_exec apt-get -q -y --no-install-recommends install xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev
@@ -22,7 +22,7 make install
22 22 EOF
23 23
24 24 # Install fbturbo driver Xorg configuration
25 install_readonly files/xorg/99-fbturbo.conf $R/usr/share/X11/xorg.conf.d/99-fbturbo.conf
25 install_readonly files/xorg/99-fbturbo.conf "$R/usr/share/X11/xorg.conf.d/99-fbturbo.conf"
26 26
27 27 # Remove Xorg build dependencies
28 28 chroot_exec apt-get -qq -y --auto-remove purge xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev
@@ -6,30 +6,30
6 6 . ./functions.sh
7 7
8 8 # Prepare rc.firstboot script
9 cat files/firstboot/10-begin.sh > $R/etc/rc.firstboot
9 cat files/firstboot/10-begin.sh > "$R/etc/rc.firstboot"
10 10
11 11 # Ensure openssh server host keys are regenerated on first boot
12 12 if [ "$ENABLE_SSHD" = true ] ; then
13 cat files/firstboot/21-generate-ssh-keys.sh >> $R/etc/rc.firstboot
14 rm -f $R/etc/ssh/ssh_host_*
13 cat files/firstboot/21-generate-ssh-keys.sh >> "$R/etc/rc.firstboot"
14 rm -f "$R/etc/ssh/ssh_host_*"
15 15 fi
16 16
17 17 # Prepare filesystem auto expand
18 18 if [ "$EXPANDROOT" = true ] ; then
19 cat files/firstboot/22-expandroot.sh >> $R/etc/rc.firstboot
19 cat files/firstboot/22-expandroot.sh >> "$R/etc/rc.firstboot"
20 20 fi
21 21
22 22 # Ensure that dbus machine-id exists
23 cat files/firstboot/23-generate-machineid.sh >> $R/etc/rc.firstboot
23 cat files/firstboot/23-generate-machineid.sh >> "$R/etc/rc.firstboot"
24 24
25 25 # Create /etc/resolv.conf symlink
26 cat files/firstboot/24-create-resolv-symlink.sh >> $R/etc/rc.firstboot
26 cat files/firstboot/24-create-resolv-symlink.sh >> "$R/etc/rc.firstboot"
27 27
28 28 # Finalize rc.firstboot script
29 cat files/firstboot/99-finish.sh >> $R/etc/rc.firstboot
30 chmod +x $R/etc/rc.firstboot
29 cat files/firstboot/99-finish.sh >> "$R/etc/rc.firstboot"
30 chmod +x "$R/etc/rc.firstboot"
31 31
32 32 # Add rc.firstboot script to rc.local
33 sed -i '/exit 0/d' $R/etc/rc.local
34 echo /etc/rc.firstboot >> $R/etc/rc.local
35 echo exit 0 >> $R/etc/rc.local
33 sed -i '/exit 0/d' "$R/etc/rc.local"
34 echo /etc/rc.firstboot >> "$R/etc/rc.local"
35 echo exit 0 >> "$R/etc/rc.local"
@@ -98,13 +98,16 ENABLE_SPLITFS=${ENABLE_SPLITFS:=false}
98 98
99 99 # Kernel compilation settings
100 100 BUILD_KERNEL=${BUILD_KERNEL:=false}
101 KERNEL_SRCDIR=${KERNEL_SRCDIR:=""}
102 101 KERNEL_THREADS=${KERNEL_THREADS:=1}
103 102 KERNEL_HEADERS=${KERNEL_HEADERS:=true}
104 103 KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false}
105 KERNEL_CLEANSRC=${KERNEL_CLEANSRC:=false}
106 KERNEL_CONFIGSRC=${KERNEL_CONFIGSRC:=true}
107 KERNEL_RMSRC=${KERNEL_RMSRC:=true}
104 KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true}
105
106 # Kernel compilation from source directory settings
107 KERNELSRC_DIR=${KERNELSRC_DIR:=""}
108 KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false}
109 KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true}
110 KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false}
108 111
109 112 # Image chroot path
110 113 R=${BUILDDIR}/chroot
@@ -140,9 +143,9 if [ ! -d "./files/" ] ; then
140 143 exit 1
141 144 fi
142 145
143 # Check if specified KERNEL_SRCDIR directory exists
144 if [ -n "$KERNEL_SRCDIR" ] && [ ! -d "$KERNEL_SRCDIR" ] ; then
145 echo "error: ${KERNEL_SRCDIR} (KERNEL_SRCDIR) specified directory not found!"
146 # Check if specified KERNELSRC_DIR directory exists
147 if [ -n "$KERNELSRC_DIR" ] && [ ! -d "$KERNELSRC_DIR" ] ; then
148 echo "error: ${KERNELSRC_DIR} (KERNELSRC_DIR) specified directory not found!"
146 149 exit 1
147 150 fi
148 151
@@ -155,6 +158,7 fi
155 158 # Add packages required for kernel cross compilation
156 159 if [ "$BUILD_KERNEL" = true ] ; then
157 160 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
161
158 162 if [ "$KERNEL_MENUCONFIG" = true ] ; then
159 163 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} ncurses-dev"
160 164 fi
@@ -163,7 +167,7 fi
163 167 # Check if all required packages are installed
164 168 for package in $REQUIRED_PACKAGES ; do
165 169 if [ "`dpkg-query -W -f='${Status}' $package`" != "install ok installed" ] ; then
166 MISSING_PACKAGES="$MISSING_PACKAGES $package"
170 MISSING_PACKAGES="${MISSING_PACKAGES} $package"
167 171 fi
168 172 done
169 173
@@ -188,6 +192,9 if [ -e "$BUILDDIR" ] ; then
188 192 exit 1
189 193 fi
190 194
195 # Setup chroot directory
196 mkdir -p "$R"
197
191 198 # Check if build directory has enough of free disk space >512MB
192 199 if [ "$(df --output=avail ${BUILDDIR} | sed "1d")" -le "524288" ] ; then
193 200 echo "error: ${BUILDDIR} not enough space left on this partition to generate the output image!"
@@ -204,9 +211,6 set -x
204 211 # Call "cleanup" function on various signals and errors
205 212 trap cleanup 0 1 2 3 6
206 213
207 # Setup chroot directory
208 mkdir -p $R
209
210 214 # Add required packages for the minbase installation
211 215 if [ "$ENABLE_MINBASE" = true ] ; then
212 216 APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools"
@@ -263,23 +267,23 if [ "$ENABLE_XORG" = true ] ; then
263 267 APT_INCLUDES="${APT_INCLUDES},xorg"
264 268 fi
265 269
266 # Set KERNEL_CONFIGSRC=true
267 if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNEL_SRCDIR" ] ; then
268 KERNEL_CONFIGSRC=true
270 # Set KERNELSRC_CONFIG=true
271 if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNELSRC_DIR" ] ; then
272 KERNELSRC_CONFIG=true
269 273 fi
270 274
271 275 ## MAIN bootstrap
272 276 for SCRIPT in bootstrap.d/*.sh; do
273 277 # Execute bootstrap scripts (lexicographical order)
274 head -n 3 $SCRIPT
275 . $SCRIPT
278 head -n 3 "$SCRIPT"
279 . "$SCRIPT"
276 280 done
277 281
278 282 ## Custom bootstrap scripts
279 283 if [ -d "custom.d" ] ; then
280 284 # Execute custom bootstrap scripts (lexicographical order)
281 285 for SCRIPT in custom.d/*.sh; do
282 . $SCRIPT
286 . "$SCRIPT"
283 287 done
284 288 fi
285 289
@@ -294,7 +298,7 for SCRIPT in /chroot_scripts/* ; do
294 298 fi
295 299 done
296 300 EOF
297 rm -rf "${R}/chroot_scripts"
301 rm -rf "$R/chroot_scripts"
298 302 fi
299 303
300 304 # Remove apt-utils
@@ -303,34 +307,35 chroot_exec apt-get purge -qq -y --force-yes apt-utils
303 307 # Reduce the image size by removing and compressing
304 308 if [ "$ENABLE_REDUCE" = true ] ; then
305 309 # Install dpkg configuration fragment file
306 install_readonly files/dpkg/01nodoc $R/etc/dpkg/dpkg.cfg.d/01nodoc
310 install_readonly files/dpkg/01nodoc "$R/etc/dpkg/dpkg.cfg.d/01nodoc"
307 311
308 312 # 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
313 install_readonly files/apt/02nocache "$R/etc/apt/apt.conf.d/02nocache"
314 install_readonly files/apt/03compress "$R/etc/apt/apt.conf.d/03compress"
315 install_readonly files/apt/04norecommends "$R/etc/apt/apt.conf.d/04norecommends"
312 316
313 317 # Remove APT cache files
314 rm -fr $R/var/cache/apt/pkgcache.bin
315 rm -fr $R/var/cache/apt/srcpkgcache.bin
318 rm -fr "$R/var/cache/apt/pkgcache.bin"
319 rm -fr "$R/var/cache/apt/srcpkgcache.bin"
316 320
317 321 # 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
322 find "$R/usr/share/doc" -depth -type f ! -name copyright | xargs rm || true
323 find "$R/usr/share/doc" -empty | xargs rmdir || true
324 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 325
322 326 # Remove all translation files
323 find $R/usr/share/locale -mindepth 1 -maxdepth 1 ! -name 'en' | xargs rm -r
327 find "$R/usr/share/locale" -mindepth 1 -maxdepth 1 ! -name 'en' | xargs rm -r
324 328
325 329 # Clean APT list of repositories
326 rm -fr $R/var/lib/apt/lists/*
330 rm -fr "$R/var/lib/apt/lists/*"
327 331 chroot_exec apt-get -qq -y update
328 332
333 # Remove GPU kernels
329 334 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
335 rm -f "$R/boot/firmware/start.elf"
336 rm -f "$R/boot/firmware/fixup.dat"
337 rm -f "$R/boot/firmware/start_x.elf"
338 rm -f "$R/boot/firmware/fixup_x.dat"
334 339 fi
335 340 fi
336 341
@@ -340,27 +345,27 chroot_exec apt-get -y autoclean
340 345 chroot_exec apt-get -y autoremove
341 346
342 347 # Unmount mounted filesystems
343 umount -l $R/proc
344 umount -l $R/sys
348 umount -l "$R/proc"
349 umount -l "$R/sys"
345 350
346 351 # Clean up directories
347 rm -rf $R/run
348 rm -rf $R/tmp/*
352 rm -rf "$R/run"
353 rm -rf "$R/tmp/*"
349 354
350 355 # Clean up files
351 rm -f $R/etc/apt/sources.list.save
352 rm -f $R/etc/resolvconf/resolv.conf.d/original
353 rm -f $R/etc/*-
354 rm -f $R/root/.bash_history
355 rm -f $R/var/lib/urandom/random-seed
356 rm -f $R/var/lib/dbus/machine-id
357 rm -f $R/etc/machine-id
358 rm -f $R/etc/apt/apt.conf.d/10proxy
359 rm -f $R/etc/resolv.conf
356 rm -f "$R/etc/apt/sources.list.save"
357 rm -f "$R/etc/resolvconf/resolv.conf.d/original"
358 rm -f "$R/etc/*-"
359 rm -f "$R/root/.bash_history"
360 rm -f "$R/var/lib/urandom/random-seed"
361 rm -f "$R/var/lib/dbus/machine-id"
362 rm -f "$R/etc/machine-id"
363 rm -f "$R/etc/apt/apt.conf.d/10proxy"
364 rm -f "$R/etc/resolv.conf"
360 365 rm -f "${R}${QEMU_BINARY}"
361 366
362 367 # Calculate size of the chroot directory in KB
363 CHROOT_SIZE=$(expr `du -s $R | awk '{ print $1 }'`)
368 CHROOT_SIZE=$(expr `du -s "$R" | awk '{ print $1 }'`)
364 369
365 370 # Calculate the amount of needed 512 Byte sectors
366 371 TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512)
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant