Author Topic: A10/A20 NAND boot block access  (Read 15362 times)

Offline phelum

  • Full Member
  • ***
  • Posts: 147
  • Karma: +5/-0
    • View Profile
A10/A20 NAND boot block access
« on: February 07, 2016, 06:11:40 am »
Hi,

Recently I modified the sunxi_nand driver in my 3.4.103 kernel to provide boot block access.  The first seven blocks in the NAND chip are used to store the boot programs required to enable an A10/A20 board to boot from NAND.  The first program is called boot0 and is stored in block 0 with a duplicate in block 1.  The second program is boot1 and is stored in block 2 with duplicates in blocks 3 - 6.

The modifications in the driver are included when CONFIG_SUNXI_NAND_BOOT_BLOCK_ACCESS is selected in the kernel config options.  This option is only available when SUNXI_NAND = 'm'.  The reason for this is that the special access functions are only available when the driver is being loaded.  The driver is loaded by a modprobe command and optional tail text in this command invokes the boot block read or burn functions.

Assuming that /opt exists and is the wanted file path,
To read blocks: modprobe sunxi-nand save_path=/opt
To burn blocks: modprobe sunxi-nand src_path=/opt

The files created from a read function are boot0_0 and boot0_1 (boot0 from blocks 0 and 1) and block_2 through block_6 (boot1 from blocks 2 through 6).  These files are truncated to just contain boot0 or boot1 if a valid file header is found.

The files required for a burn function are called boot0 and boot1.

I modified this driver because my bootfix program can't load boards with new NAND chips.  This is because bootfix uses some closed-source Allwinner programs and these don't work if the NAND chip ID is not included in the relevant tables.  This restriction also applies to Livesuit image files (particularly those for A10 SoCs).  For these new boards I also had to modify boot0 and boot1 and compile a new u-boot.bin.  Developing a NAND boot system for a new board can be a tedious task.

A kernel with this driver is of limited value because it can't be installed into NAND.  But it is useful if you'd like to boot a blank board and load the boot blocks and then partition and load the rest of NAND.  It was designed for this purpose and is also good if you'd like to extract the boot programs from a working system.

The driver is available at http://phelum.net/temp/sunxi_nand.tar.gz.  This archive contains the replacement Kconfig and also all the sunxi_nand files.  The modified files are:

modified:   drivers/block/Kconfig
modified:   drivers/block/sunxi_nand/nfc/nfc_r.c
modified:   drivers/block/sunxi_nand/nfd/nand_blk.c
modified:   drivers/block/sunxi_nand/src/include/nand_drv_cfg.h
modified:   drivers/block/sunxi_nand/src/physic/nand_simple_r.c

All patches in the modified files are headed with #ifdef CONFIG_SUNXI_NAND_BOOT_BLOCK_ACCESS.  Most of the changes are in nand_blk.c.  The small modifications to nfc_r.c and nand_simple_r.c load the special randomizer seed and NFC_SEQ flag required for boot0 access with some NAND chips.

If anybody is interested in this work I can create a git repository and also provide details about customising boot0 for a board.  It needs the correct DRAM and NAND specs.  Normally these details are loaded by Livesuit when downloading a system.

Cheers,
Steven

Offline arthur

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: A10/A20 NAND boot block access
« Reply #1 on: April 26, 2016, 02:26:28 pm »
Hi Steven,

Thanks for these modifications ! You seems to very well understand the underlying NAND boot process from allwinner. I must admit that this is kind of a black box for me.

Where did you get all these information about boot0 location and boot1 duplicates etc.? Do you have some kind of documentation?

I'm using these tools to make my NAND img: https://github.com/ozgur-keles/livesuit-image-creator

But the generated image has 2 main issues:

1) On the new board freshly flashed if I execute nand-part (see output below), all partitions shown are OK and the size of /dev/nanda is 32768*512 Bytes (=16384KiB). But if I execute df, the vfat filesystem size on this same boot partition has a size of 127.7M. I think that tools in livesuit-image-creator are using some kind of preset values that are not correct in my specific use-case. But most of these tools are not open-source, so I'm not able to set my custom values. What tools are you using to pack your NAND image?

2) Please find below my nand-part output:

