aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJybz <j.biernacki@free.fr>2023-08-26 16:21:11 +0200
committerJybz <j.biernacki@free.fr>2023-08-26 16:21:11 +0200
commita3b81566b3b730e0a3bc3e768a40498b230bf524 (patch)
tree2e3c33db3569a850f6891ed6f4c8205fd23e0ee0
parent48cc20fa0f1ca83f26577df702ed64beeb1d3b32 (diff)
downloadmageia4arm-a3b81566b3b730e0a3bc3e768a40498b230bf524.tar
mageia4arm-a3b81566b3b730e0a3bc3e768a40498b230bf524.tar.gz
mageia4arm-a3b81566b3b730e0a3bc3e768a40498b230bf524.tar.bz2
mageia4arm-a3b81566b3b730e0a3bc3e768a40498b230bf524.tar.xz
mageia4arm-a3b81566b3b730e0a3bc3e768a40498b230bf524.zip
Chore: rework rpi script
using upstream dtb setting u-boot env for memory error and skipping preboot snifing usb
-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.cfg42
-rw-r--r--platforms/rpi-aarch64/second_stage_install.sh31
-rwxr-xr-xplatforms/rpi-aarch64/specialFunctions.sh19
7 files changed, 30 insertions, 140 deletions
diff --git a/platforms/rpi-aarch64/boot/EFI/BOOT/grub.cfg b/platforms/rpi-aarch64/boot/EFI/BOOT/grub.cfg
deleted file mode 100755
index a72d635..0000000
--- a/platforms/rpi-aarch64/boot/EFI/BOOT/grub.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-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
deleted file mode 100755
index 9ba1d14..0000000
--- a/platforms/rpi-aarch64/boot/config.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-# 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
deleted file mode 100755
index f4db51f..0000000
--- a/platforms/rpi-aarch64/boot/startup.nsh
+++ /dev/null
@@ -1 +0,0 @@
-bootaa64
diff --git a/platforms/rpi-aarch64/boot/ubootconfig.txt b/platforms/rpi-aarch64/boot/ubootconfig.txt
deleted file mode 100755
index 9770251..0000000
--- a/platforms/rpi-aarch64/boot/ubootconfig.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-# Boot in AArch64 mode
-arm_64bit=1
diff --git a/platforms/rpi-aarch64/mageia4arm.cfg b/platforms/rpi-aarch64/mageia4arm.cfg
index 8c1111d..28b6224 100644
--- a/platforms/rpi-aarch64/mageia4arm.cfg
+++ b/platforms/rpi-aarch64/mageia4arm.cfg
@@ -26,7 +26,7 @@ TARGET="rpi-aarch64"
# #MIRROR="/mnt/STOCK/mageia/distrib/$MAGEIA_VERSION/$ARM_VERSION"
MIRROR_ROOT=http://ftp.free.fr/mirrors/mageia.org/distrib
MIRROR_REPO="${MIRROR_ROOT}/${MAGEIA_VERSION}/${ARM_VERSION}"
-MIRROR=${MIRROR:="${MIRROR_REPO}"}
+#MIRROR=${MIRROR:="${MIRROR_REPO}"}
#Default user
# ID_USER="pi"
@@ -47,46 +47,6 @@ BOOT_ARGS='dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console
#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"
-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
index 88125ae..5d3f165 100644
--- a/platforms/rpi-aarch64/second_stage_install.sh
+++ b/platforms/rpi-aarch64/second_stage_install.sh
@@ -19,12 +19,18 @@
export ARCH=arm64
+# remove the warning:
+# 186/194: lockdev warning: group lock does not exist - using root
+# #############################################
+groupadd -r lock
+
/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
+<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 u-boot-tools
+
#For the wifi :
/sbin/urpmi.update "Nonfree Release"
@@ -32,12 +38,29 @@ export ARCH=arm64
<INSTALL_EXEC> --media "Nonfree Release,Nonfree Updates" -a --fuzzy kernel-firmware-nonfree
<INSTALL_EXEC> --media "Nonfree Release,Nonfree Updates" raspberrypi-firmware
-/usr/bin/sed -i -e 's/GRUB_CMDLINE_LINUX_DEFAULT="\(.*\)"/GRUB_CMDLINE_LINUX_DEFAULT="\1 audit=0"/' /etc/default/grub
+/usr/bin/sed -i -e '/GRUB_CMDLINE_LINUX_DEFAULT/s|"[[:space:]]*$| audit=0"|' /etc/default/grub
+
+echo \
+"# Configuration file for fw_(printenv/setenv) utility.
+# Up to two entries are valid, in this case the redundant
+# environment sector is assumed present.
+# MTD device name Device offset Env. size Flash sector size
+/boot/EFI/uboot.env 0x0000 0x4000" > /etc/fw_env.config
+
+sed -e 's|preboot=.*$|preboot=|' \
+ -e 's|kernel_addr_r=.*$|kernel_addr_r=0x00001000|' \
+ /usr/lib/u-boot/rpi_arm64/default_env.txt \
+ | mkenvimage -s $((0x4000)) -o /boot/EFI/uboot.env -
+
+cp /usr/lib/u-boot/rpi_arm64/u-boot.bin /boot/EFI/u-boot.bin
-mv /etc/grub.d/30_os-prober /tmp
+# permanently disable access to u-boot from grub, not working and not required.
+chmod -x /etc/grub.d/30_uefi-firmware
+# disable osprober because it finds and embedded the BuildSystem OS into the image.
+chmod -x /etc/grub.d/30_os-prober
/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg
/usr/sbin/grub2-install --skip-fs-probe --target=arm64-efi --efi-directory=/boot/EFI --removable --no-nvram --force-file-id
-mv /tmp/30_os-prober /etc/grub.d/
+chmod +x /etc/grub.d/30_os-prober
/usr/bin/chown :chrony -R /etc/chrony.keys /var/log/chrony
/usr/bin/chown :daemon /etc/wpa_supplicant.conf
diff --git a/platforms/rpi-aarch64/specialFunctions.sh b/platforms/rpi-aarch64/specialFunctions.sh
index 8209db3..f81a273 100755
--- a/platforms/rpi-aarch64/specialFunctions.sh
+++ b/platforms/rpi-aarch64/specialFunctions.sh
@@ -50,22 +50,7 @@ function bunrningBootloader()
function copyingCustomSystem()
{
print_info "copying firmware to ${BOOT}"
- cp -v --preserve=mode "${BUILD_PATH}/boot/start"* "${BOOT}/"
- cp -v --preserve=mode "${BUILD_PATH}/boot/fixup"* "${BOOT}/"
- cp -v --preserve=mode "${BUILD_PATH}/boot/bootcode.bin"* "${BOOT}/"
-
- print_info "copying u-boot binary to ${BOOT}"
- cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/${U_BOOT}/u-boot.bin" "${BOOT}/"
-
- print_info "copying boot files to ${BOOT}"
- #As there is no ownership in FAT FS.
- cp -av --no-preserve=ownership ${CONFIG_PATH}/boot/* "${BOOT}/"
-
- print_info "copying dtb files to ${BOOT}"
- cp -v --preserve=mode "${BUILD_PATH}/boot/"*.dtb "${BOOT}/"
-# for f in ${DTB}; do
-# cp --preserve=mode ${BUILD_PATH}/usr/lib64/linux-*/${f} "${BOOT}/"
-# done
-
+ find "${BUILD_PATH}/boot/" -maxdepth 1 -regex '.*\.\(elf\|dat\|bin\|txt\|env\|dtb\)' -exec cp {} "${BOOT}/" ';'
+ cp -r "${BUILD_PATH}/boot/overlays" "${BOOT}/overlays"
return 0
}