diff --git a/bootstrap.d/11-apt.sh b/bootstrap.d/11-apt.sh index 3b990c4..5dc9ca3 100644 --- a/bootstrap.d/11-apt.sh +++ b/bootstrap.d/11-apt.sh @@ -19,21 +19,6 @@ if [ "$BUILD_KERNEL" = false ] ; then # BUILD_KERNEL=true else echo "No precompiled kernel repositories were added" -fi - -#autconfigure best apt server to not spam ftp.debian.org -#rm files/apt/sources.list -#netselect-apt does not know buster yet -if [ "$RELEASE" = "buster" ] ; then - RLS=testing -else - RLS="$RELEASE" -fi - -if [ "$ENABLE_NONFREE" = true ] ; then - netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --nonfree --outfile "${ETC_DIR}/apt/sources.list" -d "$RLS" -else - netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --outfile "${ETC_DIR}/apt/sources.list" -d "$RLS" fi #ipinfo=$(curl ipinfo.io | grep country ) diff --git a/bootstrap.d/41-uboot.sh b/bootstrap.d/41-uboot.sh index 999e7ca..41b614a 100644 --- a/bootstrap.d/41-uboot.sh +++ b/bootstrap.d/41-uboot.sh @@ -73,6 +73,7 @@ if [ "$ENABLE_UBOOT" = true ] ; then if [ "$SET_ARCH" = 64 ] ; then echo "Setting up config.txt to boot 64bit uboot" + printf "\n# Enable CPU 64 bit mode\narm_control=0x200\n" >> "${BOOT_DIR}/config.txt" printf "\n# Tell u-boot a 64bit kernel is used\narm_64bit=1\n" >> "${BOOT_DIR}/config.txt" printf "\n# Device tree start addr\ndevice_tree_address=0x100\n" >> "${BOOT_DIR}/config.txt" printf "\n# Device tree stop adrr\ndevice_tree_end=0x8000\n" >> "${BOOT_DIR}/config.txt" diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 4dffe8d..68cdca9 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -40,141 +40,141 @@ echo -n -e "\n#\n# RPi2/3 Bootstrap Settings\n#\n" set -x # Raspberry Pi model configuration -RPI_MODEL=${RPI_MODEL:=2} +export RPI_MODEL=${RPI_MODEL:=2} # Debian release -RELEASE=${RELEASE:=buster} +export RELEASE=${RELEASE:=buster} #Kernel Branch -KERNEL_BRANCH=${KERNEL_BRANCH:=""} +export KERNEL_BRANCH=${KERNEL_BRANCH:=""} # URLs -KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux} -FIRMWARE_URL=${FIRMWARE_URL:=https://github.com/raspberrypi/firmware/raw/master/boot} -WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm} -FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git} -UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git} +export KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux} +export FIRMWARE_URL=${FIRMWARE_URL:=https://github.com/raspberrypi/firmware/raw/master/boot} +export WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm} +export FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git} +export UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git} # Firmware directory: Blank if download from github -RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""} +export RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""} # Build directories -BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}} -BUILDDIR="${BASEDIR}/build" +export BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}} +export BUILDDIR="${BASEDIR}/build" # Prepare date string for default image file name DATE="$(date +%Y-%m-%d)" if [ -z "$KERNEL_BRANCH" ] ; then - IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} + export IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} else - IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} + export IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} fi # Chroot directories -R="${BUILDDIR}/chroot" -ETC_DIR="${R}/etc" -LIB_DIR="${R}/lib" -BOOT_DIR="${R}/boot/firmware" -KERNEL_DIR="${R}/usr/src/linux" -WLAN_FIRMWARE_DIR="${R}/lib/firmware/brcm" +export R="${BUILDDIR}/chroot" +export ETC_DIR="${R}/etc" +export LIB_DIR="${R}/lib" +export BOOT_DIR="${R}/boot/firmware" +export KERNEL_DIR="${R}/usr/src/linux" +export WLAN_FIRMWARE_DIR="${R}/lib/firmware/brcm" # General settings -SET_ARCH=${SET_ARCH:=32} -HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}} -PASSWORD=${PASSWORD:=raspberry} -USER_PASSWORD=${USER_PASSWORD:=raspberry} -DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"} -TIMEZONE=${TIMEZONE:="Europe/Berlin"} -EXPANDROOT=${EXPANDROOT:=true} +export SET_ARCH=${SET_ARCH:=32} +export HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}} +export PASSWORD=${PASSWORD:=raspberry} +export USER_PASSWORD=${USER_PASSWORD:=raspberry} +export DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"} +export TIMEZONE=${TIMEZONE:="Europe/Berlin"} +export EXPANDROOT=${EXPANDROOT:=true} # Keyboard settings -XKB_MODEL=${XKB_MODEL:=""} -XKB_LAYOUT=${XKB_LAYOUT:=""} -XKB_VARIANT=${XKB_VARIANT:=""} -XKB_OPTIONS=${XKB_OPTIONS:=""} +export XKB_MODEL=${XKB_MODEL:=""} +export XKB_LAYOUT=${XKB_LAYOUT:=""} +export XKB_VARIANT=${XKB_VARIANT:=""} +export XKB_OPTIONS=${XKB_OPTIONS:=""} # Network settings (DHCP) -ENABLE_DHCP=${ENABLE_DHCP:=true} +export ENABLE_DHCP=${ENABLE_DHCP:=true} # Network settings (static) -NET_ADDRESS=${NET_ADDRESS:=""} -NET_GATEWAY=${NET_GATEWAY:=""} -NET_DNS_1=${NET_DNS_1:=""} -NET_DNS_2=${NET_DNS_2:=""} -NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""} -NET_NTP_1=${NET_NTP_1:=""} -NET_NTP_2=${NET_NTP_2:=""} +export NET_ADDRESS=${NET_ADDRESS:=""} +export NET_GATEWAY=${NET_GATEWAY:=""} +export NET_DNS_1=${NET_DNS_1:=""} +export NET_DNS_2=${NET_DNS_2:=""} +export NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""} +export NET_NTP_1=${NET_NTP_1:=""} +export NET_NTP_2=${NET_NTP_2:=""} # APT settings -APT_PROXY=${APT_PROXY:=""} -APT_SERVER=${APT_SERVER:="ftp.debian.org"} +export APT_PROXY=${APT_PROXY:=""} +export APT_SERVER=${APT_SERVER:="ftp.debian.org"} # Feature settings -ENABLE_CONSOLE=${ENABLE_CONSOLE:=true} -ENABLE_I2C=${ENABLE_I2C:=false} -ENABLE_SPI=${ENABLE_SPI:=false} -ENABLE_IPV6=${ENABLE_IPV6:=true} -ENABLE_SSHD=${ENABLE_SSHD:=true} -ENABLE_NONFREE=${ENABLE_NONFREE:=false} -ENABLE_WIRELESS=${ENABLE_WIRELESS:=false} -ENABLE_SOUND=${ENABLE_SOUND:=true} -ENABLE_DBUS=${ENABLE_DBUS:=true} -ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true} -ENABLE_MINGPU=${ENABLE_MINGPU:=false} -ENABLE_XORG=${ENABLE_XORG:=false} -ENABLE_WM=${ENABLE_WM:=""} -ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true} -ENABLE_USER=${ENABLE_USER:=true} -USER_NAME=${USER_NAME:="pi"} -ENABLE_ROOT=${ENABLE_ROOT:=false} -ENABLE_QEMU=${ENABLE_QEMU:=false} +export ENABLE_CONSOLE=${ENABLE_CONSOLE:=true} +export ENABLE_I2C=${ENABLE_I2C:=false} +export ENABLE_SPI=${ENABLE_SPI:=false} +export ENABLE_IPV6=${ENABLE_IPV6:=true} +export ENABLE_SSHD=${ENABLE_SSHD:=true} +export ENABLE_NONFREE=${ENABLE_NONFREE:=false} +export ENABLE_WIRELESS=${ENABLE_WIRELESS:=false} +export ENABLE_SOUND=${ENABLE_SOUND:=true} +export ENABLE_DBUS=${ENABLE_DBUS:=true} +export ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true} +export ENABLE_MINGPU=${ENABLE_MINGPU:=false} +export ENABLE_XORG=${ENABLE_XORG:=false} +export ENABLE_WM=${ENABLE_WM:=""} +export ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true} +export ENABLE_USER=${ENABLE_USER:=true} +export USER_NAME=${USER_NAME:="pi"} +export ENABLE_ROOT=${ENABLE_ROOT:=false} +export ENABLE_QEMU=${ENABLE_QEMU:=false} # SSH settings -SSH_ENABLE_ROOT=${SSH_ENABLE_ROOT:=false} -SSH_DISABLE_PASSWORD_AUTH=${SSH_DISABLE_PASSWORD_AUTH:=false} -SSH_LIMIT_USERS=${SSH_LIMIT_USERS:=false} -SSH_ROOT_PUB_KEY=${SSH_ROOT_PUB_KEY:=""} -SSH_USER_PUB_KEY=${SSH_USER_PUB_KEY:=""} +export SSH_ENABLE_ROOT=${SSH_ENABLE_ROOT:=false} +export SSH_DISABLE_PASSWORD_AUTH=${SSH_DISABLE_PASSWORD_AUTH:=false} +export SSH_LIMIT_USERS=${SSH_LIMIT_USERS:=false} +export SSH_ROOT_PUB_KEY=${SSH_ROOT_PUB_KEY:=""} +export SSH_USER_PUB_KEY=${SSH_USER_PUB_KEY:=""} # Advanced settings -ENABLE_MINBASE=${ENABLE_MINBASE:=false} -ENABLE_REDUCE=${ENABLE_REDUCE:=false} -ENABLE_UBOOT=${ENABLE_UBOOT:=false} -UBOOTSRC_DIR=${UBOOTSRC_DIR:=""} -ENABLE_FBTURBO=${ENABLE_FBTURBO:=false} -FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""} -ENABLE_HARDNET=${ENABLE_HARDNET:=false} -ENABLE_IPTABLES=${ENABLE_IPTABLES:=false} -ENABLE_SPLITFS=${ENABLE_SPLITFS:=false} -ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false} -ENABLE_IFNAMES=${ENABLE_IFNAMES:=true} -DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS:=} +export ENABLE_MINBASE=${ENABLE_MINBASE:=false} +export ENABLE_REDUCE=${ENABLE_REDUCE:=false} +export ENABLE_UBOOT=${ENABLE_UBOOT:=false} +export UBOOTSRC_DIR=${UBOOTSRC_DIR:=""} +export ENABLE_FBTURBO=${ENABLE_FBTURBO:=false} +export FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""} +export export ENABLE_HARDNET=${ENABLE_HARDNET:=false} +export ENABLE_IPTABLES=${ENABLE_IPTABLES:=false} +export ENABLE_SPLITFS=${ENABLE_SPLITFS:=false} +export ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false} +export ENABLE_IFNAMES=${ENABLE_IFNAMES:=true} +export DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS:=} # Kernel compilation settings -BUILD_KERNEL=${BUILD_KERNEL:=true} -KERNEL_REDUCE=${KERNEL_REDUCE:=false} -KERNEL_THREADS=${KERNEL_THREADS:=1} -KERNEL_HEADERS=${KERNEL_HEADERS:=true} -KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false} -KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true} -KERNEL_OLDDEFCONFIG=${KERNEL_OLDDEFCONFIG:=false} -KERNEL_CCACHE=${KERNEL_CCACHE:=false} +export BUILD_KERNEL=${BUILD_KERNEL:=true} +export KERNEL_REDUCE=${KERNEL_REDUCE:=false} +export KERNEL_THREADS=${KERNEL_THREADS:=1} +export KERNEL_HEADERS=${KERNEL_HEADERS:=true} +export KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false} +export KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true} +export KERNEL_OLDDEFCONFIG=${KERNEL_OLDDEFCONFIG:=false} +export KERNEL_CCACHE=${KERNEL_CCACHE:=false} # Kernel compilation from source directory settings -KERNELSRC_DIR=${KERNELSRC_DIR:=""} -KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false} -KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true} -KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false} +export KERNELSRC_DIR=${KERNELSRC_DIR:=""} +export KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false} +export KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true} +export KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false} # Reduce disk usage settings -REDUCE_APT=${REDUCE_APT:=true} -REDUCE_DOC=${REDUCE_DOC:=true} -REDUCE_MAN=${REDUCE_MAN:=true} -REDUCE_VIM=${REDUCE_VIM:=false} -REDUCE_BASH=${REDUCE_BASH:=false} -REDUCE_HWDB=${REDUCE_HWDB:=true} -REDUCE_SSHD=${REDUCE_SSHD:=true} -REDUCE_LOCALE=${REDUCE_LOCALE:=true} +export REDUCE_APT=${REDUCE_APT:=true} +export REDUCE_DOC=${REDUCE_DOC:=true} +export REDUCE_MAN=${REDUCE_MAN:=true} +export REDUCE_VIM=${REDUCE_VIM:=false} +export REDUCE_BASH=${REDUCE_BASH:=false} +export REDUCE_HWDB=${REDUCE_HWDB:=true} +export REDUCE_SSHD=${REDUCE_SSHD:=true} +export REDUCE_LOCALE=${REDUCE_LOCALE:=true} # Encrypted filesystem settings ENABLE_CRYPTFS=${ENABLE_CRYPTFS:=false} @@ -187,15 +187,33 @@ CRYPTFS_XTSKEYSIZE=${CRYPTFS_XTSKEYSIZE:=512} CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""} # Packages required in the chroot build environment -APT_INCLUDES=${APT_INCLUDES:=""} +export APT_INCLUDES=${APT_INCLUDES:=""} APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils,locales,keyboard-configuration,console-setup" # Packages required for bootstrapping -REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo netselect-apt" -MISSING_PACKAGES="" +export REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo netselect-apt" +export MISSING_PACKAGES="" # Packages installed for c/c++ build environment in chroot (keep empty) -COMPILER_PACKAGES="" +export COMPILER_PACKAGES="" + +#autconfigure best apt server to not spam ftp.debian.org +#rm files/apt/sources.list +#netselect-apt does not know buster yet +if [ "$RELEASE" = "buster" ] ; then + RLS=testing +else + RLS="$RELEASE" +fi + +rm "${ETC_DIR}/apt/sources.list" + +if [ "$ENABLE_NONFREE" = true ] ; then + netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --nonfree --outfile "${ETC_DIR}/apt/sources.list" -d "$RLS" +else + netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --outfile "${ETC_DIR}/apt/sources.list" -d "$RLS" +fi +APT_SERVER=$(grep -m 1 http /etc/apt/sources.list | cut -d ' ' -f 2) #make script easier and more stable to use with convenient setup switch. Just setup SET_ARCH and RPI_MODEL and your good to go! if [ -n "$SET_ARCH" ] ; then