How to decide NAND boot address?

225 views
Skip to first unread message

hunter hu

unread,
Mar 3, 2014, 2:42:17 PM3/3/14
to linux...@googlegroups.com
Hi All,

I am trying to boot from NAND, and using Allwinner lichee-dev branch, in the sun5i_a13.h header, there is a section of hard coded environment setup like this:

81 #define CONFIG_EXTRA_ENV_SETTINGS \
182     "bootdelay=3\0" \
183     "bootcmd=run setargs boot_normal\0" \
184     "console=ttyS0,115200\0" \
185     "nand_root=/dev/nandd\0" \
186     "mmc_root=/dev/mmcblk0p4\0" \
187     "init=/init\0" \
188     "loglevel=8\0" \
189     "setargs=setenv bootargs console=${console} root=${nand_root}" \
190     "init=${init} loglevel=${loglevel}\0" \
191     "boot_normal=nand read 50000000 boot; boota 50000000\0" \
192     "boot_recovery=nand read 50000000 recovery; boota 50000000\0" \
193     "boot_fastboot=fastboot\0"

My question is: how do I find the nand read address of my own instead of default 50000000?

My nand-part on the tablet looks like:

  9 mbr: version 0x00000100, magic softw311
 10 2 partitions
 11 partition  1: class =         DISK, name =         boot, partition start =    32768, partition size =    52768 user_type=0
 12 partition  2: class =         DISK, name =         root, partition start =    85536, partition size = 15479264 user_type=0
 
Is that the start of nandb which is 85536 x 512 = 43794432 ?

I also need to change /dev/nandd to /dev/nandb because I boot from the second partition /dev/nandb, correct?

Any hints are greatly appreciated,

Cheers,
-Hunter

Patrick Wood

unread,
Mar 3, 2014, 3:45:21 PM3/3/14
to linux...@googlegroups.com
That's not the nand read address; that's the RAM address where the nand read command stores data read from nand.  The last argument (boot, recovery) is the nand partition name where it's reading data.

This is how an android kernel+initrd is loaded.

hunter hu

unread,
Mar 3, 2014, 4:00:55 PM3/3/14
to linux...@googlegroups.com
Thanks Patrick,

Does this mean I don't need to change the default 50000000 at all?

My intention is to load Linux instead of Android from NAND and following this sunxi wiki: http://linux-sunxi.org/Installing_to_NAND.

What changes need to be made in the uboot env besides the /dev/nandd -> /dev/nandb?

-Hunter

Patrick Wood

unread,
Mar 3, 2014, 7:41:17 PM3/3/14
to linux...@googlegroups.com
This version of uboot loads the entire partition into RAM, not the uImage file.  You need a modified uboot that can be set up more like the one that's used on SD cards: http://www.cubieforums.com/index.php?topic=511.0

Pat

Henrik Nordström

unread,
Mar 4, 2014, 12:30:43 PM3/4/14
to linux...@googlegroups.com
The lichee u-boot also support fat access, just use fatload instead of
nand command to load files.
> --
> You received this message because you are subscribed to the Google
> Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to linux-sunxi...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.


hunter hu

unread,
Mar 5, 2014, 4:14:03 PM3/5/14
to linux...@googlegroups.com
Hi Henrik,

I tried to use fatload in the configurations like these:
182 #define CONFIG_EXTRA_ENV_SETTINGS \
183     "bootdelay=3\0" \
184     "bootcmd=run setargs load_uimage boot_uimage\0" \
185     "console=ttyS0,115200\0" \
186     "nand_root=/dev/nandb\0" \
187     "init=/init\0" \
188     "loglevel=8\0" \
189     "setargs=setenv bootargs console=${console} root=${nand_root}" \
190     "init=${init} loglevel=${loglevel}\0" \
191     "load_uimage=fatload nanda 44000000 uImage\0" \
192     "boot_uimage=bootm 44000000\0"
193 
194 #define CONFIG_BOOTDELAY    1
195 #define CONFIG_BOOTCOMMAND  "fatload nanda 44000000 uImage;bootm 44000000"
196 #define CONFIG_SYS_BOOT_GET_CMDLINE
197 #define CONFIG_AUTO_COMPLETE


But I am still stuck at the SUNXI logo(that part I got it :-) ), anything wrong with the above configurations?

Thanks,
-Hunter

Patrick Wood

unread,
Mar 5, 2014, 9:51:22 PM3/5/14
to linux...@googlegroups.com
That's not the right syntax for file access. Don't you have a serial port you can get boot logs from?

hunter hu

unread,
Mar 5, 2014, 10:10:03 PM3/5/14
to linux...@googlegroups.com
Hi Pat,

I was not be able to get serial port access yet, work in progress.

Regarding the syntax, what are the correct ones?

thanks,
-Hunter

Patrick Wood

unread,
Mar 5, 2014, 10:35:06 PM3/5/14
to linux...@googlegroups.com
fatload nand 0 kernel_address kernel_file

Note that my u-boot is based on a heavily-modified version of the one used by android.

hunter hu