Code: [Select]
check partition table copy 0: mbr: version 0x00000200, magic softw411
OK
check partition table copy 1: mbr: version 0x00000200, magic softw411
OK
check partition table copy 2: mbr: version 0x00000200, magic softw411
OK
check partition table copy 3: mbr: version 0x00000200, magic softw411
OK
mbr: version 0x00000200, magic softw411
3 partitions
partition  1: class =         DISK, name =   bootloader, partition start =    32768, partition size =    32768 user_type=0
partition  2: class =         DISK, name =       rootfs, partition start =    65536, partition size =   786432 user_type=0
partition  3: class =         DISK, name =        UDISK, partition start =   851968, partition size =    38912 user_type=0

And now the content of /proc/partitions

Code: [Select]
  93        0     498688 nand
  93        1      16384 nanda
  93        2     393216 nandb
  93        3      72704 nandc

The third partition size seems wrong because nand-part was saying that it was 38912*512=19,9MB.

Did you notice this kind of behavior with your tools?

Thanks for your help !

Arthur

Offline phelum

  • Full Member
  • ***
  • Posts: 147
  • Karma: +5/-0
    • View Profile
Re: A10/A20 NAND boot block access
« Reply #2 on: April 26, 2016, 04:44:29 pm »
Hi Arthur,

1) On the new board freshly flashed if I execute nand-part (see output below), all partitions shown are OK and the size of /dev/nanda is 32768*512 Bytes (=16384KiB). But if I execute df, the vfat filesystem size on this same boot partition has a size of 127.7M. I think that tools in livesuit-image-creator are using some kind of preset values that are not correct in my specific use-case. But most of these tools are not open-source, so I'm not able to set my custom values. What tools are you using to pack your NAND image?

I'm not using anything to pack an image.  Livesuit seems to do more than most people realise and it changes things to suit the target machine.  But if the target machine contains some unknowns (e.g. DRAM chip) then Livesuit fails.  The work I did was to load some custom boards and I had to do things like load Boot0 with the DRAM info myself and manually create the first image in NAND.  But once this was done it is possible to copy the NAND partitions to an SD card.  If the card has a kernel with the modified NAND driver and a script it can be used to automatically load other boards.  Good for a production line.

The third partition size seems wrong because nand-part was saying that it was 38912*512=19,9MB.

Did you notice this kind of behavior with your tools?

There is something wrong somewhere in the system where the size of the last partition is incorrect.  I put a dummy partition (small as possible) at the end and never touch it.  I think it's a nand-part problem but I'm not sure.

I've seen problems when the nand-part specs used to partition your NAND had a final partition size of 0 which means use all available.  But in your case it looks like the problem is elsewhere (maybe the driver).  Have you formatted nandc and if so what size does it report ?  Frankly, since it's such a tiny and useless partition I'd leave it alone.  It seems to do the job of my dummy partition which is to cause the size of the previous partition to be reported correctly.

Cheers,
Steven

Offline arthur

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: A10/A20 NAND boot block access
« Reply #3 on: April 27, 2016, 08:17:43 am »
Hi Steven,

Thanks for your quick feedback,

Livesuit seems to do more than most people realise and it changes things to suit the target machine.  But if the target machine contains some unknowns (e.g. DRAM chip) then Livesuit fails.  The work I did was to load some custom boards and I had to do things like load Boot0 with the DRAM info myself and manually create the first image in NAND. 

You are right, Livesuit was just a binary image flasher for me. I'm using PhoenixTool which is Livesuit 2.0 according to the sunxi wiki. Which of these tool are you using? Because I can only upload an image to the NAND on a board previously booted in FEL mode. Or maybe I missed something big  :o

You made your own NAND image step by step, but how did you know that you needed to put boot0 at block 0 and a duplicate at block 1? Did you get these information from the source code?

I found boot0 and boot1 source code here: https://github.com/allwinner-zh/bootloader/tree/master/basic_loader but it seems tough to understand all of this from the source code.

Offline phelum

  • Full Member
  • ***
  • Posts: 147
  • Karma: +5/-0
    • View Profile
Re: A10/A20 NAND boot block access
« Reply #4 on: April 28, 2016, 12:09:50 am »
Hi Arthur,

I found some of the boot block info in a full release (Draco H3 I think) and the rest from bits and pieces that are around.  I've never seen a comprehensive document anywhere.

