I want to build custom image for BPI-R64, probably with upstream U-Boot (I see that upstream has mt7622_rfb_defconfig (64-bit?)) and definitelly with upstream Linux, however I can’t find good description of how MediaTek MT7622 boots from sd card, so I have several question, mostly about U-Boot, because I cant even load U-Boot now)
Does MT7623N from BPI-R2 have the same boot sequence as MT7622 from BPI-R64?
Whether upstream U-Boot with config mt7622_rfb_defconfig could load upstream kernel for BPI-R64? Is it 32bit or 64bit U-Boot config? What is the difference between u-boot-mtk.bin and u-boot.bin
What is the easiest way to load upstream U-Boot from SD card in 64 bit mode?
What happens when BPI-R64 powers up with SW1 in position 1? According to official BSP It tries to load first stage loader starting from 2048 byte on SD card (in case of official BSP it is some prebuild binary preloader_bpi-r64_forsdcard-2k.img), which will load ATF (also prebuild BPI-R64-atf.img, and it is secret for me what id does), which, in turn, load U-Boot built from u-boot-mt, and this U-Boot loads Kernel. However, alternative way to load is to use modified upstream ATF from https://github.com/frank-w/BPI-R64-ATF repo, and in this case it seems mt7622 load first stage loader from offset 0x80000 or 524288 byte. That’s really strange.
New bootchain uses opensource atf (my repo is not modified,i have only added some documentation and build-script to create and arrange the binaries.
No, it has different offsets,using other binaries
Mainline only supports 64bit uboot.only my repo can build 32bit uboot (for old bootchain).new bootchain uses 64bit uboot packed with part of ATF into a fip image.
Build your u-boot.bin and copy it into cloned version of my atf repo (replacing my u-boot.bin). Then create the fip with my build.sh and flash it to an sdcard (block offset 0x800/2048). My build.sh can create the complete bootchain with gpt. So this is the easiest start (except using my image and replace the parts you want).
Now I’m faced with problem that MT7531 didn’t work: there is no cairrier on wan interface with cable plugged in. At the same time MT7531 works fine with official image or image built by frank. First I thought that problem with mainline kernel, but it seems that even kernel from frank’s repo https://github.com/frank-w/BPI-R2-4.14/tree/5.10-main has same issue, when I’m building it.
I’m doing following commands to build kernel & install rootfs:
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make mt7622_bpi-r64_defconfig
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make Image dtbs modules
cp linux/arch/arm64/boot/Image /mnt/boot/
cp linux/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dtb /mnt/boot/
debootstrap --arch arm64 stable /mnt/root http://deb.debian.org/debian/
ARCH=arm64 make INSTALL_MOD_PATH=/mnt/root modules_install
mkdir -p /mnt/root/lib/firmware/mediatek
cp utils/firmware/mediatek/mt7622* /mnt/root/firmware/mediatek/
Maybe I’m doing something wrong and forget some important steps?