83 lines
2.2 KiB
Plaintext
83 lines
2.2 KiB
Plaintext
BOOTSOURCE='https://github.com/rafaello7/u-boot-nanopi-m3'
|
|
BOOTBRANCH='branch:master'
|
|
BOOTDIR='u-boot-s5p6818'
|
|
BOOTSCRIPT='boot-s5p6818.cmd:boot.cmd'
|
|
BOOTENV_FILE='s5p6818-default.txt'
|
|
|
|
UBOOT_TARGET_MAP=";;boot.img bootemmc.img"
|
|
|
|
UBOOT_USE_GCC='> 6.3'
|
|
UBOOT_COMPILER='aarch64-linux-gnu-'
|
|
SERIALCON="ttySAC0,ttyGS0"
|
|
|
|
case $BRANCH in
|
|
next)
|
|
|
|
KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
|
|
KERNELBRANCH='branch:linux-4.14.y'
|
|
KERNELDIR=$MAINLINE_KERNEL_DIR
|
|
KERNEL_USE_GCC='> 7.0'
|
|
|
|
;;
|
|
esac
|
|
|
|
ARCH=arm64
|
|
KERNEL_IMAGE_TYPE=Image
|
|
|
|
KERNEL_USE_GCC='< 5.0'
|
|
|
|
CAN_BUILD_STRETCH=yes
|
|
|
|
GOVERNOR=ondemand
|
|
|
|
write_uboot_platform()
|
|
{
|
|
if [[ "$2" != /dev/mmcblk0 ]]; then
|
|
dd if=$1/boot.img of=$2 seek=1 status=noxfer > /dev/null 2>&1
|
|
else
|
|
dd if=$1/bootemmc.img of=$2 seek=1 status=noxfer > /dev/null 2>&1
|
|
fi
|
|
}
|
|
|
|
uboot_custom_postprocess()
|
|
{
|
|
# 2GB differnt bl1 https://github.com/friendlyarm/linux-3.4.y/issues/3#issuecomment-387214487
|
|
if [[ $BOARD == nanopct3plus ]]; then
|
|
cp $SRC/packages/blobs/nanopi/2g-bl1-nanopi.bin boot.img
|
|
else
|
|
cp $SRC/packages/blobs/nanopi/1g-bl1-nanopi.bin boot.img
|
|
fi
|
|
i=0
|
|
merge=""
|
|
while [ $i -lt 512 ]; do
|
|
val="00000000"; \
|
|
[ $i -eq 68 ] && val="00060000" # 0x44 load size
|
|
[ $i -eq 72 ] && val="43bffe00" # 0x48 load address
|
|
[ $i -eq 76 ] && val="43c00000" # 0x4c launch address
|
|
[ $i -eq 504 ] && val="68180300" # 0x1f8 version
|
|
[ $i -eq 508 ] && val="4849534E" # 0x1fc "NSIH"
|
|
# put in little endian
|
|
vallo=${val#????}
|
|
valhi=${val%????}
|
|
merge=$merge"${vallo#??}${vallo%??}${valhi#??}${valhi%??}"
|
|
i=$((i+4))
|
|
done
|
|
echo $merge | xxd -r -p | dd of=boot.img seek=63 status=none
|
|
cat u-boot.bin >> boot.img
|
|
cp boot.img bootemmc.img
|
|
printf "\2" | dd of=bootemmc.img bs=1 seek=80 conv=notrunc
|
|
}
|
|
|
|
family_tweaks()
|
|
{
|
|
#echo "#Serial console allow root" >> $SDCARD/etc/securetty
|
|
#echo "ttySAC0" >> $SDCARD/etc/securetty
|
|
|
|
# enable serial gadget on OTG port since regular serial is not soldered on all variants
|
|
if [[ $BOARD != nanopct3plus ]]; then
|
|
mkdir -p $SDCARD/etc/systemd/system/serial-getty@ttyGS0.service.d
|
|
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable serial-getty@ttyGS0.service > /dev/null"
|
|
echo "ttyGS0" >> $SDCARD/etc/securetty
|
|
fi
|
|
}
|