All of my work in this area has been for A10/A20 boards and it's all a bit old and irrelevant now.

Is there any particular area you're interested in ?  Or are you just looking for an explanation about the size of your last partition ?  After I said yesterday that the mismatch is expected I checked some of my boards here and they don't have the problem.  Maybe it is a problem with nand-part.  But since your last partition is tiny and can't really be used then perhaps the size mismatch isn't a problem anyway.

Cheers,
Steven

Offline arthur

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: A10/A20 NAND boot block access
« Reply #5 on: April 28, 2016, 04:12:34 am »
Hi Steven,

Ok thanks, maybe my issue is coming from my misuse of the packer tool.

In order to analyze my generated image, I'm using imgRePacker to unpack the image. I noticed that my sys_partition.fex was not correct:

Code: [Select]
[mbr]
size = 16384

[partition_start]

;------------------------------>/nanda
[partition]
    name         = bootloader
    size         = 32768
    downloadfile = "bootloader.fex"
    verify       = 1

;------------------------------>/nandb
[partition]
    name         = rootfs
    size         = 753664
    downloadfile = "rootfs.fex"
    verify       = 1

There was no 3rd partition, maybe it leads to my issue. So I decided to add a third partition to fill my disk.

I have a 512MB flash, here is my formula to process the correct size:
16384 KiB => 16,777,216 B (MBR size)
32768*512B => 16,777,216 B (/dev/nanda partition)
753664*512 => 385,875,968 B (/dev/nandb partition)
512MB - 16.7MB*2 - 385.8MB = 92,569,600

I don't know why, but my packer tool complains when I'm not using a multiple of 16,7MB for the partition size.

So the closest size is: 83,886,080 => 163,840 sector of 512 B

So my new sys_partition.fex is:

Code: [Select]
[mbr]
size = 16384

[partition_start]

;------------------------------>/nanda
[partition]
    name         = bootloader
    size         = 32768
    downloadfile = "bootloader.fex"
    verify       = 1

;------------------------------>/nandb
[partition]
    name         = rootfs
    size         = 753664
    downloadfile = "rootfs.fex"
    verify       = 1

;------------------------------>/nandc
[partition]
    name         = swap
    size         = 163840
    verify       = 1

; 16960 * 512 bytes not used (partitions must be multiple of 16777216 B)

And after burning this image, I execute nand_part and cat /proc/partitions, here is the output:

Code: [Select]
check partition table copy 0: mbr: version 0x00000200, magic softw411
OK
check partition table copy 1: mbr: version 0x00000200, magic softw411
OK
check partition table copy 2: mbr: version 0x00000200, magic softw411
OK
check partition table copy 3: mbr: version 0x00000200, magic softw411
OK
mbr: version 0x00000200, magic softw411
4 partitions
partition  1: class =         DISK, name =   bootloader, partition start =    32768, partition size =    32768 user_type=0
partition  2: class =         DISK, name =       rootfs, partition start =    65536, partition size =   753664 user_type=0
partition  3: class =         DISK, name =         swap, partition start =   819200, partition size =   163840 user_type=0
partition  4: class =         DISK, name =        UDISK, partition start =   983040, partition size =   -92160 user_type=0




major minor  #blocks  name

  93        0     498688 nand
  93        1      16384 nanda
  93        2     376832 nandb
  93        3      81920 nandc
  93        4       7168 nandd

From nand-part output, UDISK seems to be auto generated but now it has a negative size, -92160 but with my understanding it should be 16960 because of my previous calculation.

From /cat/partitions, the nandd size seems not correct too but different though:
7168 KiB => 7,340,032 B => 14,336 sector of 512B and not 16960 as it should be

I must admit that I'm lost. Maybe I made a mistake in my calculation. Let me know if something is more clear for you.

Thanks for your help,

Arthur

Offline phelum

  • Full Member
  • ***
  • Posts: 147
  • Karma: +5/-0
    • View Profile
Re: A10/A20 NAND boot block access
« Reply #6 on: April 28, 2016, 07:50:34 pm »
Hi Arthur,

I've been looking at your posts here again.  I'd drop the idea of adding your swap partition because it might cause more trouble than it's worth.

