From 491ef8b4486539ef331112baea417c8dfb468333 2016-08-03 12:03:53 From: drtyhlpr Date: 2016-08-03 12:03:53 Subject: [PATCH] Added ENABLE_NONFREE support and more --- diff --git a/README.md b/README.md index 2476850..b25f5af 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,9 @@ Enable IPv6 support. The network interface configuration is managed via systemd- ##### `ENABLE_SSHD`=true Install and enable OpenSSH service. The default configuration of the service doesn't allow `root` to login. Please use the user `pi` instead and `su -` or `sudo` to execute commands as root. +##### `ENABLE_NONFREE`=false +Allow the installation of non-free Debian packages that do not comply with the DFSG. This is required to install closed-source firmware binary blobs. + ##### `ENABLE_RSYSLOG`=true If set to false, disable and uninstall rsyslog (so logs will be available only in journal files) diff --git a/bootstrap.d/10-bootstrap.sh b/bootstrap.d/10-bootstrap.sh index 2dfddff..771a3e4 100644 --- a/bootstrap.d/10-bootstrap.sh +++ b/bootstrap.d/10-bootstrap.sh @@ -5,13 +5,22 @@ # Load utility functions . ./functions.sh -# Base debootstrap (unpack only) +VARIANT="" +COMPONENTS="main" + +# Use non-free Debian packages if needed +if [ "$ENABLE_NONFREE" = true ] ; then + COMPONENTS="main,non-free" +fi + +# Use minbase bootstrap variant which only includes essential packages if [ "$ENABLE_MINBASE" = true ] ; then - http_proxy=${APT_PROXY} debootstrap --arch="${RELEASE_ARCH}" --foreign --variant=minbase --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}/debian" -else - http_proxy=${APT_PROXY} debootstrap --arch="${RELEASE_ARCH}" --foreign --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}/debian" + VARIANT="--variant=minbase" fi +# Base debootstrap (unpack only) +http_proxy=${APT_PROXY} debootstrap --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}/debian" + # Copy qemu emulator binary to chroot install_exec "${QEMU_BINARY}" "${R}${QEMU_BINARY}" diff --git a/bootstrap.d/11-apt.sh b/bootstrap.d/11-apt.sh index 991e7e1..cd2a51c 100644 --- a/bootstrap.d/11-apt.sh +++ b/bootstrap.d/11-apt.sh @@ -17,7 +17,7 @@ if [ "$BUILD_KERNEL" = false ] ; then # Install APT sources.list install_readonly files/apt/sources.list "${ETCDIR}/apt/sources.list" - echo "deb https://repositories.collabora.co.uk/debian ${RELEASE} rpi2" >> "${ETCDIR}/apt/sources.list" + echo "deb ${COLLABORA_URL} ${RELEASE} rpi2" >> "${ETCDIR}/apt/sources.list" # Upgrade collabora package index and install collabora keyring chroot_exec apt-get -qq -y update @@ -31,6 +31,11 @@ else # BUILD_KERNEL=true sed -i "s/ jessie/ ${RELEASE}/" "${ETCDIR}/apt/sources.list" fi +# Allow the installation of non-free Debian packages +if [ "$ENABLE_NONFREE" = true ] ; then + sed -i "s/ contrib/ contrib non-free/" "${ETCDIR}/apt/sources.list" +fi + # Upgrade package index and update all installed packages and changed dependencies chroot_exec apt-get -qq -y update chroot_exec apt-get -qq -y -u dist-upgrade diff --git a/bootstrap.d/13-kernel.sh b/bootstrap.d/13-kernel.sh index c6b43c6..8e437c4 100644 --- a/bootstrap.d/13-kernel.sh +++ b/bootstrap.d/13-kernel.sh @@ -21,7 +21,7 @@ if [ "$BUILD_KERNEL" = true ] ; then fi else # KERNELSRC_DIR="" # Fetch current raspberrypi kernel sources - git -C "${R}/usr/src" clone --depth=1 https://github.com/raspberrypi/linux + git -C "${R}/usr/src" clone --depth=1 "${KERNEL_URL}" fi # Calculate optimal number of kernel building threads @@ -142,13 +142,13 @@ if [ "$BUILD_KERNEL" = true ] ; then cp ${FIRMWAREDIR}/boot/start_x.elf ${BOOTDIR}/start_x.elf else # Install latest boot binaries from raspberry/firmware github - wget -q -O "${BOOTDIR}/bootcode.bin" https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin - wget -q -O "${BOOTDIR}/fixup.dat" https://github.com/raspberrypi/firmware/raw/master/boot/fixup.dat - wget -q -O "${BOOTDIR}/fixup_cd.dat" https://github.com/raspberrypi/firmware/raw/master/boot/fixup_cd.dat - wget -q -O "${BOOTDIR}/fixup_x.dat" https://github.com/raspberrypi/firmware/raw/master/boot/fixup_x.dat - wget -q -O "${BOOTDIR}/start.elf" https://github.com/raspberrypi/firmware/raw/master/boot/start.elf - wget -q -O "${BOOTDIR}/start_cd.elf" https://github.com/raspberrypi/firmware/raw/master/boot/start_cd.elf - wget -q -O "${BOOTDIR}/start_x.elf" https://github.com/raspberrypi/firmware/raw/master/boot/start_x.elf + wget -q -O "${BOOTDIR}/bootcode.bin" "${FIRMWARE_URL}/bootcode.bin" + wget -q -O "${BOOTDIR}/fixup.dat" "${FIRMWARE_URL}/fixup.dat" + wget -q -O "${BOOTDIR}/fixup_cd.dat" "${FIRMWARE_URL}/fixup_cd.dat" + wget -q -O "${BOOTDIR}/fixup_x.dat" "${FIRMWARE_URL}/fixup_x.dat" + wget -q -O "${BOOTDIR}/start.elf" "${FIRMWARE_URL}/start.elf" + wget -q -O "${BOOTDIR}/start_cd.elf" "${FIRMWARE_URL}/start_cd.elf" + wget -q -O "${BOOTDIR}/start_x.elf" "${FIRMWARE_URL}/start_x.elf" fi else # BUILD_KERNEL=false diff --git a/bootstrap.d/41-uboot.sh b/bootstrap.d/41-uboot.sh index 19ad084..dca9cfc 100644 --- a/bootstrap.d/41-uboot.sh +++ b/bootstrap.d/41-uboot.sh @@ -13,7 +13,7 @@ fi # Fetch and build U-Boot bootloader if [ "$ENABLE_UBOOT" = true ] ; then # Fetch U-Boot bootloader sources - git -C "${R}/tmp" clone git://git.denx.de/u-boot.git + git -C "${R}/tmp" clone "${UBOOT_URL}" # Build and install U-Boot inside chroot chroot_exec make -C /tmp/u-boot/ ${UBOOT_CONFIG} all diff --git a/bootstrap.d/42-fbturbo.sh b/bootstrap.d/42-fbturbo.sh index 4e03f53..c3619f0 100644 --- a/bootstrap.d/42-fbturbo.sh +++ b/bootstrap.d/42-fbturbo.sh @@ -7,7 +7,7 @@ if [ "$ENABLE_FBTURBO" = true ] ; then # Fetch fbturbo driver sources - git -C "${R}/tmp" clone https://github.com/ssvb/xf86-video-fbturbo.git + git -C "${R}/tmp" clone "${FBTURBO_URL}" # Install Xorg build dependencies chroot_exec apt-get -q -y --no-install-recommends install xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev diff --git a/rpi2-gen-image.sh b/rpi2-gen-image.sh index f2d3d4d..2d17f12 100755 --- a/rpi2-gen-image.sh +++ b/rpi2-gen-image.sh @@ -47,6 +47,13 @@ DTB_FILE=${DTB_FILE:=bcm2709-rpi-2-b.dtb} UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_2_defconfig} QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static} +# URLs +KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux} +FIRMWARE_URL=${FIRMWARE_URL:=https://github.com/raspberrypi/firmware/raw/master/boot} +COLLABORA_URL=${COLLABORA_URL:=https://repositories.collabora.co.uk/debian} +FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git} +UBOOT_URL=${UBOOT_URL:=git://git.denx.de/u-boot.git} + # Build directories BASEDIR="$(pwd)/images/${RELEASE}" BUILDDIR="${BASEDIR}/build" @@ -93,6 +100,7 @@ APT_SERVER=${APT_SERVER:="ftp.debian.org"} ENABLE_CONSOLE=${ENABLE_CONSOLE:=true} ENABLE_IPV6=${ENABLE_IPV6:=true} ENABLE_SSHD=${ENABLE_SSHD:=true} +ENABLE_NONFREE=${ENABLE_NONFREE:=false} ENABLE_SOUND=${ENABLE_SOUND:=true} ENABLE_DBUS=${ENABLE_DBUS:=true} ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}