unread,
Mar 5, 2014, 11:13:45 PM3/5/14
to linux...@googlegroups.com
Thanks Pat,

I have used the correct syntax, but still, stuck at the SUNXI logo; at this moment I have a few questions:

1> my cpu is A13, your u-boot is for A20, I would think that is not working for me?

2> I have been using lichee-dev, sun5i_a13 board, trying to modify the configurations as shown before;  when I was adding my board to the u-boot-sunxi, I had to add a dram_myboard.c to configure the DRAM by following the sunxi wiki instructions, I tried to do with and without the DRAM stuff, the same, stuck at the logo, I believe I have to get the serial port working first.

Thank you very much for all help so far, I greatly appreciated.

-Hunter

hunter hu

unread,
Mar 7, 2014, 6:09:41 PM3/7/14
to linux...@googlegroups.com
Hi,

I finally got the serial port working on my board, just a side note, we need a pull up resistor at the Rx pin, and I am using UART1 with SD card approach, anyone struggles with serial port, here is the thread that helped me: https://www.olimex.com/forum/index.php?topic=1788.0

All goes well with the SD u-boot and I can stop at u-boot prompt and play with it, booting up as usual too by typing boot.

However when I set the NAND stuff up with lichee-dev u-boot built out of sun5i_a13, there is no serial output at all upon boot and stuck at logo, which indicates something is wrong with the u-boot image and it didn't run as expected.

I also tried just use the stock android u-boot, some posts say we can stop android u-boot when booting up, I didn't see that happen either.

Any ideas how to proceed from here would be greatly appreciated.

Thanks in advance,
-Hunter

hunter hu

unread,
Mar 14, 2014, 11:42:22 AM3/14/14
to linux...@googlegroups.com
Hi,

OK, I think I need to close the topic and drew a conclusion:

The conclusion is: my board in question, which is an IView435TPC, doesn't allow any hacking on NAND by doing something magic inside closed source boot1.

The conclusion fis based on my following observations:

  1. I have tried Installing to NAND sunxi wiki instructions, it works fine.  just git checkout lichee-dev, make the CONFIG_BOOTCOMMAND changes with fatload inside include/configs/sun5i_a13.h, basically that is the line we put inside boot.cmd for boot.scr.  No need to do any dram configurations as we want to do in sd card boot case.
  2. when I was using nand-part tool to repartition the internal NAND, the last re-read partition table command returns -1 on the iview tablet, but return 0 on Olimex a13 board, which indicates something is going on in the iview nand.
  3. I could see no debugging output from serial when hooking up with UART1 on the iview, but everything is OK on Olimex NAND, I can see boot0 loading messages, as well as lichee-dev uboot, and my uImage output.
So, the lesson learned here is for some of the commercial tablets out there, they must have put some magic keys/encryptions to lock down their internal NAND to prevent any hacking or manipulations, no debug output from serial is a very good sign of such lock down.

Hope these notes are helpful to someone, and my appreciations to all the help from you guys.

Cheers,
-Hunter

Olliver Schinagl

unread,
Mar 21, 2014, 4:02:12 PM3/21/14
to linux...@googlegroups.com
On 03/14/2014 04:42 PM, hunter hu wrote:
> Hi,
>
> OK, I think I need to close the topic and drew a conclusion:
>
> The conclusion is: my board in question, which is an IView435TPC,
> doesn't allow any hacking on NAND by doing something magic inside closed
> source boot1.
>
> The conclusion fis based on my following observations:
>
> 1. I have tried Installing to NAND sunxi wiki instructions, it works
> fine. just git checkout lichee-dev, make the CONFIG_BOOTCOMMAND
> changes with fatload inside include/configs/sun5i_a13.h, basically
> that is the line we put inside boot.cmd for boot.scr. No need to do
> any dram configurations as we want to do in sd card boot case.
correct, dram is initialized by boot0/boot1
> 2. when I was using nand-part tool to repartition the internal NAND,
> the last re-read partition table command returns -1 on the iview
> tablet, but return 0 on Olimex a13 board, which indicates something
> is going on in the iview nand.
nand-part may simply not support the newer version of libnand used on
this tablet
> 3. I could see no debugging output from serial when hooking up with
> UART1 on the iview, but everything is OK on Olimex NAND, I can see
> boot0 loading messages, as well as lichee-dev uboot, and my uImage
> output.
Closed blobs make you cry. You probably have an incompatible libnand.
But fear not, the mtd driver is very slowly progressing. A year from now
we might be thinking 'oh, heh, good riddens libnand is gone'.

>
> So, the lesson learned here is for some of the commercial tablets out
> there, they must have put some magic keys/encryptions to lock down their
> internal NAND to prevent any hacking or manipulations, no debug output
> from serial is a very good sign of such lock down.
You are the very first one that 'might' (unlikly) have a locked down
nand. I sincerly doubt it's locked down at all.

Olliver
> --
> You received this message because you are subscribed to the Google
> Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to linux-sunxi...@googlegroups.com
> <mailto:linux-sunxi...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages