diff --git a/README.md b/README.md index 81c36cb..dd8a737 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ CONFIG_TEMPLATE=rpi2stretch ./rpi23-gen-image.sh Set Debian packages server address. Choose a server from the list of Debian worldwide [mirror sites](https://www.debian.org/mirror/list). Using a nearby server will probably speed-up all required downloads within the bootstrapping process. ##### `APT_PROXY`="" -Set Proxy server address. Using a local Proxy-Cache like `apt-cacher-ng` will speed-up the bootstrapping process because all required Debian packages will only be downloaded from the Debian mirror site once. +Set Proxy server address. Using a local Proxy-Cache like `apt-cacher-ng` will speed-up the bootstrapping process because all required Debian packages will only be downloaded from the Debian mirror site once. If `apt-cacher-ng` is running on default `http://127.0.0.1:3142` it is autodetected and you don't need to set this. ##### `APT_INCLUDES`="" A comma separated list of additional packages to be installed by debootstrap during bootstrapping. diff --git a/bootstrap.d/10-bootstrap.sh b/bootstrap.d/10-bootstrap.sh index 7a5315c..bb58cab 100644 --- a/bootstrap.d/10-bootstrap.sh +++ b/bootstrap.d/10-bootstrap.sh @@ -19,7 +19,7 @@ if [ "$ENABLE_MINBASE" = true ] ; then fi # Base debootstrap (unpack only) -http_proxy=${APT_PROXY} debootstrap "${APT_EXCLUDES}" --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}" +http_proxy=${APT_PROXY} debootstrap ${APT_EXCLUDES} --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}" # Copy qemu emulator binary to chroot install -m 755 -o root -g root "${QEMU_BINARY}" "${R}${QEMU_BINARY}" diff --git a/bootstrap.d/16-videocore.sh b/bootstrap.d/16-videocore.sh index 0b480a0..8dedc17 100644 --- a/bootstrap.d/16-videocore.sh +++ b/bootstrap.d/16-videocore.sh @@ -27,7 +27,20 @@ if [ "$ENABLE_VIDEOCORE" = true ] ; then rm -fr "${temp_dir}" fi - cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DARM64=ON -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_ASM_COMPILER=aarch64-linux-gnu-gcc -DVIDEOCORE_BUILD_DIR="${R}"/opt/vc - make -j $(nproc) - chroot_exec PATH=${PATH}:/opt/vc/bin + if [ "$RELEASE_ARCH" = "arm64" ] ; then + cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DARM64=ON -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_ASM_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE" -DCMAKE_ASM_FLAGS="${CMAKE_ASM_FLAGS} -c" -DVIDEOCORE_BUILD_DIR="${R}"/opt/vc "${R}/tmp/userland" + fi + + if [ "$RELEASE_ARCH" = "armel" ] ; then + cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=arm-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabi-g++ -DCMAKE_ASM_COMPILER=arm-linux-gnueabi-gcc -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE" -DCMAKE_ASM_FLAGS="${CMAKE_ASM_FLAGS} -c" -DCMAKE_SYSTEM_PROCESSOR="arm" -DVIDEOCORE_BUILD_DIR="${R}"/opt/vc "${R}/tmp/userland" + fi + + if [ "$RELEASE_ARCH" = "armhf" ] ; then + cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DCMAKE_TOOLCHAIN_FILE="${R}"/tmp/userland/makefiles/cmake/toolchains/arm-linux-gnueabihf.cmake -DVIDEOCORE_BUILD_DIR="${R}"/opt/vc "${R}/tmp/userland" + fi + + #build userland + make -j "$(nproc)" + #include default_installdir in path + chroot_exec PATH="${PATH}":/opt/vc/bin fi diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index e0ba54a..0e29c60 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -195,6 +195,9 @@ CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""} 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 to exclude from chroot build environment +APT_EXCLUDES=${APT_EXCLUDES:=""} + # 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="" @@ -202,6 +205,16 @@ MISSING_PACKAGES="" # Packages installed for c/c++ build environment in chroot (keep empty) COMPILER_PACKAGES="" +#If init and systemd-sysv are wanted e.g. halt/reboot/shutdown scripts +if [ "$ENABLE_SYSVINIT" = false ] ; then +APT_EXCLUDES="--exclude=${APT_EXCLUDES},init,systemd-sysv" +fi + +#Check if apt-cacher-ng has its default port open on and set APT_PROXY +if [ -n "$(lsof -i :3142)" ] ; then +HTTP_PROXY=http://127.0.0.1:3142/ +fi + #ipinfo=$(curl ipinfo.io | grep country ) #grep -o '\"[^"]*\"' $ipinfo | tr -d '"' #grep -Po '"country":.*?[^\\]",' $(curl ipinfo.io | grep country ) @@ -249,7 +262,7 @@ if [ -n "$SET_ARCH" ] ; then KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img} CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-} else - echo "error: At the moment Raspberry PI 3 and 3B+ are the only Models which support 64bit" + echo "error: Only Raspberry PI 3 and 3B+ support 64bit" exit 1 fi fi