My issue (after putting debug code in U-Boot) is that max_boot_stream_size is less than zero in nandbcb_set_boot_config() in U-Boot, which is found in arch/arm/mach-imx/cmd_nand_bcb.c.
I am using U-Boot 2020.04.
I see the following intermediate values (maxsize matches the size of the U-Boot partition of the NAND):
maxsize 0x100000
bootstream_1_address=0x200000
bootstream_2_address=0x180000
My U-Boot is of size 658432 or 0xA0C00.
Partition table:
device nand0 <gpmi-nand>, # parts = 7
#: name size offset mask_flags
0: nandboot 0x00100000 0x00000000 0
1: env1 0x00040000 0x00100000 0
2: env2 0x00040000 0x00140000 0
3: nandkernel 0x01000000 0x00180000 0
4: nanddtb 0x00080000 0x01180000 0
5: nandtee 0x00100000 0x01200000 0
6: nandrootfs 0x1ed00000 0x01300000 0
Plenty of space for U-Boot.
Here are the nand parameters:
Device 0: nand0, sector size 256 KiB
Page size 4096 b
OOB size 256 b
Erase size 262144 b
subpagesize 4096 b
options 0x40004200
bbt options 0x00060000
So what is the cause?
Solved! Go to Solution.
Hello,
Sorry for replying until today I was looking into code what will be the cause of this, if this still is useful for you, the minimum nandboot partition should be equal to both search areas plus two copies of the boot_stream_size.
This by following the formulas in the nandbcb_set_boot_config() and nandbcb_check_space() functions.
Will give that the following:
nandboot minimum size >= boot_cfg->search_area_size_in_bytes*2 + Boot_size*2
Where:
boot_cfg->search_area_size_in_bytes = g_boot_search_count * g_boot_search_stride
g_boot_search_count = 4 // definition
g_boot_search_stride = mtd->erasesize
boot_stream_size = file_size_of(bootstream);
i.e
boot_stream_size = 658432 (0xa0c00)
g_boot_search_stride = 262144 (0x40000)
Then:
boot_cfg->search_area_size_in_bytes = 4*262144 = 1048576 (0x100000)
nandboot >= 1048576*2 + 658432*2 = 3414016 (0x341800)
Hope this helps,
Best regards,
Aldo.
Hello,
Could you share the uboot log you see when 1MB uboot size is set and fails?
Also, please fin nandbcb documentation here:
https://source.codeaurora.org/external/imx/uboot-imx/commit/?h=imx_v2020.04_5.4.70_2.3.0&id=c548451f...
Best regards,
Aldo.
Thanks for pointing out the documentation.
Here is the end of the log, and the uuu.auto file.
U-Boot Output:
Device 0: nand0, sector size 256 KiB
Page size 4096 b
OOB size 256 b
Erase size 262144 b
subpagesize 4096 b
options 0x40004200
bbt options 0x00060000
baudrate=115200
bootargs=console=ttymxc0,115200 rdinit=/linuxrc clk_ignore_unused
bootcmd=nand read ${loadaddr} 0x180000 0x1000000;nand read ${fdt_addr} 0x1180000 0x80000;if test ${tee} = yes; then nand read ${tee_addr} 0x1200000 0x100000;bootm ${tee_addr} - ${fdt_addr};else bootz ${loadaddr} - ${fdt_addr};fi
bootcmd_mfg=run mfgtool_args;if iminfo ${initrd_addr}; then if test ${tee} = yes; then bootm ${tee_addr} ${initrd_addr} ${fdt_addr}; else bootz ${loadaddr} ${initrd_addr} ${fdt_addr}; fi; else echo "Run fastboot ..."; fastboot 0; fi;
bootdelay=5
console=ttymxc0
emmc_ack=1
emmc_dev=1
ethprime=eth1
fastboot_buffer=0x80800000
fastboot_bytes=a0c00
fdt_addr=0x83000000
fdt_high=0xffffffff
filesize=a0c00
initrd_addr=0x86800000
initrd_high=0xffffffff
kboot=bootz
loadaddr=0x80800000
mfgtool_args=setenv bootargs console=${console},${baudrate} rdinit=/linuxrc clk_ignore_unused
mtdparts=mtdparts=gpmi-nand:1m(nandboot),256k(env1),256k(env2),16m(nandkernel),512k(nanddtb),1m(nandtee),-(nandrootfs)
nand_erasesize=40000
nand_oobsize=100
nand_writesize=1000
sd_dev=1
serial#=201a79d2677f0fb5
splashimage=0x8c000000
tee=yes
tee_addr=0x84000000
Environment size: 1149/262139 bytes
device nand0 <gpmi-nand>, # parts = 7
#: name size offset mask_flags
0: nandboot 0x00100000 0x00000000 0
1: env1 0x00040000 0x00100000 0
2: env2 0x00040000 0x00140000 0
3: nandkernel 0x01000000 0x00180000 0
4: nanddtb 0x00080000 0x01180000 0
5: nandtee 0x00100000 0x01200000 0
6: nandrootfs 0x1ed00000 0x01300000 0
active partition: nand0,0 - (nandboot) 0x00100000 @ 0x00000000
defaults:
mtdids : nand0=gpmi-nand
mtdparts:
device 0 offset 0x0, size 0xa0c00
something wrong with firmware address settings
uuu.auto script:
uuu_version 1.2.39
# @_flash.bin | bootloader
# @_image [_flash.bin] | image burn to nand, default is the same as bootloader
# This command will be run when i.MX6/7 i.MX8MM, i.MX8MQ
SDP: boot -f u-boot.imx
FB: ucmd setenv fastboot_buffer ${loadaddr}
FB: download -f u-boot.imx
# Burn image to nandfit partition if needed
FB: ucmd if env exists nandfit_part; then nand erase.part nandfit; nand write ${fastboot_buffer} nandfit ${fastboot_bytes}; else true; fi;
FB: ucmd nand info
FB: ucmd printenv
FB: ucmd mtdparts
FB: ucmd erase.chip
FB: ucmd nandbcb init ${fastboot_buffer} nandboot ${fastboot_bytes}
FB: ucmd mtd list
FB: ucmd printenv fastboot_buffer
FB: download -f zImage
FB: ucmd nand write ${fastboot_buffer} nandkernel ${fastboot_bytes}
FB: download -f mtcap3.dtb
FB: ucmd nand write ${fastboot_buffer} nanddtb ${fastboot_bytes}
FB: download -f uTee-6ullevk
FB: ucmd nand write ${fastboot_buffer} nandtee ${fastboot_bytes}
FB: download -f core-image-minimal-test-imx6ull14x14evk.ubi
FB[-t 20000]: ucmd nand write ${fastboot_buffer} nandrootfs ${fastboot_bytes}
FB: Done
Hello,
Sorry for replying until today I was looking into code what will be the cause of this, if this still is useful for you, the minimum nandboot partition should be equal to both search areas plus two copies of the boot_stream_size.
This by following the formulas in the nandbcb_set_boot_config() and nandbcb_check_space() functions.
Will give that the following:
nandboot minimum size >= boot_cfg->search_area_size_in_bytes*2 + Boot_size*2
Where:
boot_cfg->search_area_size_in_bytes = g_boot_search_count * g_boot_search_stride
g_boot_search_count = 4 // definition
g_boot_search_stride = mtd->erasesize
boot_stream_size = file_size_of(bootstream);
i.e
boot_stream_size = 658432 (0xa0c00)
g_boot_search_stride = 262144 (0x40000)
Then:
boot_cfg->search_area_size_in_bytes = 4*262144 = 1048576 (0x100000)
nandboot >= 1048576*2 + 658432*2 = 3414016 (0x341800)
Hope this helps,
Best regards,
Aldo.
In this case, 4MiB seems reasonable for nandboot, which needs to be 2MiB+2*(U-Boot Size).
These parameters are decided by the CPU from what I understand? And they are known to be adequate for all NANDs? The redundancy is adequate to allow for bad blocks and ECC requirements?
I increased the size of the u-boot partition to 4MB, and now nandbcb appears to work. Is this optimal? u-boot is 658432, as I said.
One more question. Is there documentation for nandbcb?