From 1b36879da7953c91eaec2fd39b527f76a903c91b Mon Sep 17 00:00:00 2001 From: Pratham Patel Date: Thu, 5 Oct 2023 05:25:36 +0530 Subject: [PATCH] init commit --- boot.cmd | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++ opi5-efi.spec | 41 ++++++++++++++++++++++++ uEnv.txt | 6 ++++ 3 files changed, 133 insertions(+) create mode 100755 boot.cmd create mode 100644 opi5-efi.spec create mode 100755 uEnv.txt diff --git a/boot.cmd b/boot.cmd new file mode 100755 index 0000000..d1a9922 --- /dev/null +++ b/boot.cmd @@ -0,0 +1,86 @@ +# DO NOT EDIT THIS FILE +# +# Please edit /boot/armbianEnv.txt to set supported parameters +# + +setenv load_addr "0x9000000" +setenv overlay_error "false" +# default values +setenv rootdev "/dev/mmcblk0p1" +setenv verbosity "1" +setenv console "both" +setenv bootlogo "false" +setenv rootfstype "ext4" +setenv docker_optimizations "on" +setenv earlycon "off" + +echo "Boot script loaded from ${devtype} ${devnum}" + +echo "Testing for existence ${devtype} ${devnum} ${prefix}armbianEnv.txt ..." +if test -e ${devtype} ${devnum} ${prefix}armbianEnv.txt; then + echo "Found ${devtype} ${devnum} ${prefix}armbianEnv.txt - loading ${devtype} ${devnum} ${load_addr} ${prefix}armbianEnv.txt ..." + load ${devtype} ${devnum} ${load_addr} ${prefix}armbianEnv.txt + echo "Loaded environment from ${devtype} ${devnum} ${prefix}armbianEnv.txt into ${load_addr} filesize ${filesize}..." + echo "Importing into environment ..." + env import -t ${load_addr} ${filesize} + echo "armbianEnv.txt imported into environment" +fi + +if test "${logo}" = "disabled"; then setenv logo "logo.nologo"; fi + +if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=tty1"; fi +if test "${console}" = "serial" || test "${console}" = "both"; then setenv consoleargs "console=ttyS2,1500000 ${consoleargs}"; fi +if test "${earlycon}" = "on"; then setenv consoleargs "earlycon ${consoleargs}"; fi +if test "${bootlogo}" = "true"; then + setenv consoleargs "splash plymouth.ignore-serial-consoles ${consoleargs}" +else + setenv consoleargs "splash=verbose ${consoleargs}" +fi + +# get PARTUUID of first partition on SD/eMMC the boot script was loaded from +if test "${devtype}" = "mmc"; then part uuid mmc ${devnum}:1 partuuid; fi + +setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} ${consoleargs} consoleblank=0 loglevel=${verbosity} ubootpart=${partuuid} usb-storage.quirks=${usbstoragequirks} ${extraargs} ${extraboardargs}" + +if test "${docker_optimizations}" = "on"; then setenv bootargs "${bootargs} cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1"; fi + +load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}uInitrd +load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}Image + +load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile} +fdt addr ${fdt_addr_r} +fdt resize 65536 +for overlay_file in ${overlays}; do + if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_prefix}-${overlay_file}.dtbo; then + echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo" + fdt apply ${load_addr} || setenv overlay_error "true" + elif load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_file}.dtbo; then + echo "Applying kernel provided DT overlay ${overlay_file}.dtbo" + fdt apply ${load_addr} || setenv overlay_error "true" + fi +done +for overlay_file in ${user_overlays}; do + if load ${devtype} ${devnum} ${load_addr} ${prefix}overlay-user/${overlay_file}.dtbo; then + echo "Applying user provided DT overlay ${overlay_file}.dtbo" + fdt apply ${load_addr} || setenv overlay_error "true" + fi +done +if test "${overlay_error}" = "true"; then + echo "Error applying DT overlays, restoring original DT" + load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile} +else + if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_prefix}-fixup.scr; then + echo "Applying kernel provided DT fixup script (${overlay_prefix}-fixup.scr)" + source ${load_addr} + fi + if test -e ${devtype} ${devnum} ${prefix}fixup.scr; then + load ${devtype} ${devnum} ${load_addr} ${prefix}fixup.scr + echo "Applying user provided fixup script (fixup.scr)" + source ${load_addr} + fi +fi +kaslrseed +booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} + +# Recompile with: +# mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr diff --git a/opi5-efi.spec b/opi5-efi.spec new file mode 100644 index 0000000..dabb620 --- /dev/null +++ b/opi5-efi.spec @@ -0,0 +1,41 @@ +# disable the '-debug{info,source}' pkgs +%define debug_package %{nil} +# also disable packaging files in '/usr/lib/.build-id/' +%define _build_id_links none + +Name: opi5-efi +Version: 0.0.1 +Release: %{rel_ver}%{?dist} +Summary: Necessary files for booting from vendor U-Boot on Orange Pi 5 +License: GPL +Provides: %{name}-%{version} +Requires: uboot-tools + +%global full_ver %{version}-%{release} + +Source0: boot.cmd +Source1: uEnv.txt + +%prep +echo "Nothing to prepare" + +%build +echo "Nothing to build" + +%install +cp ${SOURCE0} $RPM_BUILD_ROOT/boot/boot.cmd-%{full_ver} +cp ${SOURCE1} $RPM_BUILD_ROOT/boot/uEnv.txt-%{full_ver} + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +set -xeuf -o pipefail +if [ -f /boot/.uname ]; then + UNAME_R=$(