##// END OF EJS Templates
add fixes pulled to dirty-master...
Unknown -
r341:c71b9798972e
parent child
Show More
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # Debootstrap basic system
2 # Debootstrap basic system
4 #
3 #
@@ -8,7 +7,6
8
7
9 VARIANT=""
8 VARIANT=""
10 COMPONENTS="main"
9 COMPONENTS="main"
11 EXCLUDES=""
12
10
13 # Use non-free Debian packages if needed
11 # Use non-free Debian packages if needed
14 if [ "$ENABLE_NONFREE" = true ] ; then
12 if [ "$ENABLE_NONFREE" = true ] ; then
@@ -20,13 +18,8 if [ "$ENABLE_MINBASE" = true ] ; then
20 VARIANT="--variant=minbase"
18 VARIANT="--variant=minbase"
21 fi
19 fi
22
20
23 # Exclude packages if required by Debian release
24 if [ "$RELEASE" = "stretch" ] || [ "$RELEASE" = "buster" ] ; then
25 EXCLUDES="--exclude=init,systemd-sysv"
26 fi
27
28 # Base debootstrap (unpack only)
21 # Base debootstrap (unpack only)
29 http_proxy=${APT_PROXY} debootstrap ${EXCLUDES} --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}"
22 http_proxy=${APT_PROXY} debootstrap "${APT_EXCLUDES}" --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}"
30
23
31 # Copy qemu emulator binary to chroot
24 # Copy qemu emulator binary to chroot
32 install -m 755 -o root -g root "${QEMU_BINARY}" "${R}${QEMU_BINARY}"
25 install -m 755 -o root -g root "${QEMU_BINARY}" "${R}${QEMU_BINARY}"
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # Setup APT repositories
2 # Setup APT repositories
4 #
3 #
@@ -21,11 +20,6 else
21 echo "No precompiled kernel repositories were added"
20 echo "No precompiled kernel repositories were added"
22 fi
21 fi
23
22
24 #ipinfo=$(curl ipinfo.io | grep country )
25 #grep -o '\"[^"]*\"' $ipinfo | tr -d '"'
26 #grep -Po '"country":.*?[^\\]",' $(curl ipinfo.io | grep country )
27 #sed -i "s,http:,https:,g" "${ETC_DIR}/apt/sources.list"
28
29 # Upgrade package index and update all installed packages and changed dependencies
23 # Upgrade package index and update all installed packages and changed dependencies
30 chroot_exec apt-get -qq -y update
24 chroot_exec apt-get -qq -y update
31 chroot_exec apt-get -qq -y -u dist-upgrade
25 chroot_exec apt-get -qq -y -u dist-upgrade
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # Setup Locales and keyboard settings
2 # Setup Locales and keyboard settings
4 #
3 #
@@ -11,7 +10,6 echo "${TIMEZONE}" > "${ETC_DIR}/timezone"
11 chroot_exec dpkg-reconfigure -f noninteractive tzdata
10 chroot_exec dpkg-reconfigure -f noninteractive tzdata
12
11
13 # Install and setup default locale and keyboard configuration
12 # Install and setup default locale and keyboard configuration
14
15 if [ "$(echo "$APT_INCLUDES" | grep ",locales")" ] ; then
13 if [ "$(echo "$APT_INCLUDES" | grep ",locales")" ] ; then
16 # Set locale choice in debconf db, even though dpkg-reconfigure ignores and overwrites them due to some bug
14 # Set locale choice in debconf db, even though dpkg-reconfigure ignores and overwrites them due to some bug
17 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684134 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=685957
15 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684134 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=685957
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # Build and Setup RPi2/3 Kernel
2 # Build and Setup RPi2/3 Kernel
4 #
3 #
@@ -109,7 +108,7 if [ "$BUILD_KERNEL" = true ] ; then
109 echo "CONFIG_CRYPTO_XTS=y"
108 echo "CONFIG_CRYPTO_XTS=y"
110 echo "CONFIG_CRYPTO_SHA512=y"
109 echo "CONFIG_CRYPTO_SHA512=y"
111 echo "CONFIG_CRYPTO_MANAGER=y"
110 echo "CONFIG_CRYPTO_MANAGER=y"
112 } >> "${KERNEL_DIR}"/.config
111 } >> ${KERNEL_DIR}/.config
113 fi
112 fi
114 fi
113 fi
115
114
@@ -241,7 +240,8 if [ "$BUILD_KERNEL" = true ] ; then
241 chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/source"
240 chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/source"
242 fi
241 fi
243 fi
242 fi
244 elif [ "$BUILD_KERNEL" = false ] ; then
243
244 else # BUILD_KERNEL=false
245 echo " Install precompiled kernel..."
245 echo " Install precompiled kernel..."
246 echo "error: not implemented"
246 echo "error: not implemented"
247 # Check if kernel installation was successful
247 # Check if kernel installation was successful
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # Setup fstab and initramfs
2 # Setup fstab and initramfs
4 #
3 #
@@ -63,4 +62,3 if [ "$BUILD_KERNEL" = true ] && [ "$ENABLE_INITRAMFS" = true ] ; then
63 chroot_exec mkinitramfs -o "/boot/firmware/initramfs-${KERNEL_VERSION}" "${KERNEL_VERSION}"
62 chroot_exec mkinitramfs -o "/boot/firmware/initramfs-${KERNEL_VERSION}" "${KERNEL_VERSION}"
64 fi
63 fi
65 fi
64 fi
66
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # Setup RPi2/3 config and cmdline
2 # Setup RPi2/3 config and cmdline
4 #
3 #
@@ -159,4 +158,3 install_readonly files/modules/raspi-blacklist.conf "${ETC_DIR}/modprobe.d/raspi
159
158
160 # Install sysctl.d configuration files
159 # Install sysctl.d configuration files
161 install_readonly files/sysctl.d/81-rpi-vm.conf "${ETC_DIR}/sysctl.d/81-rpi-vm.conf"
160 install_readonly files/sysctl.d/81-rpi-vm.conf "${ETC_DIR}/sysctl.d/81-rpi-vm.conf"
162
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # Setup Networking
2 # Setup Networking
4 #
3 #
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # Setup Firewall
2 # Setup Firewall
4 #
3 #
@@ -10,6 +9,8 if [ "$ENABLE_IPTABLES" = true ] ; then
10 # Create iptables configuration directory
9 # Create iptables configuration directory
11 mkdir -p "${ETC_DIR}/iptables"
10 mkdir -p "${ETC_DIR}/iptables"
12
11
12 # make sure iptables-legacy is the used alternatives
13 #iptables-save and -restore are slaves of iptables and thus are set accordingly
13 if ! [ "$RELEASE" = jessie ] ; then
14 if ! [ "$RELEASE" = jessie ] ; then
14 chroot_exec update-alternatives --verbose --set iptables /usr/sbin/iptables-legacy
15 chroot_exec update-alternatives --verbose --set iptables /usr/sbin/iptables-legacy
15 fi
16 fi
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # Setup users and security settings
2 # Setup users and security settings
4 #
3 #
@@ -12,8 +11,8 ENCRYPTED_USER_PASSWORD=$(mkpasswd -m sha-512 "${USER_PASSWORD}")
12
11
13 # Setup default user
12 # Setup default user
14 if [ "$ENABLE_USER" = true ] ; then
13 if [ "$ENABLE_USER" = true ] ; then
15 chroot_exec adduser --gecos "$USER_NAME" --add_extra_groups --disabled-password "$USER_NAME"
14 chroot_exec adduser --gecos $USER_NAME --add_extra_groups --disabled-password $USER_NAME
16 chroot_exec usermod -a -G sudo -p "${ENCRYPTED_USER_PASSWORD}" "$USER_NAME"
15 chroot_exec usermod -a -G sudo -p "${ENCRYPTED_USER_PASSWORD}" $USER_NAME
17 fi
16 fi
18
17
19 # Setup root password or not
18 # Setup root password or not
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # Setup Logging
2 # Setup Logging
4 #
3 #
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # Setup SSH settings and public keys
2 # Setup SSH settings and public keys
4 #
3 #
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # Build and Setup U-Boot
2 # Build and Setup U-Boot
4 #
3 #
@@ -40,6 +39,7 if [ "$ENABLE_UBOOT" = true ] ; then
40 install_readonly "${R}/tmp/u-boot/u-boot.bin" "${BOOT_DIR}/u-boot.bin"
39 install_readonly "${R}/tmp/u-boot/u-boot.bin" "${BOOT_DIR}/u-boot.bin"
41 printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> "${BOOT_DIR}/config.txt"
40 printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> "${BOOT_DIR}/config.txt"
42
41
42 # Install and setup U-Boot command file
43 install_readonly files/boot/uboot.mkimage "${BOOT_DIR}/uboot.mkimage"
43 install_readonly files/boot/uboot.mkimage "${BOOT_DIR}/uboot.mkimage"
44 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
44 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
45
45
@@ -80,14 +80,14 if [ "$ENABLE_UBOOT" = true ] ; then
80 sed -i "s|mmc|usb|g" "${BOOT_DIR}/uboot.mkimage"
80 sed -i "s|mmc|usb|g" "${BOOT_DIR}/uboot.mkimage"
81 fi
81 fi
82
82
83 # Set mkfile to use the correct dtb file
84 sed -i "s/^\(setenv dtbfile \).*/\1${DTB_FILE}/" "${BOOT_DIR}/uboot.mkimage"
85
83 # Set mkfile to use the correct mach id
86 # Set mkfile to use the correct mach id
84 if [ "$ENABLE_QEMU" = true ] ; then
87 if [ "$ENABLE_QEMU" = true ] ; then
85 sed -i "s/^\(setenv machid \).*/\10x000008e0/" "${BOOT_DIR}/uboot.mkimage"
88 sed -i "s/^\(setenv machid \).*/\10x000008e0/" "${BOOT_DIR}/uboot.mkimage"
86 fi
89 fi
87
90
88 # Set mkfile to use the correct dtb file
89 sed -i "s/^\(setenv dtbfile \).*/\1${DTB_FILE}/" "${BOOT_DIR}/uboot.mkimage"
90
91 # Set mkfile to use kernel image
91 # Set mkfile to use kernel image
92 sed -i "s/^\(fatload mmc 0:1 \${kernel_addr_r} \).*/\1${KERNEL_IMAGE}/" "${BOOT_DIR}/uboot.mkimage"
92 sed -i "s/^\(fatload mmc 0:1 \${kernel_addr_r} \).*/\1${KERNEL_IMAGE}/" "${BOOT_DIR}/uboot.mkimage"
93
93
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # Build and Setup fbturbo Xorg driver
2 # Build and Setup fbturbo Xorg driver
4 #
3 #
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # First boot actions
2 # First boot actions
4 #
3 #
@@ -1,4 +1,3
1 #!/bin/bash
2 #
1 #
3 # Reduce system disk usage
2 # Reduce system disk usage
4 #
3 #
@@ -49,136 +49,137 export RELEASE=${RELEASE:=buster}
49 export KERNEL_BRANCH=${KERNEL_BRANCH:=""}
49 export KERNEL_BRANCH=${KERNEL_BRANCH:=""}
50
50
51 # URLs
51 # URLs
52 export KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux}
52 KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux}
53 export FIRMWARE_URL=${FIRMWARE_URL:=https://github.com/raspberrypi/firmware/raw/master/boot}
53 FIRMWARE_URL=${FIRMWARE_URL:=https://github.com/raspberrypi/firmware/raw/master/boot}
54 export WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm}
54 WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm}
55 export FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git}
55 COLLABORA_URL=${COLLABORA_URL:=https://repositories.collabora.co.uk/debian}
56 export UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git}
56 FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git}
57 export VIDEOCORE_URL=${VIDEOCORE_URL=https://github.com/raspberrypi/userland}
57 UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git}
58
58 VIDEOCORE_URL=${VIDEOCORE_URL=https://github.com/raspberrypi/userland}
59 # Firmware directory: Blank if download from github
60 export RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""}
61
59
62 # Build directories
60 # Build directories
63 export BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}}
61 BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}}
64 export BUILDDIR="${BASEDIR}/build"
62 BUILDDIR="${BASEDIR}/build"
65
63
66 # Prepare date string for default image file name
64 # Prepare date string for default image file name
67 DATE="$(date +%Y-%m-%d)"
65 DATE="$(date +%Y-%m-%d)"
68 if [ -z "$KERNEL_BRANCH" ] ; then
66 if [ -z "$KERNEL_BRANCH" ] ; then
69 export IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
67 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
70 else
68 else
71 export IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
69 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
72 fi
70 fi
73
71
74 # Chroot directories
72 # Chroot directories
75 export R="${BUILDDIR}/chroot"
73 R="${BUILDDIR}/chroot"
76 export ETC_DIR="${R}/etc"
74 ETC_DIR="${R}/etc"
77 export LIB_DIR="${R}/lib"
75 LIB_DIR="${R}/lib"
78 export BOOT_DIR="${R}/boot/firmware"
76 BOOT_DIR="${R}/boot/firmware"
79 export KERNEL_DIR="${R}/usr/src/linux"
77 KERNEL_DIR="${R}/usr/src/linux"
80 export WLAN_FIRMWARE_DIR="${R}/lib/firmware/brcm"
78 WLAN_FIRMWARE_DIR="${R}/lib/firmware/brcm"
81
79
80 # Firmware directory: Blank if download from github
81 RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""}
82 # General settings
82 # General settings
83 export SET_ARCH=${SET_ARCH:=32}
83 SET_ARCH=${SET_ARCH:=32}
84 export HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}}
84 HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}}
85 export PASSWORD=${PASSWORD:=raspberry}
85 PASSWORD=${PASSWORD:=raspberry}
86 export USER_PASSWORD=${USER_PASSWORD:=raspberry}
86 USER_PASSWORD=${USER_PASSWORD:=raspberry}
87 export DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"}
87 DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"}
88 export TIMEZONE=${TIMEZONE:="Europe/Berlin"}
88 TIMEZONE=${TIMEZONE:="Europe/Berlin"}
89 export EXPANDROOT=${EXPANDROOT:=true}
89 EXPANDROOT=${EXPANDROOT:=true}
90
90
91 # Keyboard settings
91 # Keyboard settings
92 export XKB_MODEL=${XKB_MODEL:=""}
92 XKB_MODEL=${XKB_MODEL:=""}
93 export XKB_LAYOUT=${XKB_LAYOUT:=""}
93 XKB_LAYOUT=${XKB_LAYOUT:=""}
94 export XKB_VARIANT=${XKB_VARIANT:=""}
94 XKB_VARIANT=${XKB_VARIANT:=""}
95 export XKB_OPTIONS=${XKB_OPTIONS:=""}
95 XKB_OPTIONS=${XKB_OPTIONS:=""}
96
96
97 # Network settings (DHCP)
97 # Network settings (DHCP)
98 export ENABLE_DHCP=${ENABLE_DHCP:=true}
98 ENABLE_DHCP=${ENABLE_DHCP:=true}
99
99
100 # Network settings (static)
100 # Network settings (static)
101 export NET_ADDRESS=${NET_ADDRESS:=""}
101 NET_ADDRESS=${NET_ADDRESS:=""}
102 export NET_GATEWAY=${NET_GATEWAY:=""}
102 NET_GATEWAY=${NET_GATEWAY:=""}
103 export NET_DNS_1=${NET_DNS_1:=""}
103 NET_DNS_1=${NET_DNS_1:=""}
104 export NET_DNS_2=${NET_DNS_2:=""}
104 NET_DNS_2=${NET_DNS_2:=""}
105 export NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""}
105 NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""}
106 export NET_NTP_1=${NET_NTP_1:=""}
106 NET_NTP_1=${NET_NTP_1:=""}
107 export NET_NTP_2=${NET_NTP_2:=""}
107 NET_NTP_2=${NET_NTP_2:=""}
108
108
109 # APT settings
109 # APT settings
110 export APT_PROXY=${APT_PROXY:=""}
110 APT_PROXY=${APT_PROXY:=""}
111 export APT_SERVER=${APT_SERVER:="ftp.debian.org"}
111 APT_SERVER=${APT_SERVER:="ftp.debian.org"}
112
112
113 # Feature settings
113 # Feature settings
114 export ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
114 ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
115 export ENABLE_I2C=${ENABLE_I2C:=false}
115 ENABLE_I2C=${ENABLE_I2C:=false}
116 export ENABLE_SPI=${ENABLE_SPI:=false}
116 ENABLE_SPI=${ENABLE_SPI:=false}
117 export ENABLE_IPV6=${ENABLE_IPV6:=true}
117 ENABLE_IPV6=${ENABLE_IPV6:=true}
118 export ENABLE_SSHD=${ENABLE_SSHD:=true}
118 ENABLE_SSHD=${ENABLE_SSHD:=true}
119 export ENABLE_NONFREE=${ENABLE_NONFREE:=false}
119 ENABLE_NONFREE=${ENABLE_NONFREE:=false}
120 export ENABLE_WIRELESS=${ENABLE_WIRELESS:=false}
120 ENABLE_WIRELESS=${ENABLE_WIRELESS:=false}
121 export ENABLE_SOUND=${ENABLE_SOUND:=true}
121 ENABLE_SOUND=${ENABLE_SOUND:=true}
122 export ENABLE_DBUS=${ENABLE_DBUS:=true}
122 ENABLE_DBUS=${ENABLE_DBUS:=true}
123 export ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}
123 ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}
124 export ENABLE_MINGPU=${ENABLE_MINGPU:=false}
124 ENABLE_MINGPU=${ENABLE_MINGPU:=false}
125 export ENABLE_XORG=${ENABLE_XORG:=false}
125 ENABLE_XORG=${ENABLE_XORG:=false}
126 export ENABLE_WM=${ENABLE_WM:=""}
126 ENABLE_WM=${ENABLE_WM:=""}
127 export ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true}
127 ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true}
128 export ENABLE_USER=${ENABLE_USER:=true}
128 ENABLE_USER=${ENABLE_USER:=true}
129 export USER_NAME=${USER_NAME:="pi"}
129 USER_NAME=${USER_NAME:="pi"}
130 export ENABLE_ROOT=${ENABLE_ROOT:=false}
130 ENABLE_ROOT=${ENABLE_ROOT:=false}
131 export ENABLE_QEMU=${ENABLE_QEMU:=false}
131 ENABLE_QEMU=${ENABLE_QEMU:=false}
132 ENABLE_SYSVINIT=${ENABLE_SYSVINIT:=false}
132
133
133 # SSH settings
134 # SSH settings
134 export SSH_ENABLE_ROOT=${SSH_ENABLE_ROOT:=false}
135 SSH_ENABLE_ROOT=${SSH_ENABLE_ROOT:=false}
135 export SSH_DISABLE_PASSWORD_AUTH=${SSH_DISABLE_PASSWORD_AUTH:=false}
136 SSH_DISABLE_PASSWORD_AUTH=${SSH_DISABLE_PASSWORD_AUTH:=false}
136 export SSH_LIMIT_USERS=${SSH_LIMIT_USERS:=false}
137 SSH_LIMIT_USERS=${SSH_LIMIT_USERS:=false}
137 export SSH_ROOT_PUB_KEY=${SSH_ROOT_PUB_KEY:=""}
138 SSH_ROOT_PUB_KEY=${SSH_ROOT_PUB_KEY:=""}
138 export SSH_USER_PUB_KEY=${SSH_USER_PUB_KEY:=""}
139 SSH_USER_PUB_KEY=${SSH_USER_PUB_KEY:=""}
139
140
140 # Advanced settings
141 # Advanced settings
141 export ENABLE_MINBASE=${ENABLE_MINBASE:=false}
142 ENABLE_MINBASE=${ENABLE_MINBASE:=false}
142 export ENABLE_REDUCE=${ENABLE_REDUCE:=false}
143 ENABLE_REDUCE=${ENABLE_REDUCE:=false}
143 export ENABLE_UBOOT=${ENABLE_UBOOT:=false}
144 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
144 export UBOOTSRC_DIR=${UBOOTSRC_DIR:=""}
145 UBOOTSRC_DIR=${UBOOTSRC_DIR:=""}
145 export ENABLE_UBOOTUSB=${ENABLE_UBOOTUSB=false}
146 ENABLE_UBOOTUSB=${ENABLE_UBOOTUSB=false}
146 export ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
147 ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
147 export ENABLE_VIDEOCORE=${ENABLE_VIDEOCORE:=true}
148 ENABLE_VIDEOCORE=${ENABLE_VIDEOCORE:=true}
148 export VIDEOCORESRC_DIR=${VIDEOCORESRC_DIR:=""}
149 VIDEOCORESRC_DIR=${VIDEOCORESRC_DIR:=""}
149 export FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""}
150 FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""}
150 export ENABLE_HARDNET=${ENABLE_HARDNET:=false}
151 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
151 export ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
152 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
152 export ENABLE_SPLITFS=${ENABLE_SPLITFS:=false}
153 ENABLE_SPLITFS=${ENABLE_SPLITFS:=false}
153 export ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false}
154 ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false}
154 export ENABLE_IFNAMES=${ENABLE_IFNAMES:=true}
155 ENABLE_IFNAMES=${ENABLE_IFNAMES:=true}
155 export DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS:=}
156 DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS:=}
156
157
157 # Kernel compilation settings
158 # Kernel compilation settings
158 export BUILD_KERNEL=${BUILD_KERNEL:=true}
159 BUILD_KERNEL=${BUILD_KERNEL:=true}
159 export KERNEL_REDUCE=${KERNEL_REDUCE:=false}
160 KERNEL_REDUCE=${KERNEL_REDUCE:=false}
160 export KERNEL_THREADS=${KERNEL_THREADS:=1}
161 KERNEL_THREADS=${KERNEL_THREADS:=1}
161 export KERNEL_HEADERS=${KERNEL_HEADERS:=true}
162 KERNEL_HEADERS=${KERNEL_HEADERS:=true}
162 export KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false}
163 KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false}
163 export KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true}
164 KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true}
164 export KERNEL_OLDDEFCONFIG=${KERNEL_OLDDEFCONFIG:=false}
165 KERNEL_OLDDEFCONFIG=${KERNEL_OLDDEFCONFIG:=false}
165 export KERNEL_CCACHE=${KERNEL_CCACHE:=false}
166 KERNEL_CCACHE=${KERNEL_CCACHE:=false}
166
167
167 # Kernel compilation from source directory settings
168 # Kernel compilation from source directory settings
168 export KERNELSRC_DIR=${KERNELSRC_DIR:=""}
169 KERNELSRC_DIR=${KERNELSRC_DIR:=""}
169 export KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false}
170 KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false}
170 export KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true}
171 KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true}
171 export KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false}
172 KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false}
172
173
173 # Reduce disk usage settings
174 # Reduce disk usage settings
174 export REDUCE_APT=${REDUCE_APT:=true}
175 REDUCE_APT=${REDUCE_APT:=true}
175 export REDUCE_DOC=${REDUCE_DOC:=true}
176 REDUCE_DOC=${REDUCE_DOC:=true}
176 export REDUCE_MAN=${REDUCE_MAN:=true}
177 REDUCE_MAN=${REDUCE_MAN:=true}
177 export REDUCE_VIM=${REDUCE_VIM:=false}
178 REDUCE_VIM=${REDUCE_VIM:=false}
178 export REDUCE_BASH=${REDUCE_BASH:=false}
179 REDUCE_BASH=${REDUCE_BASH:=false}
179 export REDUCE_HWDB=${REDUCE_HWDB:=true}
180 REDUCE_HWDB=${REDUCE_HWDB:=true}
180 export REDUCE_SSHD=${REDUCE_SSHD:=true}
181 REDUCE_SSHD=${REDUCE_SSHD:=true}
181 export REDUCE_LOCALE=${REDUCE_LOCALE:=true}
182 REDUCE_LOCALE=${REDUCE_LOCALE:=true}
182
183
183 # Encrypted filesystem settings
184 # Encrypted filesystem settings
184 ENABLE_CRYPTFS=${ENABLE_CRYPTFS:=false}
185 ENABLE_CRYPTFS=${ENABLE_CRYPTFS:=false}
@@ -191,16 +192,20 CRYPTFS_XTSKEYSIZE=${CRYPTFS_XTSKEYSIZE:=512}
191 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
192 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
192
193
193 # Packages required in the chroot build environment
194 # Packages required in the chroot build environment
194 export APT_INCLUDES=${APT_INCLUDES:=""}
195 APT_INCLUDES=${APT_INCLUDES:=""}
195 APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils,locales,keyboard-configuration,console-setup"
196 APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils,locales,keyboard-configuration,console-setup"
196
197
197 # Packages required for bootstrapping
198 # Packages required for bootstrapping
198 export REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo netselect-apt"
199 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo netselect-apt"
199 export MISSING_PACKAGES=""
200 MISSING_PACKAGES=""
200
201
201 # Packages installed for c/c++ build environment in chroot (keep empty)
202 # Packages installed for c/c++ build environment in chroot (keep empty)
202 export COMPILER_PACKAGES=""
203 COMPILER_PACKAGES=""
203
204
205 #ipinfo=$(curl ipinfo.io | grep country )
206 #grep -o '\"[^"]*\"' $ipinfo | tr -d '"'
207 #grep -Po '"country":.*?[^\\]",' $(curl ipinfo.io | grep country )
208 #sed -i "s,http:,https:,g" "${ETC_DIR}/apt/sources.list"
204 #autconfigure best apt server to not spam ftp.debian.org
209 #autconfigure best apt server to not spam ftp.debian.org
205 #rm files/apt/sources.list
210 #rm files/apt/sources.list
206 #netselect-apt does not know buster yet
211 #netselect-apt does not know buster yet
@@ -219,6 +224,8 if [ "$ENABLE_NONFREE" = true ] ; then
219 else
224 else
220 netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --outfile "$(pwd)/files/apt/sources.list" -d "$RLS"
225 netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --outfile "$(pwd)/files/apt/sources.list" -d "$RLS"
221 fi
226 fi
227
228 #sed and cut the result string so we can use it as APT_SERVER
222 APT_SERVER=$(grep -m 1 http files/apt/sources.list | sed "s|http://| |g" | cut -d ' ' -f 3)
229 APT_SERVER=$(grep -m 1 http files/apt/sources.list | sed "s|http://| |g" | cut -d ' ' -f 3)
223 APT_SERVER=${APT_SERVER::-1}
230 APT_SERVER=${APT_SERVER::-1}
224
231
@@ -395,7 +402,7 fi
395
402
396 # Check if all required packages are installed on the build system
403 # Check if all required packages are installed on the build system
397 for package in $REQUIRED_PACKAGES ; do
404 for package in $REQUIRED_PACKAGES ; do
398 if [ "$(dpkg-query -W -f='${Status}' "$package")" != "install ok installed" ] ; then
405 if [ "$(dpkg-query -W -f='${Status}' $package)" != "install ok installed" ] ; then
399 MISSING_PACKAGES="${MISSING_PACKAGES} $package"
406 MISSING_PACKAGES="${MISSING_PACKAGES} $package"
400 fi
407 fi
401 done
408 done
@@ -476,6 +483,8 if [ "$(df --output=avail "${BUILDDIR}" | sed "1d")" -le "524288" ] ; then
476 exit 1
483 exit 1
477 fi
484 fi
478
485
486 set -x
487
479 # Call "cleanup" function on various signals and errors
488 # Call "cleanup" function on various signals and errors
480 trap cleanup 0 1 2 3 6
489 trap cleanup 0 1 2 3 6
481
490
@@ -556,11 +565,19 if [ "$KERNEL_REDUCE" = true ] ; then
556 KERNELSRC_CONFIG=false
565 KERNELSRC_CONFIG=false
557 fi
566 fi
558
567
559 set -x
568 # Configure qemu compatible kernel
569 if [ "$ENABLE_QEMU" = true ] ; then
570 DTB_FILE=vexpress-v2p-ca15_a7.dtb
571 UBOOT_CONFIG=vexpress_ca15_tc2_defconfig
572 KERNEL_DEFCONFIG="vexpress_defconfig"
573 if [ "$KERNEL_MENUCONFIG" = false ] ; then
574 KERNEL_OLDDEFCONFIG=true
575 fi
576 fi
560
577
561 # Execute bootstrap scripts
578 # Execute bootstrap scripts
562 for SCRIPT in bootstrap.d/*.sh; do
579 for SCRIPT in bootstrap.d/*.sh; do
563 head -n 4 "$SCRIPT"
580 head -n 3 "$SCRIPT"
564 . "$SCRIPT"
581 . "$SCRIPT"
565 done
582 done
566
583
@@ -620,14 +637,6 rm -f "${R}/vmlinuz"
620 rm -f "${R}${QEMU_BINARY}"
637 rm -f "${R}${QEMU_BINARY}"
621
638
622 if [ "$ENABLE_QEMU" = true ] ; then
639 if [ "$ENABLE_QEMU" = true ] ; then
623 # Configure qemu compatible kernel
624 DTB_FILE=vexpress-v2p-ca15_a7.dtb
625 UBOOT_CONFIG=vexpress_ca15_tc2_defconfig
626 KERNEL_DEFCONFIG="vexpress_defconfig"
627 if [ "$KERNEL_MENUCONFIG" = false ] ; then
628 KERNEL_OLDDEFCONFIG=true
629 fi
630
631 # Setup QEMU directory
640 # Setup QEMU directory
632 mkdir "${BASEDIR}/qemu"
641 mkdir "${BASEDIR}/qemu"
633
642
@@ -700,12 +709,12 if [ "$ENABLE_SPLITFS" = true ] ; then
700
709
701 # Write firmware/boot partition tables
710 # Write firmware/boot partition tables
702 sfdisk -q -L -uS -f "$IMAGE_NAME-frmw.img" 2> /dev/null <<EOM
711 sfdisk -q -L -uS -f "$IMAGE_NAME-frmw.img" 2> /dev/null <<EOM
703 "${TABLE_SECTORS}","${FRMW_SECTORS}",c,*
712 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
704 EOM
713 EOM
705
714
706 # Write root partition table
715 # Write root partition table
707 sfdisk -q -L -uS -f "$IMAGE_NAME-root.img" 2> /dev/null <<EOM
716 sfdisk -q -L -uS -f "$IMAGE_NAME-root.img" 2> /dev/null <<EOM
708 "${TABLE_SECTORS}","${ROOT_SECTORS}",83
717 ${TABLE_SECTORS},${ROOT_SECTORS},83
709 EOM
718 EOM
710
719
711 # Setup temporary loop devices
720 # Setup temporary loop devices
@@ -717,8 +726,8 else # ENABLE_SPLITFS=false
717
726
718 # Write partition table
727 # Write partition table
719 sfdisk -q -L -uS -f "$IMAGE_NAME.img" 2> /dev/null <<EOM
728 sfdisk -q -L -uS -f "$IMAGE_NAME.img" 2> /dev/null <<EOM
720 "${TABLE_SECTORS}","${FRMW_SECTORS}",c,*
729 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
721 "${ROOT_OFFSET}","${ROOT_SECTORS}",83
730 ${ROOT_OFFSET},${ROOT_SECTORS},83
722 EOM
731 EOM
723
732
724 # Setup temporary loop devices
733 # Setup temporary loop devices
@@ -733,7 +742,7 if [ "$ENABLE_CRYPTFS" = true ] ; then
733 # Setup password keyfile
742 # Setup password keyfile
734 touch .password
743 touch .password
735 chmod 600 .password
744 chmod 600 .password
736 echo -n "${CRYPTFS_PASSWORD}" > .password
745 echo -n ${CRYPTFS_PASSWORD} > .password
737
746
738 # Initialize encrypted partition
747 # Initialize encrypted partition
739 echo "YES" | cryptsetup luksFormat "${ROOT_LOOP}" -c "${CRYPTFS_CIPHER}" -s "${CRYPTFS_XTSKEYSIZE}" .password
748 echo "YES" | cryptsetup luksFormat "${ROOT_LOOP}" -c "${CRYPTFS_CIPHER}" -s "${CRYPTFS_XTSKEYSIZE}" .password
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant