From 24b8ee07121b442863c47c91ac4a741fbc707fef Mon Sep 17 00:00:00 2001 From: David Lawson Date: Sat, 9 Oct 2021 21:48:21 +0200 Subject: [PATCH] Add support for RPi4.aarch64 port of https://github.com/libretro/Lakka-LibreELEC/commit/1bd927e0747ee04693f7b0af96bca0bad91fb377 --- build_all.sh | 1 + .../tools/bcm2835-bootloader/files/update.sh | 1 + packages/tools/bcm2835-bootloader/package.mk | 6 ++++++ packages/tools/bcm2835-bootloader/release | 1 + packages/tools/rpi-eeprom/package.mk | 1 + pkg_all.sh | 1 + projects/RPi/options | 19 ++++++++++++++++--- scripts/mkimage | 1 + 8 files changed, 28 insertions(+), 3 deletions(-) diff --git a/build_all.sh b/build_all.sh index 9cf8777bec..39178faa49 100755 --- a/build_all.sh +++ b/build_all.sh @@ -81,6 +81,7 @@ targets="\ RPi|GPICase|arm|image \ RPi|RPi|arm|noobs \ RPi|RPi2|arm|noobs \ + RPi|RPi4|aarch64|noobs \ RPi|RPi4|arm|noobs \ " diff --git a/packages/tools/bcm2835-bootloader/files/update.sh b/packages/tools/bcm2835-bootloader/files/update.sh index cf645523a8..9f2a2b2394 100755 --- a/packages/tools/bcm2835-bootloader/files/update.sh +++ b/packages/tools/bcm2835-bootloader/files/update.sh @@ -19,6 +19,7 @@ mount -o remount,rw $BOOT_ROOT cp -p $SYSTEM_ROOT/usr/share/bootloader/LICENCE* $BOOT_ROOT cp -p $SYSTEM_ROOT/usr/share/bootloader/bootcode.bin $BOOT_ROOT cp -p $SYSTEM_ROOT/usr/share/bootloader/fixup.dat $BOOT_ROOT +cp -p $SYSTEM_ROOT/usr/share/bootloader/fixup4.dat $BOOT_ROOT cp -p $SYSTEM_ROOT/usr/share/bootloader/start.elf $BOOT_ROOT rm -f $BOOT_ROOT/bcm283*.dtb # cleanup excess dtb's used by upstream kernels (ie. not LE) diff --git a/packages/tools/bcm2835-bootloader/package.mk b/packages/tools/bcm2835-bootloader/package.mk index b77448512a..8e040a371e 100644 --- a/packages/tools/bcm2835-bootloader/package.mk +++ b/packages/tools/bcm2835-bootloader/package.mk @@ -19,9 +19,11 @@ makeinstall_target() { cp -PRv bootcode.bin ${INSTALL}/usr/share/bootloader if [ "${DEVICE}" = "RPi4" ]; then cp -PRv fixup4x.dat ${INSTALL}/usr/share/bootloader/fixup.dat + cp -PRv fixup4.dat ${INSTALL}/usr/share/bootloader/fixup4.dat cp -PRv start4x.elf ${INSTALL}/usr/share/bootloader/start.elf else cp -PRv fixup_x.dat ${INSTALL}/usr/share/bootloader/fixup.dat + cp -PRv fixup4.dat ${INSTALL}/usr/share/bootloader/fixup4.dat cp -PRv start_x.elf ${INSTALL}/usr/share/bootloader/start.elf fi @@ -32,6 +34,10 @@ makeinstall_target() { find_file_path config/config.txt ${PKG_DIR}/files/config.txt && cp -PRv ${FOUND_PATH} ${INSTALL}/usr/share/bootloader if [ "${DISTRO}" = "Lakka" ]; then + if [ "${ARCH}" = "aarch64" ]; then + echo "arm_64bit=1" >> ${INSTALL}/usr/share/bootloader/distroconfig.txt + echo "kernel=${KERNEL_NAME}" >> ${INSTALL}/usr/share/bootloader/distroconfig.txt + fi echo "disable_splash=1" >> ${INSTALL}/usr/share/bootloader/distroconfig.txt echo "dtparam=audio=on" >> ${INSTALL}/usr/share/bootloader/distroconfig.txt echo "hdmi_max_pixel_freq:0=200000000" >> ${INSTALL}/usr/share/bootloader/distroconfig.txt diff --git a/packages/tools/bcm2835-bootloader/release b/packages/tools/bcm2835-bootloader/release index f3cc290c9d..fa8036168d 100755 --- a/packages/tools/bcm2835-bootloader/release +++ b/packages/tools/bcm2835-bootloader/release @@ -8,6 +8,7 @@ mkdir -p $RELEASE_DIR/3rdparty/bootloader cp -PR $INSTALL/usr/share/bootloader/LICENCE* $RELEASE_DIR/3rdparty/bootloader/ cp -PR $INSTALL/usr/share/bootloader/bootcode.bin $RELEASE_DIR/3rdparty/bootloader/ cp -PR $INSTALL/usr/share/bootloader/fixup.dat $RELEASE_DIR/3rdparty/bootloader/ + cp -PR $INSTALL/usr/share/bootloader/fixup4.dat $RELEASE_DIR/3rdparty/bootloader/ cp -PR $INSTALL/usr/share/bootloader/start.elf $RELEASE_DIR/3rdparty/bootloader/ cp -PR $INSTALL/usr/share/bootloader/*.dtb $RELEASE_DIR/3rdparty/bootloader/ cp -PR $INSTALL/usr/share/bootloader/overlays $RELEASE_DIR/3rdparty/bootloader/ diff --git a/packages/tools/rpi-eeprom/package.mk b/packages/tools/rpi-eeprom/package.mk index 226a77270b..ca3fe4d420 100644 --- a/packages/tools/rpi-eeprom/package.mk +++ b/packages/tools/rpi-eeprom/package.mk @@ -5,6 +5,7 @@ PKG_NAME="rpi-eeprom" PKG_VERSION="f19990103e4483ebb47be5ea897c134913f83ad8" PKG_SHA256="6985c06448a5fcdcd0350bebfb50930a7d4e05ecaf1230e29d796c5a8144dbd8" PKG_ARCH="arm" +[ "${DISTRO}" = "Lakka" ] && PKG_ARCH+=" aarch64" || true PKG_LICENSE="BSD-3/custom" PKG_SITE="https://github.com/raspberrypi/rpi-eeprom" PKG_URL="https://github.com/raspberrypi/rpi-eeprom/archive/${PKG_VERSION}.tar.gz" diff --git a/pkg_all.sh b/pkg_all.sh index b8985e5bd4..5e082f523c 100755 --- a/pkg_all.sh +++ b/pkg_all.sh @@ -55,6 +55,7 @@ targets="\ RPi|GPICase|arm| \ RPi|RPi|arm| \ RPi|RPi2|arm| \ + RPi|RPi4|aarch64| \ RPi|RPi4|arm| \ " diff --git a/projects/RPi/options b/projects/RPi/options index fb3a3e4c2d..e9be124de8 100644 --- a/projects/RPi/options +++ b/projects/RPi/options @@ -39,15 +39,28 @@ VULKAN="vulkan-tools" fi fi + + # Kernel target + KERNEL_TARGET="zImage" + ;; + aarch64) + if [ "${DISTRO}" != "Lakka" ]; then + echo "${DEVICE} ${ARCH} not supported on ${DISTRO}!" + exit 1 + fi + if [ "${DEVICE}" = "RPi4" ]; then + TARGET_CPU="cortex-a72" + TARGET_CPU_FLAGS="+crc" + TARGET_FPU="neon-fp-armv8" + fi + TARGET_FLOAT="hard" + KERNEL_TARGET="Image" ;; esac # Bootloader to use (bcm2835-bootloader) BOOTLOADER="bcm2835-bootloader" - # Kernel target - KERNEL_TARGET="zImage" - # Additional kernel make parameters (for example to specify the u-boot loadaddress) KERNEL_MAKE_EXTRACMD="dtbs" diff --git a/scripts/mkimage b/scripts/mkimage index 9a1df526e3..35e5b4377b 100755 --- a/scripts/mkimage +++ b/scripts/mkimage @@ -231,6 +231,7 @@ EOF mcopy "${RELEASE_DIR}/3rdparty/bootloader/bootcode.bin" :: mcopy "${RELEASE_DIR}/3rdparty/bootloader/fixup.dat" :: + mcopy "${RELEASE_DIR}/3rdparty/bootloader/fixup4.dat" :: mcopy "${RELEASE_DIR}/3rdparty/bootloader/start.elf" :: mcopy "${RELEASE_DIR}/3rdparty/bootloader/config.txt" :: mcopy "${RELEASE_DIR}/3rdparty/bootloader/distroconfig.txt" ::