I have managed to install Alpine Linux on a Marvell Octeon NIC. One thing I'm missing for this to be a clean setup is managing the u-boot variables in firmware.
That will also allow to query the card's serial number from the running OS which will allow for some better tracking when there's multiple cards. (they're behind a PCIe switch, and the device order is not static so far)
I created the file and put in various nice-looking numbers, but to no avail:
It's not working so far, showing me alignment errors.
- I wasn't able to find a generated config in the SDK tools.
- I've collected most info from the u-boot prompt and some hardware specific tools.
This is what I had thought could be right:
# MTD device name Device offset Env. size Flash sector size Number of sectors
#/dev/mtd0 0x400000 (8188 Bytes) 256 32
I've tried it, also converthing some of it to multiples of 256, but it seems arbitrary (i.e. 0x400000 is simply what they picked and the u-boot tools tell me it's not aligned on an erase block. yeah, err, wasn't me, right?)
### What I found out:
There's /dev/mtd0
and /dev/mtdblock0
, neither are partitioned.
# => saveenv
# SF: Detected MT25QL01G with page size 256 Bytes, erase size 4 KiB, total 128 MiB
Env size is reported as 8188 bytes
Flash sector size is supposed to be 256 bytes
The number of sectors should then be (probably) 32.
There *may* be a redundant copy being it.
In the sources I found those definitions
# u-boot/include/configs/octeon_generic_nand_stage2.h:#define CONFIG_ENV_RANGE 0x200000 /* 2 blocks */
#define CONFIG_ENV_IS_IN_NAND
#define CONFIG_ENV_OFFSET 0x400000 /* 4MB */
#define CONFIG_ENV_SIZE (32*1024)
#define CONFIG_ENV_RANGE 0x200000 /* 2 blocks */
#ifdef CONFIG_NAND_ENV_DST
nand_load(&nand_info, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
(uchar *)CONFIG_NAND_ENV_DST);
#ifdef CONFIG_ENV_OFFSET_REDUND
nand_load(&nand_info, CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
(uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE)
So the most confusing thing here is the (32*1024). Meaning 32MB, which would fit into a 256mbit NAND. But with the env size being shown as roundabout 8k, I'm not able to make sense of the two.
i had a command 'sf probe' that shows info about the flash chip but doesn't show layout info.
The documentation had this line:
The kernel needs to know the flash layout. This is controlled with the kernel mtdparts command line option. Here is the mtdparts option for the above flash layout. Note that the bootloader partitions are marked read only for safety.
bootoctlinux mtdparts=phys_mapped_flash:2048k(bootloader)ro,2048k(kernel),3072k(cramfs),256k(jffs2),256k(bootloader_env)ro
Check your partitioning:
$ cat /proc/mtd
dev: size erasesize name
mtd0: 00200000 00010000 "bootloader"
mtd1: 00200000 00010000 "kernel"
mtd2: 00300000 00010000 "cramfs"
mtd3: 00040000 00010000 "jffs2"
mtd4: 00040000 00010000 "bootloader_env"
i wanna ask:
- is there a way to see more about the layout of u-boots variable storage from within the u-boot prompt?
- is there a way to find them in the flash device (are they just plain ascii? what about endianness?)
- is there an explanation about the erase block sizes?, does it want the "sector" size (256) or the erase size (4)?
- is it safe to just set the mtdparts kernel variable as they mentioned, even if i know nothing about it really?
I somewhat tried the latter, with doubtful result:
cn7322:~# cat /proc/cmdline
bootoctlinux $(loadaddr) coremask=ffff noinitrd root=/dev/sdb2 rootfstype=ext4 rw rootdelay=10 mtdparts=phys_mapped_flash:2048k(bootloader)ro,2048k(kernel),3072k(cramfs),256k(jffs2),256k(bootloader_env)ro console=ttyS0,115200
cn7322:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00010000 "bootloader"
cn7322:~#
i looked through /dev/mtd0ro
, seems to be the bootloader, but seems not to have the env. or at least i cannot see a single variable name or content. (could be format issues). I didn't get the bootloader_env :(
Asked by Florian Heigl
(256 rep)
Mar 23, 2025, 04:28 PM
Last activity: Mar 23, 2025, 05:14 PM
Last activity: Mar 23, 2025, 05:14 PM