Hi guys,
First of all thank you for all the answers
@ericwoud I followed what you wrote and something worked though not everything:
export device=/dev/mmcblk0
wipefs --all --force ${device}
/dev/mmcblk0: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
/dev/mmcblk0: 8 bytes were erased at offset 0x1dc55ffe00 (gpt): 45 46 49 20 50 41 52 54
/dev/mmcblk0: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
parted -s -- ${device} unit MiB \
mklabel gpt \
mkpart primary 34s 1 \
mkpart primary 1 128 \
mkpart primary 128 100% \
set 1 legacy_boot on \
set 2 boot on \
name 1 bpir3-sdmmc-atf \
name 2 bpir3-sdmmc-boot \
name 3 bpir3-sdmmc-root \
print
Warning: The resulting partition is not properly aligned for best performance: 34s % 2048s != 0s
Model: SD SE128 (sd/mmc)
Disk /dev/mmcblk0: 121942MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 0.02MiB 1.00MiB 0.98MiB bpir3-sdmmc-atf legacy_boot
2 1.00MiB 128MiB 127MiB bpir3-sdmmc-boot boot, esp
3 128MiB 121941MiB 121813MiB bpir3-sdmmc-root
sudo dd if=boot/bpir3-atf-sdmmc-atf.bin of=/dev/mmcblk0p1
447+1 records in
447+1 records out
229209 bytes (229 kB, 224 KiB) copied, 0.100459 s, 2.3 MB/s
sudo mkfs.vfat -v -F 32 -S 512 -s 16 -n "BPIR3-BOOT" /dev/mmcblk0p2 13:12:38
mkfs.fat 4.2 (2021-01-31)
WARNING: Number of clusters for 32 bit FAT is less then suggested minimum.
/dev/mmcblk0p2 has 4 heads and 16 sectors per track,
hidden sectors 0x0800;
logical sector size is 512,
using 0xf8 media descriptor, with 260096 sectors;
drive number 0x80;
filesystem has 2 32-bit FATs and 16 sectors per cluster.
FAT size is 128 sectors, and provides 16238 clusters.
There are 32 reserved sectors.
Volume ID is 0aab83df, volume label BPIR3-BOOT.
sudo mount /dev/mmcblk0p2 /mnt/disk
cd /mnt/disk/bootcfg
echo -n "/boot/Image" >./linux
echo -n "root=PARTLABEL=bpir3-sdmmc-root console=ttyS0,115200 debug=7 rw rootwait audit=0" >./cmdline
echo -n "/boot/initramfs-linux-bpir64-git.img") >./initrd
echo -n "/boot/dtbs/mt7986a-bananapi-bpi-r3.dtb" >./atfdtb
echo -n "DUMMYBYT" > /mnt/disk/initramfs-linux-bpir64-git.img
cp boot/u-boot-bpir3.bin /mnt/disk
Use excactly that name and it will be loaded without furter configuration of atf.
I wasn’t sure which name so I put it twice there
.
├── bootcfg
│ ├── atfdtb
│ ├── cmdline
│ ├── initrd
│ └── linux
├── initramfs-linux-bpir64-git.img
├── u-boot.bin
└── u-boot-bpir3.bin
Then I downloaded linux-bpir64-git-6.2.15.bpi-1-aarch64.pkg.tar.xz
, extracted and copied all the files to the partition2 (using cp -RL
to resolve all the symlinks).
ls -la /mnt/disk/
.rwxr-xr-x 12k root 13 May 13:29 .BUILDINFO
.rwxr-xr-x 303 root 13 May 13:28 .INSTALL
.rwxr-xr-x 32k root 13 May 13:29 .MTREE
.rwxr-xr-x 645 root 13 May 13:29 .PKGINFO
drwxr-xr-x - root 13 May 13:26 boot
drwxr-xr-x - root 13 May 13:25 bootcfg
drwxr-xr-x - root 13 May 13:26 etc
.rwxr-xr-x 8 root 13 May 13:17 initramfs-linux-bpir64-git.img
.rwxr-xr-x 465k root 13 May 13:22 u-boot-bpir3.bin
.rwxr-xr-x 465k root 13 May 13:22 u-boot.bin
drwxr-xr-x - root 13 May 13:26 usr
> sudo mkfs.vfat -v -F 32 -S 512 -s 16 -n "rootfs" /dev/mmcblk0p3
mkfs.fat 4.2 (2021-01-31)
mkfs.fat: Warning: lowercase labels might not work properly on some systems
/dev/mmcblk0p3 has 4 heads and 16 sectors per track,
hidden sectors 0x40000;
logical sector size is 512,
using 0xf8 media descriptor, with 249473024 sectors;
drive number 0x80;
filesystem has 2 32-bit FATs and 16 sectors per cluster.
FAT size is 121696 sectors, and provides 15576850 clusters.
There are 32 reserved sectors.
Volume ID is 8793d905, volume label rootfs.
Then I mounted nix-sd-image into a loop device and copied content of rootfs partition into /dev/mmclblk0p3
After putting the card into bananaPI I got:
MT7986>
F0: 102B 0000
FA: 1040 0000
FA: 1040 0000 [0200]
F9: 103F 0000
F3: 1001 0000 [0200]
F3: 1001 0000
F6: 300C 0028
F5: 0000 0000
V0: 0000 0000 [0001]
00: 0000 0000
BP: 2400 0041 [0000]
G0: 1190 0000
EC: 0000 0000 [3000]
T0: 0000 02B1 [010F]
Jump to BL
NOTICE: BL2: v2.8(release):v2.8-538-g2f158d215-dirty
NOTICE: BL2: Built : 11:26:21, May 9 2023
INFO: BL2: Doing platform setup
NOTICE: WDT: disabled
NOTICE: CPU: MT7986 (2000MHz)
NOTICE: EMI: Using DDR4 settings
NOTICE: EMI: Detected DRAM size: 2048MB
NOTICE: EMI: complex R/W mem test passed
INFO: MediaTek MMC/SD Card Controller ver 20200520, eco 0
INFO: Located GPT partition 'fip/fat' at 0x100000, size 0x7f00000
INFO: BL2: Loading image id 3
INFO: Reading filename from bootcfg/bl31
WARNING: fat_file_open: failed opening bootcfg/bl31
WARNING: Failed to access image id=3 (-2)
INFO: Image id=3 copied: 0x43001000 - 0x43009061
INFO: BL2: Loading image id 5
INFO: Opened u-boot.bin
INFO: Loading image id=5 at address 0x44000000
INFO: Image id=5 loaded: 0x44000000 - 0x44071778
INFO: BL2: Loading image id 22
INFO: Loaded BL33 image is not linux kernel image, not loading DTB/INITRD
INFO: BL2: Loading image id 27
INFO: Loaded BL33 image is not linux kernel image, not loading DTB/INITRD
NOTICE: BL2: Booting BL31
INFO: Entry point address = 0x43001000
INFO: SPSR = 0x3cd
INFO: Total CPU count: 4
INFO: MCUSYS: Disable 512KB L2C shared SRAM
INFO: GICv3 without legacy support detected.
INFO: ARM GICv3 driver initialized in EL3
INFO: Maximum SPI INTID supported: 671
INFO: SPMC: Changed to SPMC mode
NOTICE: BL31: v2.8(release):v2.8-538-g2f158d215-dirty
NOTICE: BL31: Built : 11:26:21, May 9 2023
INFO: [MPU](Region0)sa:0x0300, ea:0x0302
INFO: [MPU](Region0)apc0:0x80b6db69, apc1:0x00b6db6d
INFO: [MPU](Region1)sa:0x0000, ea:0x0000
INFO: [MPU](Region1)apc0:0x00000000, apc1:0x00000000
INFO: [MPU](Region2)sa:0x0000, ea:0x0000
INFO: [MPU](Region2)apc0:0x00000000, apc1:0x00000000
INFO: [MPU](Region3)sa:0x0000, ea:0x0000
INFO: [MPU](Region3)apc0:0x00000000, apc1:0x00000000
INFO: [DEVAPC] devapc_init done
INFO: BL31: Initializing runtime services
INFO: BL31: Preparing for EL3 exit to normal world
INFO: Entry point address = 0x44000000
INFO: SPSR = 0x3c9
U-Boot 2023.04-dirty (May 09 2023 - 12:27:31 +0000)
CPU: MediaTek MT7986
Model: mt7986-rfb
DRAM: 2 GiB
Core: 38 devices, 14 uclasses, devicetree: separate
MMC: mmc@11230000: 0
Loading Environment from nowhere... OK
In: serial@11002000
Out: serial@11002000
Err: serial@11002000
Net:
Warning: ethernet@15100000 (eth0) using random MAC address - 56:8a:58:5c:9c:c3
eth0: ethernet@15100000
Hit any key to stop autoboot: 0
MMC Device 1 not found
no mmc device at slot 1
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:2...
MT7986>
Any idea where the problem could be?
@frank-w In parallel I would also try to use your approach. I couldn’t figure out how to tell createimg
command to use something else then the loop device, or what to do with that loop device next.
@name_snrl great to hear that I am not alone let me know if you will have any progress with this. Idk but maybe it will be useful for you https://github.com/NixOS/nixpkgs/commit/4f477624428c8907365d4350fafa659ab96bdcfe