On Fri, May 19, 2023 at 03:41:34PM +0300, Roger Quadros wrote: > Hi Colin, > > On 19/05/2023 02:19, Colin Foster wrote: > > Hi Roger, > > > >> Can you please share your spl/u-boot.cfg? > > > > Attached > > Couple of questions there > > 1) CONFIG_MTDPARTS_DEFAULT > "mtdparts=nandflash:0x20000(xload_raw),0x180000(u-boot),0x180000(u-boot-2),0x1fce0000(main)" > Is this correct and matches with what kernel sees? > I couldn't see the NAND partition table in the Kernel Device tree patch.
Yes, this is correct. I intentionally left my MTD Partitions out of the kernel patch, since I don't want any changes I might make to the flash partitions to require further patches. I'm currently at this structure (SPL, 2x U-Boot, and main UBI with A/B partitions and 2x U-Boot Envs) The SD Boot version of U-Boot doesn't use NAND, so it might have a stale partition layout that I'll need to remove / modify. > > 2) > #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x20000 > #define CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND 0x1a0000 > > These don't seem to match what you have defined in MTDPARTS_DEFAULT. > Which one is correct? This matches the above partition layout. 0x180000 + 0x20000 = 0x1a0000. It wasn't until recently I realized I needed to remove CONFIG_SPL_RAW_IMAGE_SUPPORT in order for this fallback to succeed. > > How do you flash the MLO and u-boot image to NAND? I boot to from SD card, then run a commissioning script that contains: ``` echo "Erasing MLO partition $MLO_PART" flash_erase $MLO_PART 0 0 echo "Programming MLO partition" nandwrite -a -p $MLO_PART $MLO_FILE echo "Erasing U-Boot partition $U_BOOT_PART" flash_erase $U_BOOT_PART 0 0 echo "Programming U-Boot partition" nandwrite -a -p $U_BOOT_PART $U_BOOT_FILE echo "Erasing U-Boot redundant partition $U_BOOT_PART_REDUND" flash_erase $U_BOOT_PART_REDUND 0 0 echo "Programming U-Boot redund partition" nandwrite -a -p $U_BOOT_PART_REDUND $U_BOOT_FILE echo "Clearing UBI partition" flash_erase $UBI_PART 0 0 echo "Formatting UBI partition" ubiformat $UBI_PART -y ubiattach -p $UBI_PART echo "Making UBI volumes" ubimkvol /dev/ubi0 -N env1 -s 0x40000 ubimkvol /dev/ubi0 -N env2 -s 0x40000 ubimkvol /dev/ubi0 -N rootfs-a -s 0xc000000 ubimkvol /dev/ubi0 -N rootfs-b -s 0xc000000 echo "Writing rootfs partitions" ubiupdatevol /dev/ubi0_2 $ROOTFS_FILE ubiupdatevol /dev/ubi0_3 $ROOTFS_FILE ``` For all these tests I've been manually running the flash_erase / nandwrite process for the SPL / U-Boot partitions. > > I tried on AM335x-EVM and it works fine both before and after commit > 04fcd25873. > > Once change I had to do was to increase the u-boot partition size > as u-boot image does not fit in original partition size. > > -----boot log follows----- > > U-Boot SPL 2023.01-rc4-00381-g04fcd25873-dirty (May 19 2023 - 15:10:15 +0300) > Trying to boot from NAND > > > U-Boot 2023.01-rc4-00381-g04fcd25873-dirty (May 19 2023 - 15:10:15 +0300) > > CPU : AM335X-GP rev 1.0 > Model: TI AM335x EVM > DRAM: 512 MiB > Core: 156 devices, 17 uclasses, devicetree: separate > WDT: Started wdt@44e35000 with servicing every 1000ms (60s timeout) > NAND: 256 MiB > MMC: OMAP SD/MMC: 0 > Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... > <ethaddr> not set. Validating first E-fuse MAC > Net: eth2: ethernet@4a100000, eth3: usb_ether > Hit any key to stop autoboot: 0 > => > > => mtd > > device nand0 <nand.0>, # parts = 10 > #: name size offset mask_flags > 0: NAND.SPL 0x00020000 0x00000000 0 > 1: NAND.SPL.backup1 0x00020000 0x00020000 0 > 2: NAND.SPL.backup2 0x00020000 0x00040000 0 > 3: NAND.SPL.backup3 0x00020000 0x00060000 0 I need to go back to the 4460 datasheet. I looked and don't remember seeing anything about an SPL search. I'd sleep better at night knowing that when the day comes I need to update the SPL, I can do so with some redundancy. Sorry - I'm getting off topic. I'll be back with hardware on Monday to keep looking at this. > 4: NAND.u-boot-spl-os 0x00040000 0x00080000 0 > 5: NAND.u-boot 0x00200000 0x000c0000 0 > 6: NAND.u-boot-env 0x00020000 0x002c0000 0 > 7: NAND.u-boot-env.backup10x00020000 0x002e0000 0 > 8: NAND.kernel 0x00700000 0x00300000 0 > 9: NAND.file-system 0x0f600000 0x00a00000 0 > > > -- > cheers, > -roger