The original problem was the incorrect size of the UDISK partition which is apparently added by Livesuit.  The numbers in your original /proc/partitions list do add up if you include the 32768 sectors preceding nanda.  But the total (498688) times 1024 is awfully close to 512MB.  My 8GB chip here is marked as 7700MB which is a lot less than 8GB.  I doubt it's bad blocks because the total is the same on the five CTs I've checked.

If you manually partition your NAND do you get the same mismatch ?

Your comment about partitions and offsets being a multiple of 16.7MiB might be to allow for a NAND block size of 16.7MiB.  The risk I see in having partitions starting mid-way through a block is that all NAND writes are done in blocks and it seems much safer to never affect a partition when updating an adjacent partition.  I've seen "alignment error" messages from u-boot which is probably due to me having partitions on 128kiB boundaries.  I did this because that's the block size in the chip here.  I'll try setting the granularity to 16.7MiB and see if that stops the warnings.

Are you trying to create a Livesuit image for distribution ?  If not can you try manually partitioning the NAND ?

Cheers,
Steven

Here is some info from my CT here:

Code: [Select]
root@home:~# cat /proc/partitions
major minor  #blocks  name

  93        0    7520256 nand
  93        1      65536 nand1
  93        2    7372800 nand2
  93        3      65536 nand3
   8        0  488386584 sda
   8        1   41943040 sda1
   8        2   41943040 sda2
   8        3  209715200 sda3
   8        4  194784280 sda4
root@home:~# nand-part -f a20
check partition table copy 0: mbr: version 0x00000200, magic softw411
OK
check partition table copy 1: mbr: version 0x00000200, magic softw411
OK
check partition table copy 2: mbr: version 0x00000200, magic softw411
OK
check partition table copy 3: mbr: version 0x00000200, magic softw411
OK
mbr: version 0x00000200, magic softw411
3 partitions
partition  1: class =         DISK, name =         boot, partition start =    32768, partition size =   131072 user_type=0
partition  2: class =         DISK, name =       rootfs, partition start =   163840, partition size = 14745600 user_type=0
partition  3: class =         DISK, name =        dummy, partition start = 14909440, partition size =   131072 user_type=0
root@home:~# fdisk -l

Disk /dev/nand: 7700 MB, 7700742144 bytes
255 heads, 63 sectors/track, 936 cylinders, total 15040512 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Offline phelum

  • Full Member
  • ***
  • Posts: 147
  • Karma: +5/-0
    • View Profile
Re: A10/A20 NAND boot block access
« Reply #7 on: May 05, 2016, 03:24:34 am »
Hi Arthur,

I've just loaded the NAND on an Olimex A20 board using my software.  I investigated the alignment error problem you mentioned (start/size is not align) and found that all partitions must be aligned to super-blocks rather than just NAND blocks.  A super-block is all the blocks (generally 2) on a plane in the NAND chip.

So I changed my calcs to use super-blocks and now I don't get any warning when the system is booting.

But the size mismatch error on the last partition still occurs.  I checked the partitioning done by my software and everything is correct.  If I run nand-part this also shows the correct start keys and sizes.  But lsblk (uses proc/partitions) is still wrong.  In my case here a 4MiB partition is reported as 28MiB.  Same goes if I mount it.  For safety I'd leave this last partition unformatted and unused.

Code: [Select]
root@lime:/media# nand-part -f a20
check partition table copy 0: mbr: version 0x00000200, magic softw411
OK
check partition table copy 1: mbr: version 0x00000200, magic softw411
OK
check partition table copy 2: mbr: version 0x00000200, magic softw411
OK
check partition table copy 3: mbr: version 0x00000200, magic softw411
OK
mbr: version 0x00000200, magic softw411
4 partitions
partition  1: class =         DISK, name =   bootloader, partition start =     8192, partition size =     8192 user_type=0
partition  2: class =         DISK, name =         boot, partition start =    16384, partition size =     8192 user_type=0
partition  3: class =         DISK, name =      CloudFS, partition start =    24576, partition size =  7700480 user_type=0
partition  4: class =         DISK, name =        UDISK, partition start =  7725056, partition size =     8192 user_type=0
root@lime:/media# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
nand         93:0    0   3.7G  0 disk
??nand1      93:1    0     4M  0 part
??nand2      93:2    0     4M  0 part
??nand3      93:3    0   3.7G  0 part
??nand4      93:4    0    28M  0 part /media
mmcblk0     179:0    0   7.4G  0 disk
??mmcblk0p1 179:1    0   7.4G  0 part /
root@lime:/media#

