more progress

This commit is contained in:
Pratham Patel 2023-10-05 05:49:25 +05:30
parent 96db78824f
commit f1321da0b5
No known key found for this signature in database
2 changed files with 48 additions and 45 deletions

View file

@ -1,8 +1,3 @@
# DO NOT EDIT THIS FILE
#
# Please edit /boot/uEnv.txt to set supported parameters
#
setenv load_addr "0x9000000" setenv load_addr "0x9000000"
setenv overlay_error "false" setenv overlay_error "false"
# default values # default values
@ -14,17 +9,19 @@ setenv docker_optimizations "on"
setenv earlycon "off" setenv earlycon "off"
setenvrootdev setenvrootdev
setenvunamer setenvunamer
setenv envfile "${prefix}uEnv.txt-${unamer}"
setenv dtbdir "${prefix}dtb-${unamer}"
echo "Boot script loaded from ${devtype} ${devnum}" echo "Boot script loaded from ${devtype} ${devnum}"
echo "Testing for existence ${devtype} ${devnum} ${prefix}uEnv.txt ..." echo "Testing for existence ${devtype} ${devnum} ${envfile} ..."
if test -e ${devtype} ${devnum} ${prefix}uEnv.txt; then if test -e ${devtype} ${devnum} ${envfile}; then
echo "Found ${devtype} ${devnum} ${prefix}uEnv.txt - loading ${devtype} ${devnum} ${load_addr} ${prefix}uEnv.txt ..." echo "Loading ${devtype} ${devnum} ${load_addr} ${envfile} ..."
load ${devtype} ${devnum} ${load_addr} ${prefix}uEnv.txt load ${devtype} ${devnum} ${load_addr} ${envfile}
echo "Loaded environment from ${devtype} ${devnum} ${prefix}uEnv.txt into ${load_addr} filesize ${filesize}..." echo "Loaded ${devtype} ${devnum} ${envfile} into ${load_addr} filesize ${filesize}..."
echo "Importing into environment ..." echo "Importing into environment ..."
env import -t ${load_addr} ${filesize} env import -t ${load_addr} ${filesize}
echo "uEnv.txt imported into environment" echo "${envfile} imported into environment"
fi fi
if test "${logo}" = "disabled"; then setenv logo "logo.nologo"; fi if test "${logo}" = "disabled"; then setenv logo "logo.nologo"; fi
@ -45,17 +42,17 @@ setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} ${consoleargs
if test "${docker_optimizations}" = "on"; then setenv bootargs "${bootargs} cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1"; fi 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} ${ramdisk_addr_r} ${prefix}uInitrd-${unamer}
load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}Image load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}vmlinuz-${unamer}
load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile} load ${devtype} ${devnum} ${fdt_addr_r} ${dtbdir}/${fdtfile}
fdt addr ${fdt_addr_r} fdt addr ${fdt_addr_r}
fdt resize 65536 fdt resize 65536
for overlay_file in ${overlays}; do for overlay_file in ${overlays}; do
if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_prefix}-${overlay_file}.dtbo; then if load ${devtype} ${devnum} ${load_addr} ${dtbdir}/rockchip/overlay/${overlay_prefix}-${overlay_file}.dtbo; then
echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo" echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo"
fdt apply ${load_addr} || setenv overlay_error "true" fdt apply ${load_addr} || setenv overlay_error "true"
elif load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_file}.dtbo; then elif load ${devtype} ${devnum} ${load_addr} ${dtbdir}/rockchip/overlay/${overlay_file}.dtbo; then
echo "Applying kernel provided DT overlay ${overlay_file}.dtbo" echo "Applying kernel provided DT overlay ${overlay_file}.dtbo"
fdt apply ${load_addr} || setenv overlay_error "true" fdt apply ${load_addr} || setenv overlay_error "true"
fi fi
@ -68,9 +65,9 @@ for overlay_file in ${user_overlays}; do
done done
if test "${overlay_error}" = "true"; then if test "${overlay_error}" = "true"; then
echo "Error applying DT overlays, restoring original DT" echo "Error applying DT overlays, restoring original DT"
load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile} load ${devtype} ${devnum} ${fdt_addr_r} ${dtbdir}/${fdtfile}
else else
if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_prefix}-fixup.scr; then if load ${devtype} ${devnum} ${load_addr} ${dtbdir}/rockchip/overlay/${overlay_prefix}-fixup.scr; then
echo "Applying kernel provided DT fixup script (${overlay_prefix}-fixup.scr)" echo "Applying kernel provided DT fixup script (${overlay_prefix}-fixup.scr)"
source ${load_addr} source ${load_addr}
fi fi
@ -82,6 +79,3 @@ else
fi fi
kaslrseed kaslrseed
booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} 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

View file

@ -23,14 +23,16 @@ echo "Nothing to prepare"
echo "Nothing to build" echo "Nothing to build"
%install %install
cp ${SOURCE0} $RPM_BUILD_ROOT/boot/efi/boot.cmd-%{full_ver} cp ${SOURCE0} $RPM_BUILD_ROOT/boot/efi/boot.cmd
cp ${SOURCE1} $RPM_BUILD_ROOT/boot/efi/uEnv.txt-%{full_ver} cp ${SOURCE1} $RPM_BUILD_ROOT/boot/efi/uEnv.txt
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%post %post
set -xeuf -o pipefail set -xeuf -o pipefail
cp /boot/efi/boot.cmd /boot/efi/boot.cmd-%{full_ver}
cp /boot/efi/uEnv.txt /boot/efi/uEnv.txt-%{full_ver}
if [ -f /boot/.uname ]; then if [ -f /boot/.uname ]; then
UNAME_R=$(</boot/.uname) UNAME_R=$(</boot/.uname)
BOOT_PART=$(grep '/ ' /etc/fstab | awk '{print $1}') BOOT_PART=$(grep '/ ' /etc/fstab | awk '{print $1}')
@ -41,5 +43,12 @@ if [ -f /boot/.uname ]; then
else else
echo "ERROR: No /boot/.uname found to extract 'uname -r' from." echo "ERROR: No /boot/.uname found to extract 'uname -r' from."
fi fi
mkimage -C none -A arm -T script -d /boot/efi/boot.cmd-%{full_ver} /boot/efi/boot.scr-%{full_ver} mkimage -C none -A arm -T script -d /boot/efi/boot.cmd-%{full_ver} /boot/efi/boot.scr-%{full_ver}
cp /boot/boot.scr-%{full_ver} /boot/efi/boot.scr cp /boot/boot.scr-%{full_ver} /boot/efi/boot.scr
mkimage -A arm -T ramdisk -C none -n uInitrd -d /boot/initramfs-${UNAME_R}.img /boot/uInitrd-${UNAME_R}
cp /boot/uInitrd-${UNAME_R} /boot/uInitrd
diff /boot/efi/boot.cmd /boot/efi/boot.cmd-%{full_ver} > /boot/diff_boot_cmd
diff /boot/efi/uEnv.txt /boot/efi/uEnv.txt-%{full_ver} > /boot/diff_uenv_txt