MMC=/dev/mmcblk0

git clone https://github.com/smaeul/sun20i_d1_spl -b mainline
pushd sun20i_d1_spl
make $NUMJOBS p=sun20iw1p1 mmc
dd if=nboot/boot0_sdcard_sun20iw1p1.bin of=$MMC bs=8192 seek=1  # Primary location, incompatible with GPT
dd if=nboot/boot0_sdcard_sun20iw1p1.bin of=$MMC bs=8192 seek=16 # Backup location
popd

git clone https://github.com/smaeul/opensbi -b d1-wip
pushd opensbi
PLATFORM=generic FW_PIC=y make $NUMJOBS
popd

git clone https://github.com/smaeul/u-boot -b d1-wip
pushd u-boot
make $NUMJOBS nezha_defconfig
make $NUMJOBS
ln -sf ../toc1.cfg .
tools/mkimage -T sunxi_toc1 -d toc1.cfg u-boot.toc1
dd if=u-boot.toc1 of=$MMC bs=512 seek=32800
dd if=u-boot.toc1 of=$MMC bs=512 seek=24576
popd

git clone https://github.com/smaeul/linux -b d1-wip