Update: I've just found what looks like the culprit here.
block/partitions/sunxi_nand.c:
Code: [Select]
static void sunxi_nand_parse_mbr(struct parsed_partitions *state, int no)
{
Sector sect;
int part_cnt;
struct MBR *mbr = 0;
char b[BDEVNAME_SIZE];

bdevname(state->bdev, b);

mbr = read_part_sector(state, mbr_sector, &sect);
for (part_cnt = 0; part_cnt < mbr->tag.PartCount &&
/* the sunxi mbr structure ver 0x200 allows for 120
* partitions but only 31 fit into a page so forget the
* ones that do not fit. */
part_cnt < MAX_PART_COUNT && part_cnt < 31;
part_cnt++) {
/* special case: last partition uses up rest of NAND space */
__u32 size = mbr->array[part_cnt].lenlo;
if (part_cnt == mbr->tag.PartCount - 1)
size = get_capacity(state->bdev->bd_disk) -
mbr->array[part_cnt].addrlo;
printk(KERN_WARNING "Dev Sunxi %s %s: part %d, start %d, size %d\n",
MBR_MAGIC, b, part_cnt + 1,
mbr->array[part_cnt].addrlo, size);
put_partition(state, part_cnt + 1,
mbr->array[part_cnt].addrlo, size);
}
strlcat(state->pp_buf, "\n", PAGE_SIZE);
put_dev_sector(sect);
}

Notice the test in the middle that changes the size of the last partition.  There might be a good reason but it doesn't seem nice to me.

After patching the kernel to remove the special handling for the last partition I get:
Code: [Select]
root@lime:~# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
nand         93:0    0   3.7G  0 disk
??nand1      93:1    0     4M  0 part
??nand2      93:2    0     4M  0 part
??nand3      93:3    0   3.7G  0 part
??nand4      93:4    0     4M  0 part
mmcblk0     179:0    0   7.4G  0 disk
??mmcblk0p1 179:1    0   7.4G  0 part /
root@lime:~#

The 4M for nand4 is correct.  So the size mismatch is just a bug in block/partitions/sunxi_nand.c.

Cheers,
Steven
« Last Edit: May 05, 2016, 05:15:05 am by phelum »

Offline arthur

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: A10/A20 NAND boot block access
« Reply #8 on: May 06, 2016, 05:57:09 am »
Dear Steven,

Thank you very much for your analysis !

I'll patch the driver right now to avoid this mismatch and, like you said, I'll avoid to use this last partition for safety.

Have a nice day  ;)

Arthur

Offline phelum

  • Full Member
  • ***
  • Posts: 147
  • Karma: +5/-0
    • View Profile
Re: A10/A20 NAND boot block access
« Reply #9 on: May 06, 2016, 06:19:56 am »
I'll patch the driver right now to avoid this mismatch and, like you said, I'll avoid to use this last partition for safety.
Hi Arthur,

If you patch the driver it should be safe to format and use the last partition.  Maybe just make sure the start key and size values are correct in case there's another bug/feature.

I've seen mention that if the last partition in the nand-part specs is size 0 then it ends up taking the rest of the NAND.  It looks like the driver ALWAYS makes the last partition extend to the end of the NAND.  But unfortunately it gets the size and therefore the end wrong.

Cheers,
Steven

Offline tilator

  • Newbie
  • *
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: A10/A20 NAND boot block access
« Reply #10 on: March 24, 2018, 05:44:16 am »
Hello,

Does this:

"linux-sunxi u-boot is fully SPL enabled which means it supports booting directly on the bare metal with no help from the Allwinner bootloaders. U-Boot SPL fully replaces Allwinner boot0 & boot1."

from here:

https://github.com/linux-sunxi/u-boot-sunxi/wiki

mean, u-boot can be flashed directly on nand and Allwinner boot0 and boo1 can be forgotten?

Offline phelum

  • Full Member
  • ***
  • Posts: 147
  • Karma: +5/-0
    • View Profile
