mt7988 does not have this issue
code looks similar and effects are too…sigsev on userspace, but i still have them (have ported the change to mt7988 too) on r4…details in the PM thread
oh. I mean there’s no such issue on mtk sdk with kernel 5.4. Not sure for other kernels.
I found that mt7988a.dtsi in openwrt still uses 0x30000 for bl31. That’s out of date:
In contrast, I’ve already changed this in mtk sdk in March this year: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/refs/heads/master/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988.dtsi#313
/* 320 KiB reserved for ARM Trusted Firmware (BL31 + BL32) */
secmon_reserved: secmon@43000000 {
reg = <0 0x43000000 0 0x50000>;
no-map;
};
I use mainline linux but the node is same (if this is wrong we should change it asap)
I don’t think that will cause the sigsevs as the range is before my kernel loadaddress (0x44000000),but i don’t know where kernel unpacks my initrd.
But i can increase size for testing…oh, seems it fixes the sigsevs…such small part of mem causes such big problems
Have not got sdk working with mmc dts, only nand is available for build.
The kernel simply wants to use that RAM for allocation to kernel and userspace at runtime. And that won’t work if everything you write there just “disappears” and all you ever read are 0s.
The mt7988a.dtsi in OpenWrt (which is probably what you copied to your Linux tree, or rather, what Lorenzo copied to his Linux tree where you copied it from) is an older version adapted from MTK SDK. We should just increase the size of the reserved-memory in dts like @hackpascal is suggesting.
Yes,you’re right…makes sense
thought dtsi is already mainline with basics,but it is created by one of the first patches i got from lorenzos tree.
But we should leave the thread for atf/uboot now. Sorry for offtopic.
After internal discussing yesterday, we decide to increase the size of atf reserved-memory to 512KB for all filogic chips.
Ok, I hope we’ll manage to pick up that change in OpenWrt without breaking existing images and devices out there…
Regarding BL32/OP-TEE: Will MediaTek provide patches or a source repository to build OP-TEE? I’m asking because using OP-TEE and fTPM paves the road towards ARM System Ready (ie. standardized UEFI boot), which would obviously be very useful (at least on devices using eMMC/uSD storage) to install and run unmodified general purpose OS (given kernel driver support for the SoC and peripherals is present, of course).
I personally don’t like the UEFI approach to depend on a single DOS/FAT filesystem to load boot artifacts from, uImage.FIT single image would be my preference (as in that way the same image can work on NOR, NAND, eMMC and uSD). However, SystemReady seems to be what industry converges towards, esp. when it comes to white-label hardware.
This is fixed in 2023 version. The R64 reboots ok.
you mean version with mt7988 support? good to know, then i can also switch to new atf-code in my pipeline for all boards
Yup, the version with mt7988 support.
I have forked my ‘enhanced’ ATF also from the mtksoc-20230724
branch now, since the mt7622 code has the bug removed.
You can find it in my wip
branch, it is also ready for R4, which should work , but is untested. R4 is in transit
Thanks to the apsoc_common
code, now I only have 4 commits on top of the original code.
Imho soc bootrom only supports spi and mmc,but after uboot is loaded you can load kernel+rootfs from usb
Having it on uboot would be already nice, but I’d argue that even in the bootrom it could be a boon for recovery on designs such as the r3-mini.
Hi,
i tried the new way for creating the gpt on emmc (works on sdmmc without problems) on bpi-r3.
emmc-boot does not find fip partition, but it is there
EC: 0000 0000 [2000]
BL2: v2.9(release):v2.9.0-349-g55576307fd8c emmc
ERROR: Partition 'fip' not found
ERROR: FIP boot source initialization failed with -2
when i boot from nand and boot kernel+initrd and run parted on the emmc i see this:
# parted /dev/mmcblk0
GNU Parted 3.3
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: MMC 008GB0 (sd/mmc)
Disk /dev/mmcblk0: 7818MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
2 4194kB 4719kB 524kB u-boot-env
3 4719kB 6816kB 2097kB factory
4 6816kB 8913kB 2097kB fip
5 8913kB 114MB 105MB fat16 boot
6 114MB 6556MB 6442MB ext4 rootfs
(parted)
so it looks right for me…do you have any idea?
this is how i built the partition table:
device=emmc does create a partition with label gpt instead of the bl2 partition
if i flash the older gpt image (generated by the python2-tool) fip partition is found, but if i then try parted, i get the error that main gpt is corrupt
# parted /dev/mmcblk0
GNU Parted 3.5
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Error: The primary GPT table is corrupt, but the backup appears OK, so that will
be used.
OK/Cancel?
do i miss anything when creating the partition with sgdisk?
Atf code for finding fip partition seems completely common for sd+emmc so i wonder why sd works and emmc not. I see there is a dump function…can i simply trigger it with increasing loglevel on compile? @ericwoud do you tried emmc on r3 yet and can help to debug this?
I have started on emmc many times, but it was version v2.8.
I remember, for R3 v2.8 used fixed ‘fip’ partition and did not search for partition name on R3. it was different from the R64, which did use the partlabel.
I changed that in my own fork of v2.8, to also use partlabel.
v2.9 is is common code, all model search fip partition.
This is how I create the gpt:
I have changed the name ‘fip’ to ‘bpir3-emmc-fip’ also in atf code, and it finds it ok.
is this your emmc-partition table? looks like the sdmmc one with bootable bl2 as first one…
i made for emmc the gpt-part instead based on the partition sheme i got in an older atf version, but my last misses this first one completely and causes different numbering (so boot and root-partition number do not match same on sdmmc)
but it looks like this first one breaks, see top-commit message
I use the same partition layout, sdmmc and emmc. I also use a trick on R3 so I do not have to use mmcblk0boot0. I already did on R64, but that trick did not work on R3, so I have another one. But it also works using mmcblk0boot0.
On R3mini the trick probably won’t work, so probably need to use mmcblk0boot0.
But if in your case parted complains about corrupt got table, then maybe this is why atf will also not be able to use it …
the old gpt img file works in gpt but also complains the gpt error which cannot be fixed (wants to use the backup-gpt which is the “fixed” from my image)…i cannot fix/print the partition from the old gpt.img (generated by the python2 script)
it looks like the first partition (from offset 0 with label gpt) breaks the verify-function in bl2…i try to remove it and add bl2-partition like i do for sdmmc…
I di not see you use sgdisk to create a partition with label got…