void-packages/srcpkgs/pinebookpro-uboot/files/kernel.d/uboot

35 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
kver=${2}
uuid=$(cat /etc/fstab | awk '$2 == "/" { print $1 }' | sed 's/^UUID=//')
dev=$(blkid -U "${uuid}")
partuuid=$(blkid -o value -s PARTUUID "${dev}")
bootpart=$(df -P /boot | tail -1 | awk '{ print $6 }')
bootstrip() {
echo ${1} | sed "s,^${bootpart}/,/,"
}
cat > /boot/boot.txt <<EOF
# MAC address (use spaces instead of colons)
setenv macaddr da 19 c8 7a 6d f4
part uuid \${devtype} \${devnum}:\${bootpart} uuid
setenv bootargs console=ttyS2,1500000 console=tty1 root=PARTUUID=${partuuid} rootwait video=eDP-1:1920x1080@60 loglevel=4
setenv fdtfile rockchip/rk3399-pinebook-pro.dtb
if load \${devtype} \${devnum}:\${bootpart} \${kernel_addr_r} $(bootstrip /boot/vmlinux-${kver}); then
if load \${devtype} \${devnum}:\${bootpart} \${fdt_addr_r} $(bootstrip /boot/dtbs/dtbs-${kver}/\${fdtfile}); then
fdt addr \${fdt_addr_r}
fdt resize
fdt set /ethernet@fe300000 local-mac-address "[\${macaddr}]"
if load \${devtype} \${devnum}:\${bootpart} \${ramdisk_addr_r} $(bootstrip /boot/initramfs-${kver}.img); then
booti \${kernel_addr_r} \${ramdisk_addr_r}:\${filesize} \${fdt_addr_r};
else
booti \${kernel_addr_r} - \${fdt_addr_r};
fi;
fi;
fi
EOF
exec mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d /boot/boot.txt /boot/boot.scr