Re: A10/A20 NAND boot block access
« Reply #11 on: March 24, 2018, 06:13:29 am »
Hello,

Does this:

"linux-sunxi u-boot is fully SPL enabled which means it supports booting directly on the bare metal with no help from the Allwinner bootloaders. U-Boot SPL fully replaces Allwinner boot0 & boot1."

from here:

https://github.com/linux-sunxi/u-boot-sunxi/wiki

mean, u-boot can be flashed directly on nand and Allwinner boot0 and boo1 can be forgotten?
Hi,

I think the U-Boot with SPL you've found is for SD cards rather than NAND.  I suspect the boot0/boot1 portion (written to block 8 onwards) is totally different to that in a NAND setup.  I never managed to compile boot0/boot1 but I did extract it and change the DRAM specs to suit a board with memory chips that aren't defined in the standard tables.

Cheers,
Steven

Offline tilator

  • Newbie
  • *
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: A10/A20 NAND boot block access
« Reply #12 on: March 24, 2018, 07:44:06 am »
I think the U-Boot with SPL you've found is for SD cards rather than NAND.

I would like to update u-boot in NAND. So - do you think I should use one without SPL? Should it be flashed to the very beginning of the flash if I do not have drivers for boot/boot1 access installed?

I would like to have only u-boot and environment on NAND and everything else on SATA.

Offline phelum

  • Full Member
  • ***
  • Posts: 147
  • Karma: +5/-0
    • View Profile
Re: A10/A20 NAND boot block access
« Reply #13 on: March 24, 2018, 08:20:01 am »
I would like to update u-boot in NAND. So - do you think I should use one without SPL? Should it be flashed to the very beginning of the flash if I do not have drivers for boot/boot1 access installed?

I would like to have only u-boot and environment on NAND and everything else on SATA.
Hi,

I think you'll need at least a small VFAT partition in NAND just to give you somewhere to put U-Boot.  boot1 finds U-Boot and runs it and this loads the kernel (e.g. uImage) which by default is in this partition.  It might be possible to put the kernel on SDA and change uEnv.txt to specify this if U-Boot is smart enough to access a volume (probably ext4) on disk.

If you just want to update U-Boot then you'll find it in /dev/mmcblk0p1 and it's called u-boot.bin.  The entry in uEnv.txt to specify a different kernel is kernel=........ but I don't know how you'd specify a kernel on sda1 (something like /dev/sda1/boot/mykernel but that's not right).  Maybe ask on the Armbian forum if you get no answers here.

Cheers,
Steven

Offline tilator

  • Newbie
  • *
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: A10/A20 NAND boot block access
« Reply #14 on: March 24, 2018, 10:43:04 am »
Hi,

I think you'll need at least a small VFAT partition in NAND just to give you somewhere to put U-Boot.  boot1 finds U-Boot and runs it and this loads the kernel (e.g. uImage) which by default is in this partition.  It might be possible to put the kernel on SDA and change uEnv.txt to specify this if U-Boot is smart enough to access a volume (probably ext4) on disk.

If you just want to update U-Boot then you'll find it in /dev/mmcblk0p1 and it's called u-boot.bin.  The entry in uEnv.txt to specify a different kernel is kernel=........ but I don't know how you'd specify a kernel on sda1 (something like /dev/sda1/boot/mykernel but that's not right).  Maybe ask on the Armbian forum if you get no answers here.

Cheers,
Steven

2017.11 U-Boot seems to identify HDD as expected.

Would it be just possible to load kernel and what ever more needed from HDD with ext4load command?

Best solution would be if U-Boot environment was on NAND and U-Boot would load kernel and everything from HDD if it was present. SD-card would be used if it was found (before HDD in boot order) and booting everything from NAND if there were not HDD and not SD-card.

I suppose this can be done if the U-Boot is new enough. This 2017.11 at least seems to support both HDD and SD-card. I'm not sure if it can boot from NAND without compiling it again with NAND-support.

This U-Boot was from an Armbian image.

B.T.W. This suggests there should be U-Boot with SPL also put on NAND:

https://lists.denx.de/pipermail/u-boot/2015-May/215159.html

Might this just depend on if there is an U-Boot supporting both SATA and NAND?
« Last Edit: March 24, 2018, 11:12:36 am by tilator »