aboutsummaryrefslogtreecommitdiffstats
path: root/platforms/rpi-aarch64
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2020-11-28 20:11:30 +0000
committerPascal Terjan <pterjan@mageia.org>2020-12-22 13:33:03 +0000
commita045dac36b00e936ce3b6def4556183b6237e65c (patch)
tree9d91e473fcde1e1defb02548d8d4b378b8f2d89c /platforms/rpi-aarch64
parent8a39f1872782d05d9cb26d904131f4063f6a8e53 (diff)
downloadmageia4arm-a045dac36b00e936ce3b6def4556183b6237e65c.tar
mageia4arm-a045dac36b00e936ce3b6def4556183b6237e65c.tar.gz
mageia4arm-a045dac36b00e936ce3b6def4556183b6237e65c.tar.bz2
mageia4arm-a045dac36b00e936ce3b6def4556183b6237e65c.tar.xz
mageia4arm-a045dac36b00e936ce3b6def4556183b6237e65c.zip
Add a generic rpi-aarch64 platform
Diffstat (limited to 'platforms/rpi-aarch64')
-rwxr-xr-xplatforms/rpi-aarch64/boot/EFI/BOOT/bootaa64.efibin0 -> 1382256 bytes
-rwxr-xr-xplatforms/rpi-aarch64/boot/EFI/BOOT/grub.cfg4
-rwxr-xr-xplatforms/rpi-aarch64/boot/config.txt71
-rwxr-xr-xplatforms/rpi-aarch64/boot/startup.nsh1
-rwxr-xr-xplatforms/rpi-aarch64/boot/ubootconfig.txt2
-rw-r--r--platforms/rpi-aarch64/mageia4arm.cfg91
-rw-r--r--platforms/rpi-aarch64/second_stage_install.sh47
-rwxr-xr-xplatforms/rpi-aarch64/specialFunctions.sh69
8 files changed, 285 insertions, 0 deletions
diff --git a/platforms/rpi-aarch64/boot/EFI/BOOT/bootaa64.efi b/platforms/rpi-aarch64/boot/EFI/BOOT/bootaa64.efi
new file mode 100755
index 0000000..b04f373
--- /dev/null
+++ b/platforms/rpi-aarch64/boot/EFI/BOOT/bootaa64.efi
Binary files differ
diff --git a/platforms/rpi-aarch64/boot/EFI/BOOT/grub.cfg b/platforms/rpi-aarch64/boot/EFI/BOOT/grub.cfg
new file mode 100755
index 0000000..a72d635
--- /dev/null
+++ b/platforms/rpi-aarch64/boot/EFI/BOOT/grub.cfg
@@ -0,0 +1,4 @@
+set btrfs_relative_path="yes"
+search --file --set=root /boot/grub2/grub.cfg
+set prefix=($root)/boot/grub2
+configfile ($root)/boot/grub2/grub.cfg
diff --git a/platforms/rpi-aarch64/boot/config.txt b/platforms/rpi-aarch64/boot/config.txt
new file mode 100755
index 0000000..9ba1d14
--- /dev/null
+++ b/platforms/rpi-aarch64/boot/config.txt
@@ -0,0 +1,71 @@
+# Get more options/information on http://elinux.org/RPiconfig
+# or on https://www.raspberrypi.org/documentation/configuration/config-txt.md
+#
+# !!!!! This file will get overwritten by updates. Please use !!!!!
+# !!!!! extraconfig.txt if you want to set additional !!!!!
+# !!!!! configuration options or add dt overlays. !!!!!
+
+# Our kernels are located on a Linux partition. Chainload U-Boot to load them.
+kernel=u-boot.bin
+
+# Use 32 MB for GPU for all RPis (Min 16 - Max 192 MB)
+# We don't need that much memory reserved for it, because we drive most hardware
+# from Linux, not the VPU OS
+gpu_mem=32
+
+# Turbo mode: 0 = enable dynamic freq/voltage - 1 = always max
+force_turbo=0
+# Start in turbo mode for 30 seconds or until cpufreq sets a frequency
+initial_turbo=30
+
+# DO NOT overvoltage manually to not void warranty!
+over_voltage=0
+
+# Fix mini UART input frequency, and setup/enable up the UART.
+enable_uart=1
+
+# Disable warning overlays as they don't work well together with linux's graphical output
+avoid_warnings=1
+
+# This overlay fixes divergences between the RPi device tree and what
+# upstream provides
+dtoverlay=upstream
+
+# overscan is only needed on old TV sets and if analog gear is in the chain (e.g. DPI)
+disable_overscan=1
+
+# u-boot expects RPi's UART to have a compatible string not supported anymore in
+# linux upstream, while this is fixed, make sure the name shows up in the
+# device-tree. This is only needed for RPi, RPi2 and RPi0, but applied
+# generally so as to avoid complexity.
+dtoverlay=uboot-bcm2835-pl011
+
+[pi1]
+
+# Max ARM freq (default 700 MHz)
+arm_freq=840
+
+# Max core (GPU) freq (default 250 MHz)
+core_freq=375
+
+# SDRAM freq (default 400)
+sdram_freq=400
+
+[pi3]
+
+# These are not applied automatically? Needed to use respective upstream drivers.
+dtoverlay=vc4-kms-v3d,cma-default
+dtoverlay=dwc2
+
+[pi4]
+
+dtoverlay=disable-vc4
+
+[all]
+
+# Allow u-boot to set arm_control
+include ubootconfig.txt
+
+# Allow user overrides of config options
+include extraconfig.txt
+
diff --git a/platforms/rpi-aarch64/boot/startup.nsh b/platforms/rpi-aarch64/boot/startup.nsh
new file mode 100755
index 0000000..f4db51f
--- /dev/null
+++ b/platforms/rpi-aarch64/boot/startup.nsh
@@ -0,0 +1 @@
+bootaa64
diff --git a/platforms/rpi-aarch64/boot/ubootconfig.txt b/platforms/rpi-aarch64/boot/ubootconfig.txt
new file mode 100755
index 0000000..9770251
--- /dev/null
+++ b/platforms/rpi-aarch64/boot/ubootconfig.txt
@@ -0,0 +1,2 @@
+# Boot in AArch64 mode
+arm_64bit=1
diff --git a/platforms/rpi-aarch64/mageia4arm.cfg b/platforms/rpi-aarch64/mageia4arm.cfg
new file mode 100644
index 0000000..b862020
--- /dev/null
+++ b/platforms/rpi-aarch64/mageia4arm.cfg
@@ -0,0 +1,91 @@
+
+# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <contact@librepc.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+MAGEIA_VERSION="cauldron"
+ARM_VERSION="aarch64"
+
+#target plateform (xu3-4 or rpi)
+TARGET="rpi-aarch64"
+
+# URL of the Mageia mirror used to install ( see mirrors.mageia.org )
+MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/${MAGEIA_VERSION}/${ARM_VERSION}"
+#MIRROR="/mnt/STOCK/mageia/distrib/$MAGEIA_VERSION/$ARM_VERSION"
+
+#Default user
+# ID_USER="pi"
+# PASSWORD="raspberry"
+
+#root password
+# ROOT_PWD="piroot"
+
+#Hostname
+HOSTNAME="${TARGET}"
+
+#Filesystem of boot partitions (default ext4 raspberry pi need vfat)
+SEPARATE_BOOT_PARTITION=1
+BOOTFS="vfat"
+
+#The arguments for the Kernel
+BOOT_ARGS='dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 rootwait fsck.repair=1 8250.nr_uarts=1 elevator=deadline cma=256M\@512M audit=0'
+
+#Path where the raspberry pi firmware is/will be installed
+FIRMWARE_PATH="$INSTALL_PATH"
+INFORMATION="
+https://elinux.org/RPi_Software
+https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md
+
+https://github.com/raspberrypi/firmware/blob/master/boot/bootcode.bin
+https://github.com/raspberrypi/firmware/blob/master/boot/bcm2710-rpi-3-b-plus.dtb
+
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup.dat
+https://github.com/raspberrypi/firmware/blob/master/boot/start.elf
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup4.dat #Rpi4
+https://github.com/raspberrypi/firmware/blob/master/boot/start4.elf #Rpi4
+
+#Debug (implicitly used with start_debug=1)
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup_db.dat
+https://github.com/raspberrypi/firmware/blob/master/boot/start_db.elf
+https://github.com/raspberrypi/firmware/blob/master/boot/start4db.elf #Rpi4
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup4db.dat #Rpi4
+
+#Low GPU Memory (=16MB)
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup_cd.dat
+https://github.com/raspberrypi/firmware/blob/master/boot/start_cd.elf
+https://github.com/raspberrypi/firmware/blob/master/boot/start4cd.elf #Rpi4
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup4cd.dat #Rpi4
+
+#Testing versions (eXtra features) (like camera module) (implicitly used with start_x=1 ) :
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup_x.dat
+https://github.com/raspberrypi/firmware/blob/master/boot/start_x.elf
+https://github.com/raspberrypi/firmware/blob/master/boot/start4x.elf #Rpi4
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup4x.dat #Rpi4
+"
+
+U_BOOT="rpi_arm64"
+
+DTB="bcm2837-rpi-3-b.dtb bcm2837-rpi-3-a-plus.dtb bcm2837-rpi-3-b.dtb bcm2837-rpi-3-b-plus.dtb bcm2711-rpi-4-b.dtb bcm2837-rpi-cm3-io3.dtb"
+
+FIRMWARE_DOWNLOAD_URL="https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin
+https://github.com/raspberrypi/firmware/raw/master/boot/fixup.dat
+https://github.com/raspberrypi/firmware/raw/master/boot/fixup4.dat
+https://github.com/raspberrypi/firmware/raw/master/boot/start.elf
+https://github.com/raspberrypi/firmware/raw/master/boot/start4.elf
+https://github.com/raspberrypi/firmware/raw/master/boot/fixup_x.dat
+https://github.com/raspberrypi/firmware/raw/master/boot/start_x.elf
+https://github.com/raspberrypi/firmware/raw/master/boot/fixup4x.dat
+https://github.com/raspberrypi/firmware/raw/master/boot/start4x.elf
+"
diff --git a/platforms/rpi-aarch64/second_stage_install.sh b/platforms/rpi-aarch64/second_stage_install.sh
new file mode 100644
index 0000000..8f6a73f
--- /dev/null
+++ b/platforms/rpi-aarch64/second_stage_install.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <contact@librepc.com>
+# Copyright (C) 2019-2020 Jean-Baptiste Biernacki <j.biernacki@free.fr>
+#
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+export ARCH=arm64
+
+/usr/bin/chown :shadow /etc/shadow /etc/gshadow /etc/login.defs /etc/pam.d/chage-chfn-chsh /etc/pam.d/chpasswd-newusers /etc/pam.d/system-auth /etc/pam.d/user-group-mod /bin/passwd /bin/chage
+
+/usr/bin/chown :systemd-journal -R /var/log/journal
+
+#Install all packages you need
+<INSTALL_EXEC> basesystem grub2-efi efibootmgr chrony polkit lockdev rng-tools man openssh-server rfkill wireless-tools bluez wpa_supplicant make rsync binutils ldetect usbutils kernel-desktop-latest u-boot
+
+#For the wifi :
+/sbin/urpmi.update "Nonfree Release"
+/sbin/urpmi.update "Nonfree Updates"
+<INSTALL_EXEC> --media "Nonfree Release" kernel-firmware-nonfree
+<INSTALL_EXEC> --media "Nonfree Updates" kernel-firmware-nonfree
+
+/usr/bin/sed -i -e 's/GRUB_CMDLINE_LINUX_DEFAULT="\(.*\)"/GRUB_CMDLINE_LINUX_DEFAULT="\1 audit=0"/' /etc/default/grub
+
+/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg
+/usr/sbin/grub2-install --skip-fs-probe --target=arm64-efi --efi-directory=/boot/EFI --force --force-file-id
+
+/usr/bin/chown :chrony -R /etc/chrony.keys /var/log/chrony
+/usr/bin/chown :daemon /etc/wpa_supplicant.conf
+/usr/bin/chown :tty /bin/write /bin/wall
+/usr/bin/chown :lock /sbin/lockdev
+/usr/bin/chown :bin /sbin/traceroute
+/usr/bin/chown polkitd /etc/polkit-1/rules.d
+
+## DO NOT EXIT THE SCRIPT. A second part is automatically added in this script during the process in order to create the default user and set root password.
diff --git a/platforms/rpi-aarch64/specialFunctions.sh b/platforms/rpi-aarch64/specialFunctions.sh
new file mode 100755
index 0000000..7cecb75
--- /dev/null
+++ b/platforms/rpi-aarch64/specialFunctions.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <contact@librepc.com>
+# Copyright (C) 2019-2020 Jean-Baptiste Biernacki <j.biernacki@free.fr>
+#
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+SFDISK_SCRIPT=",128M,c,*\n,,L,\nwrite\n"
+
+function preImgCreation()
+{
+
+ title "Download binary blob for Rpi"
+ for i in ${FIRMWARE_DOWNLOAD_URL}; do
+ info "Download ${i}"
+ curl -L -O -J ${i} -s
+ done
+
+ title "Creating Pi image"
+ title "Making raspberry pi image"
+ return 0
+}
+
+function postPrepareChroot()
+{
+ #Nothing to do. (Except replacing default function.)
+ return 0
+}
+
+
+function bunrningBootloader()
+{
+ #Nothing to do. (Except replacing default function.)
+ return 0
+}
+
+
+function copyingCustomSystem()
+{
+ info "copying firmware to ${ARM_BOOT}"
+ cp -v --preserve=mode "${FIRMWARE_PATH}/start"* "${BOOT}/"
+ cp -v --preserve=mode "${FIRMWARE_PATH}/fixup"* "${BOOT}/"
+ cp -v --preserve=mode "${FIRMWARE_PATH}/bootcode.bin"* "${BOOT}/"
+
+ info "copying u-boot binary to ${ARM_BOOT}"
+ cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/${U_BOOT}/u-boot.bin" "${BOOT}/"
+
+ info "copying boot files to ${BOOT}"
+ cp -a ${CONFIG_PATH}/boot/* "${BOOT}/"
+
+ info "copying dtb files to ${BOOT}"
+ for f in ${DTB}; do
+ cp --preserve=mode ${BUILD_PATH}/usr/lib64/linux-*/${f} "${BOOT}/"
+ done
+
+ return 0
+}