How to boot from NAND with an SD card still inserted?

Started by djagab, February 24, 2016, 02:19:25 PM

Previous topic - Next topic

djagab

I have an Olinuxino-micro 4G board with the latest debian image installed to NAND and made it read-only.
The parts that need writing are moved to SD (via symbolic links or directly). On the SD card I have one partition that
is mounted at boot time (via Fstab). Unfortunately the olinuxino reads the SD card at boot time and decides to wait for valid boot material in TFTP mode in stead of switching over to NAND. Without the SD card the olinuxino is capable of booting to NAND just fine. I would like to be able to boot from NAND without having to remove and re-insert the SD card right after boot (when the green light starts flashing), is this possible?

Thanks in advance....


JohnS

http://linux-sunxi.org/BROM

You'd have to put code on the SD to boot from NAND or omit boot code from the SD.

John

djagab

Thanks for you reply.
I read the sunxi page you supplied via the link.
But, could you be more specific as to which code to add to SD or better... to remove?

JohnS

So the idea is pick one of:
1. make the SD non-bootable so the BROM goes on to the NAND
2. put a bootloader on the SD that jumps to the NAND

I fancy #1 more than #2.

Have a look at the BROM etc.  I think it wants a magic pattern on the SD.  If so you just need to make sure your SD does not have it.

Try a blank SD.  If the BROM goes past it to the NAND then you know this idea is workable, but not yet the part it checks.  That'll be on the sunxi site, maybe on the BROM page.

Now bear in mind that almost any image for an SD that you find will be making sure it DOES have that pattern.  So if you use one of those you'll have to overwrite the magic part.  (dd is good for this stuff.)

John

djagab

Thanks.
By magic pattern you mean the files like u-boot.bin and sunxi-spl.bin that are written outside the bounds of any partition, right?

JohnS

Probably not.  Hunt around the linux-sunxi site for how BROM works.

John

JoseQ

Is there a way to force to boot from NAND "if" the image on the SD card is corrupted?

I did some tests in the A20-Lime2: Debian in NAND, Debian in uSD card.

I intentionally corrupted the image on the SD card, and it gets blocked, UART outputs this:


  reading uEnv.txt
  ** unable to read file uEnv.txt
  Failed to mount ext2 filesystem
  ** Unrecognized filesystem type
  reading boot.scr
  ** unable to read file boot.scr
  Failed to mount ext2 filesystem
  reading uImage
  ** Booting kernel from Legacy Image at 480000000 ...
    Image Name: Linux-3.5.90
  ...
  ...
  ...
  verifying Checksum ... Bad Data CRC
ERROR: can't get kernel image!
sun7i#


Probably not, but I would like to hear your opinions.

Thank you guys!

JohnS

grrr.... I just answered your other version of the question!!

John

JoseQ

Thank you JohnS,

And sorry, I've just read your answer.

JoseQ

JohnS,
As you pointed:
It boots with a blank SD card.
And also in the case of a corrupted SD card, the bootloader starts and it looks that there is no way to "fallback" and boot from NAND.

Thank you!

djagab

By using the following command: dd if=/dev/zero of=/dev/sdc bs=1k count=1023 seek=1
I was able to remove the thing that John calls 'magic' while keeping the partition table in tact.
The board boots from NAND and my SD partition gets mounted right.
Thanks for pointing me in the right direction. Still would like to know the facts behind 'magic pattern', though. ;)

JohnS

#12
Almost for sure is on linux-sunxi.org

Hunt around with words like
boot
rom
brom

Fallback can probably be done if you think more (and read more of that site)...

John