On Mon, Jul 24, 2023 at 11:48 AM Da Xue <[email protected]> wrote: > > I forgot to attach some additional details: > > ``` > sudo fdisk -l /dev/sda > Disk /dev/sda: 58.24 GiB, 62534975488 bytes, 122138624 sectors > Disk model: STORAGE DEVICE > Units: sectors of 1 * 512 = 512 bytes > Sector size (logical/physical): 512 bytes / 512 bytes > I/O size (minimum/optimal): 512 bytes / 512 bytes > Disklabel type: dos > Disk identifier: 0x00000000 > > Device Boot Start End Sectors Size Id Type > /dev/sda1 * 2048 524287 522240 255M ef EFI (FAT-12/16/32) > ``` > > The image was generated via buildroot using genimage: > > ``` > image boot.vfat { > vfat { > file EFI/BOOT/BOOTAA64.EFI { > image = "Image" > } > extraargs = "-F32" # tried with and without this flag, > same issue. > } > size = 255M > } > > image sdcard.img { > hdimage { > } > partition bootloader { > in-partition-table = false > offset = 512 > image = "u-boot.bin" > } > partition rootfs { > partition-type = 0xEF > bootable = "true" > image = "boot.vfat" > offset = 1M > } > } > ``` > > bootflow -la without the debug messages: > > ``` > => bootflow scan -la > Scanning for bootflows in all bootdevs > Seq Method State Uclass Part Name Filename > --- ----------- ------ -------- ---- ------------------------ > ---------------- > Scanning global bootmeth 'efi_mgr': > 0 efi_mgr base (none) 0 <NULL> <NULL> > Scanning bootdev '[email protected]': > 1 efi media mmc 0 [email protected] <NULL> > 2 extlinux media mmc 0 [email protected] <NULL> > 3 script media mmc 0 [email protected] <NULL> > Scanning bootdev '[email protected]': > 4 efi media mmc 0 [email protected] <NULL> > 5 extlinux media mmc 0 [email protected] <NULL> > 6 script media mmc 0 [email protected] <NULL> > 7 efi file mmc 1 [email protected]_1 > efi/boot/bootaa64.efi > 8 extlinux fs mmc 1 [email protected]_1 > /boot/extlinux/extlinux.conf > 9 script fs mmc 1 [email protected]_1 > /boot/boot.scr > a efi media mmc 2 [email protected]_2 <NULL> > b extlinux media mmc 2 [email protected]_2 <NULL> > c script media mmc 2 [email protected]_2 <NULL> > d efi media mmc 3 [email protected]_3 <NULL> > e extlinux media mmc 3 [email protected]_3 <NULL> > f script media mmc 3 [email protected]_3 <NULL> > 10 efi media mmc 4 [email protected]_4 <NULL> > 11 extlinux media mmc 4 [email protected]_4 <NULL> > 12 script media mmc 4 [email protected]_4 <NULL> > 13 efi media mmc 5 [email protected]_5 <NULL> > 14 extlinux media mmc 5 [email protected]_5 <NULL> > 15 script media mmc 5 [email protected]_5 <NULL> > 16 efi media mmc 6 [email protected]_6 <NULL> > 17 extlinux media mmc 6 [email protected]_6 <NULL> > 18 script media mmc 6 [email protected]_6 <NULL> > 19 efi media mmc 7 [email protected]_7 <NULL> > 1a extlinux media mmc 7 [email protected]_7 <NULL> > 1b script media mmc 7 [email protected]_7 <NULL> > 1c efi media mmc 8 [email protected]_8 <NULL> > 1d extlinux media mmc 8 [email protected]_8 <NULL> > 1e script media mmc 8 [email protected]_8 <NULL> > 1f efi media mmc 9 [email protected]_9 <NULL> > 20 extlinux media mmc 9 [email protected]_9 <NULL> > 21 script media mmc 9 [email protected]_9 <NULL> > 22 efi media mmc a [email protected]_a <NULL> > 23 extlinux media mmc a [email protected]_a <NULL> > 24 script media mmc a [email protected]_a <NULL> > 25 efi media mmc b [email protected]_b <NULL> > 26 extlinux media mmc b [email protected]_b <NULL> > 27 script media mmc b [email protected]_b <NULL> > 28 efi media mmc c [email protected]_c <NULL> > 29 extlinux media mmc c [email protected]_c <NULL> > 2a script media mmc c [email protected]_c <NULL> > 2b efi media mmc d [email protected]_d <NULL> > 2c extlinux media mmc d [email protected]_d <NULL> > 2d script media mmc d [email protected]_d <NULL> > 2e efi media mmc e [email protected]_e <NULL> > 2f extlinux media mmc e [email protected]_e <NULL> > 30 script media mmc e [email protected]_e <NULL> > 31 efi media mmc f [email protected]_f <NULL> > 32 extlinux media mmc f [email protected]_f <NULL> > 33 script media mmc f [email protected]_f <NULL> > 34 efi media mmc 10 [email protected]_10 <NULL> > 35 extlinux media mmc 10 [email protected]_10 <NULL> > 36 script media mmc 10 [email protected]_10 <NULL> > 37 efi media mmc 11 [email protected]_11 <NULL> > 38 extlinux media mmc 11 [email protected]_11 <NULL> > 39 script media mmc 11 [email protected]_11 <NULL> > 3a efi media mmc 12 [email protected]_12 <NULL> > 3b extlinux media mmc 12 [email protected]_12 <NULL> > 3c script media mmc 12 [email protected]_12 <NULL> > 3d efi media mmc 13 [email protected]_13 <NULL> > 3e extlinux media mmc 13 [email protected]_13 <NULL> > 3f script media mmc 13 [email protected]_13 <NULL> > 40 efi media mmc 14 [email protected]_14 <NULL> > 41 extlinux media mmc 14 [email protected]_14 <NULL> > 42 script media mmc 14 [email protected]_14 <NULL> > 43 efi media mmc 15 [email protected]_15 <NULL> > 44 extlinux media mmc 15 [email protected]_15 <NULL> > 45 script media mmc 15 [email protected]_15 <NULL> > 46 efi media mmc 16 [email protected]_16 <NULL> > 47 extlinux media mmc 16 [email protected]_16 <NULL> > 48 script media mmc 16 [email protected]_16 <NULL> > 49 efi media mmc 17 [email protected]_17 <NULL> > 4a extlinux media mmc 17 [email protected]_17 <NULL> > 4b script media mmc 17 [email protected]_17 <NULL> > 4c efi media mmc 18 [email protected]_18 <NULL> > 4d extlinux media mmc 18 [email protected]_18 <NULL> > 4e script media mmc 18 [email protected]_18 <NULL> > 4f efi media mmc 19 [email protected]_19 <NULL> > 50 extlinux media mmc 19 [email protected]_19 <NULL> > 51 script media mmc 19 [email protected]_19 <NULL> > 52 efi media mmc 1a [email protected]_1a <NULL> > 53 extlinux media mmc 1a [email protected]_1a <NULL> > 54 script media mmc 1a [email protected]_1a <NULL> > 55 efi media mmc 1b [email protected]_1b <NULL> > 56 extlinux media mmc 1b [email protected]_1b <NULL> > 57 script media mmc 1b [email protected]_1b <NULL> > 58 efi media mmc 1c [email protected]_1c <NULL> > 59 extlinux media mmc 1c [email protected]_1c <NULL> > 5a script media mmc 1c [email protected]_1c <NULL> > 5b efi media mmc 1d [email protected]_1d <NULL> > 5c extlinux media mmc 1d [email protected]_1d <NULL> > 5d script media mmc 1d [email protected]_1d <NULL> > No more bootdevs > --- ----------- ------ -------- ---- ------------------------ > ---------------- > (94 bootflows, 0 valid) > ``` > > ls return 1 > > ``` > => ls mmc 1 /efi/boot > ./ > ../ > 51806720 BOOTAA64.EFI > > 1 file(s), 2 dir(s) > > => echo $? > 0 > => ls mmc 1 /efi/boot/bootaa64.efi > => echo $? > 1 > => ls mmc 1 /EFI/boot/BOOTAA64.EFI > => echo $? > 1 > => ls mmc 1 / > EFI/ > > 0 file(s), 1 dir(s) > > => ls mmc 1 /EFI/ > ./ > ../ > BOOT/ > > 0 file(s), 3 dir(s) > > => ls mmc 1 /EFI/BOOT/BOOTAA64.EFI > => echo $? > 1 > => ls mmc 1 /EFI/BOOT > ./ > ../ > 51806720 BOOTAA64.EFI
The issue ended up being the memory allocation. The file was too big (50MB). `bootflow scan -lae mmc1` In boot/bootmeth_efi.c, bootmeth_alloc_file is set to a pre-defined 32MB so bootefi cannot boot anything larger than that even if you have CONFIG_SYS_MALLOC_LEN set to something larger. Hope this helps someone. > > 1 file(s), 2 dir(s) > > => ls mmc 1 /EFI/BOOT/nonexist > => echo $? > 1 > ``` > > On Mon, Jul 24, 2023 at 11:35 AM Da Xue <[email protected]> wrote: > > > > Hi, > > > > I switch to bootstd and I am experiencing an issue with bootstd not > > detected EFI bootable file in /EFI/BOOT/BOOTAA64.EFI in certain image, > > buildroot specifically. The same setup works fine with distro_bootcmd. > > I have attached the logs. I have tried the following: > > > > 1) Directory and filename case upper and lower > > 2) FAT32 and FAT16 filesystem > > 3) Changing the size of the filesystem > > > > I noticed some particular weirdness with u-boot's return code for > > functions dealing with fs_exists that might be related. > > > > 1) FAT/FAT32 driver uses fs_ls_generic. When you do `ls mmc 1 > > /filename`, it returns 1 if the file exists and returns 1 when the > > file doesn't exist. > > 2) This issue follows fs_exists. Is this a bug or intended behavior? > > > > Best, > > Da

