* [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload
@ 2011-03-29 16:14 Nicholas Kinar
2011-03-29 17:37 ` Nicholas Kinar
0 siblings, 1 reply; 14+ messages in thread
From: Nicholas Kinar @ 2011-03-29 16:14 UTC (permalink / raw)
To: u-boot
Hello,
I've designed a custom circuit board based around the AT91SAM9RL64
processor from Atmel. This is an ARM9 AT91SAM9 series chip. The Atmel
evaluation kit for this processor is supported by U-Boot, and the
configuration header file can be found in the u-boot-2010.09 source code
distribution (/include/configs/at91sam9rlek.h).
To support my custom hardware, I've made small changes to the
/include/configs/at91sam9rlek.h configuration file and to the files in
the /board/atmel/at91sam9rlek/ directory.
On my custom circuit board, the AT91bootstrap first-order bootloader is
loaded from SPI Dataflash. In turn, the AT91bootstrap code loads U-Boot
to SDRAM memory and then jumps to the load address. The U-Boot binary
is also stored on SPI dataflash. I am able to successfully load U-Boot
on my custom hardware, and I am able to use the nand subsystem commands
to access the NAND flash.
I would like to use the fsload command to load the Linux kernel from a
JFFS2 filesystem written to the NAND flash, but to me it is not
immediately clear what I need to modify in the U-Boot code to be able to
do this. Perhaps the YAFFS filesystem would be more appropriate?
I've found several mailing list threads on a related question, but I
still can't determine how to boot from NAND flash. Does fsload only
support NOR flash, or is it possible to use fsload on NAND flash?
[1] http://lists.denx.de/pipermail/u-boot/2007-December/027578.html
[2] http://www.mail-archive.com/u-boot at lists.denx.de/msg28173.html
[3] http://old.nabble.com/NAND-boot-from-file-td7930776.html
[4]
http://blackfin.uclinux.org/gf/project/u-boot/forum/?_forum_action=ForumMessageBrowse&thread_id=17711&action=ForumBrowse
As suggested in thread [4] above, I tried replacing jffs2_1pass.c with
jffs2_nand_1pass.c in the fs/jffs2 directory.
Also as instructed in the README.NAND, README.JFFS2 and
README.JFFS2_NAND files found in the /doc/ directory, I've tried
defining the following in my
/include/configs/at91sam9rlek.h configuration file:
#define CONFIG_JFFS2_NAND 1
#define CONFIG_CMD_JFFS2
#define CONFIG_SYS_MAX_FLASH_BANKS 1
#define CONFIG_CMD_NAND 1
However, after making these changes, the compilation process does not
work, with the following error being reported:
make[1]: Entering directory
`/home/nkinar/DEVICE-CODE/uboot/u-boot-2010.09/common'
arm-none-linux-gnueabi-gcc -g -Os -fno-common -ffixed-r8
-msoft-float -D__KERNEL__ -DTEXT_BASE=0x23f00000
-I/home/nkinar/DEVICE-CODE/uboot/u-boot-2010.09/include -fno-builtin
-ffreestanding -nostdinc -isystem
/home/nkinar/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.5.1/include
-pipe -DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux
-mno-thumb-interwork -march=armv5te -Wall -Wstrict-prototypes
-fno-stack-protector \
-o cmd_jffs2.o cmd_jffs2.c -c
cmd_jffs2.c: In function 'mtd_device_validate':
cmd_jffs2.c:172:24: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'flash_info'
cmd_jffs2.c:172:24: error: 'flash_info' undeclared (first use in this
function)
cmd_jffs2.c:172:24: note: each undeclared identifier is reported only
once for each function it appears in
cmd_jffs2.c:172:35: error: expected expression before ']' token
cmd_jffs2.c: In function 'get_part_sector_size_nor':
cmd_jffs2.c:275:22: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'flash_info'
cmd_jffs2.c:275:22: error: 'flash_info' undeclared (first use in this
function)
cmd_jffs2.c:275:33: error: expected expression before ']' token
cmd_jffs2.c:279:2: error: 'flash_info_t' undeclared (first use in this
function)
cmd_jffs2.c:279:16: error: 'flash' undeclared (first use in this function)
make[1]: *** [cmd_jffs2.o] Error 1
make[1]: Leaving directory
`/home/nkinar/DEVICE-CODE/uboot/u-boot-2010.09/common'
make: *** [common/libcommon.a] Error 2
What do I need to update in U-Boot to be able to use fsload on my custom
hardware?
^ permalink raw reply [flat|nested] 14+ messages in thread* [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload 2011-03-29 16:14 [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload Nicholas Kinar @ 2011-03-29 17:37 ` Nicholas Kinar 2011-03-29 17:56 ` Scott Wood 0 siblings, 1 reply; 14+ messages in thread From: Nicholas Kinar @ 2011-03-29 17:37 UTC (permalink / raw) To: u-boot On 29/03/2011 10:14 AM, Nicholas Kinar wrote: > Also as instructed in the README.NAND, README.JFFS2 and > README.JFFS2_NAND files found in the /doc/ directory, I've tried > defining the following in my > /include/configs/at91sam9rlek.h configuration file: > > #define CONFIG_JFFS2_NAND 1 > #define CONFIG_CMD_JFFS2 > #define CONFIG_SYS_MAX_FLASH_BANKS 1 > #define CONFIG_CMD_NAND 1 > I've now added the following #undef to the list of defines above: #undef CONFIG_CMD_FLASH Now after typing "help" at the U-Boot command line, I can finally see the fsload command listed. However running fsload gives the following error: U-Boot> fsload support for FLASH devices not present incorrect device: nor0 This appears to be due to some code in the /common/cmd_jffs2.c file. Can fsload be only used for NOR memory, or is there a way to use it for NAND flash as well? ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload 2011-03-29 17:37 ` Nicholas Kinar @ 2011-03-29 17:56 ` Scott Wood 2011-03-29 20:35 ` Nicholas Kinar 0 siblings, 1 reply; 14+ messages in thread From: Scott Wood @ 2011-03-29 17:56 UTC (permalink / raw) To: u-boot On Tue, 29 Mar 2011 11:37:25 -0600 Nicholas Kinar <n.kinar@usask.ca> wrote: > On 29/03/2011 10:14 AM, Nicholas Kinar wrote: > > Also as instructed in the README.NAND, README.JFFS2 and > > README.JFFS2_NAND files found in the /doc/ directory, I've tried > > defining the following in my > > /include/configs/at91sam9rlek.h configuration file: > > > > #define CONFIG_JFFS2_NAND 1 > > #define CONFIG_CMD_JFFS2 > > #define CONFIG_SYS_MAX_FLASH_BANKS 1 > > #define CONFIG_CMD_NAND 1 > > > > I've now added the following #undef to the list of defines above: > > #undef CONFIG_CMD_FLASH > > Now after typing "help" at the U-Boot command line, I can finally see > the fsload command listed. However running fsload gives the following > error: > > U-Boot> fsload > support for FLASH devices not present > incorrect device: nor0 > > This appears to be due to some code in the /common/cmd_jffs2.c file. > Can fsload be only used for NOR memory, or is there a way to use it for > NAND flash as well? "support for FLASH devices not present" is printed when it's trying to act on a device labelled as NOR, but there's no NOR support present. Try the "chpart" command to switch to a NAND device, and/or make sure that your mtdparts variable is set correctly. -Scott ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload 2011-03-29 17:56 ` Scott Wood @ 2011-03-29 20:35 ` Nicholas Kinar 2011-03-29 20:46 ` Scott Wood 2011-03-29 21:05 ` Wolfgang Denk 0 siblings, 2 replies; 14+ messages in thread From: Nicholas Kinar @ 2011-03-29 20:35 UTC (permalink / raw) To: u-boot On 29/03/2011 11:56 AM, Scott Wood wrote: > On Tue, 29 Mar 2011 11:37:25 -0600 > Nicholas Kinar<n.kinar@usask.ca> wrote: > >> On 29/03/2011 10:14 AM, Nicholas Kinar wrote: >>> Also as instructed in the README.NAND, README.JFFS2 and >>> README.JFFS2_NAND files found in the /doc/ directory, I've tried >>> defining the following in my >>> /include/configs/at91sam9rlek.h configuration file: >>> >>> #define CONFIG_JFFS2_NAND 1 >>> #define CONFIG_CMD_JFFS2 >>> #define CONFIG_SYS_MAX_FLASH_BANKS 1 >>> #define CONFIG_CMD_NAND 1 >>> >> I've now added the following #undef to the list of defines above: >> >> #undef CONFIG_CMD_FLASH >> >> Now after typing "help" at the U-Boot command line, I can finally see >> the fsload command listed. However running fsload gives the following >> error: >> >> U-Boot> fsload >> support for FLASH devices not present >> incorrect device: nor0 >> >> This appears to be due to some code in the /common/cmd_jffs2.c file. >> Can fsload be only used for NOR memory, or is there a way to use it for >> NAND flash as well? > "support for FLASH devices not present" is printed when it's trying to act > on a device labelled as NOR, but there's no NOR support present. > > Try the "chpart" command to switch to a NAND device, and/or make sure that > your mtdparts variable is set correctly. > > -Scott > Thank you very much for your response, Scott; this is greatly appreciated! To compile in support for the "chpart" command, I've now added the following to my /include/configs/at91sam9rlek.h file: #define CFG_NAND_BOOT #define CONFIG_JFFS2_NAND 1 #define CONFIG_JFFS2_CMDLINE #define CONFIG_CMD_JFFS2 #define CONFIG_CMD_MTDPARTS #define CONFIG_MTD_DEVICE #define MTDIDS_DEFAULT "nand0=nand_flash" #define MTDPARTS_DEFAULT "mtdparts=nand_flash:-(jffs2)" #define CONFIG_SYS_MAX_FLASH_BANKS 1 #undef CONFIG_CMD_FLASH U-boot compiles cleanly, but I find that after U-Boot loads on my embedded hardware, the "mtdids" and "mtdparts" variables are not set in the U-Boot environment. However, since these are environment variables, I find that this can be done at the U-Boot command line: U-Boot> nand info Device 0: nand0, sector size 256 KiB U-Boot> setenv mtdids nand0=nand_flash U-Boot> setenv mtdparts mtdparts=nand_flash:-(jffs2) U-Boot> chpart nand0,0 partition changed to nand0,0 U-Boot> ls Scanning JFFS2 FS: ls: Failed to scan JFFSv2 file structure U-Boot> fsload ### JFFS2 loading 'uImage' to 0x22000000 Scanning JFFS2 FS: load: Failed to scan JFFSv2 file structure ### JFFS2 LOAD ERROR<0> for uImage! Of course, fsload cannot load the uImage, since I am working with a blank flash and there is no image pre-loaded on the flash. Using the "saveenv" command, I intend to save these environment variables. Continuing on, I will load an image on the blank flash, and then I will try to load the Linux kernel. I will then post my results on this mailing list as a response. I have two additional questions associated with booting the kernel from NAND flash on my custom hardware: (1) Does replacing jffs2_1pass.c with jffs2_nand_1pass.c in the fs/jffs2 directory influence the robustness of the fsload code? (2) Does it take a long time to load the Linux kernel from a JFFS2 filesystem on NAND flash using the fsload command (i.e. http://old.nabble.com/Performance-in-Booting-Linux-w--Device-Tree-via-U-Boot-out-of-JFFS2-on-NAND-td15879327.html), or has this been cleaned up in the current u-boot-2010.09 code? Nicholas ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload 2011-03-29 20:35 ` Nicholas Kinar @ 2011-03-29 20:46 ` Scott Wood 2011-03-29 20:57 ` Nicholas Kinar 2011-03-29 21:05 ` Wolfgang Denk 1 sibling, 1 reply; 14+ messages in thread From: Scott Wood @ 2011-03-29 20:46 UTC (permalink / raw) To: u-boot On Tue, 29 Mar 2011 14:35:26 -0600 Nicholas Kinar <n.kinar@usask.ca> wrote: > I have two additional questions associated with booting the kernel from > NAND flash on my custom hardware: > > (1) Does replacing jffs2_1pass.c with jffs2_nand_1pass.c in the fs/jffs2 > directory influence the robustness of the fsload code? > > (2) Does it take a long time to load the Linux kernel from a JFFS2 > filesystem on NAND flash using the fsload command (i.e. > http://old.nabble.com/Performance-in-Booting-Linux-w--Device-Tree-via-U-Boot-out-of-JFFS2-on-NAND-td15879327.html), > or has this been cleaned up in the current u-boot-2010.09 code? I haven't used U-Boot's jffs2 support (the previous answer was from reading the source code), so I can't help here, sorry. -Scott ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload 2011-03-29 20:46 ` Scott Wood @ 2011-03-29 20:57 ` Nicholas Kinar 0 siblings, 0 replies; 14+ messages in thread From: Nicholas Kinar @ 2011-03-29 20:57 UTC (permalink / raw) To: u-boot On 29/03/2011 2:46 PM, Scott Wood wrote: > On Tue, 29 Mar 2011 14:35:26 -0600 > Nicholas Kinar<n.kinar@usask.ca> wrote: > >> I have two additional questions associated with booting the kernel from >> NAND flash on my custom hardware: >> >> (1) Does replacing jffs2_1pass.c with jffs2_nand_1pass.c in the fs/jffs2 >> directory influence the robustness of the fsload code? >> >> (2) Does it take a long time to load the Linux kernel from a JFFS2 >> filesystem on NAND flash using the fsload command (i.e. >> http://old.nabble.com/Performance-in-Booting-Linux-w--Device-Tree-via-U-Boot-out-of-JFFS2-on-NAND-td15879327.html), >> or has this been cleaned up in the current u-boot-2010.09 code? > I haven't used U-Boot's jffs2 support (the previous answer was from reading > the source code), so I can't help here, sorry. > > -Scott > > That is fine, Scott; your previous answer was extremely helpful, and I think that I am now well on my way to booting the Linux kernel from NAND flash on my new embedded system. Thanks again, Nicholas ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload 2011-03-29 20:35 ` Nicholas Kinar 2011-03-29 20:46 ` Scott Wood @ 2011-03-29 21:05 ` Wolfgang Denk 2011-03-29 21:46 ` Nicholas Kinar 2011-03-30 7:17 ` Joakim Tjernlund 1 sibling, 2 replies; 14+ messages in thread From: Wolfgang Denk @ 2011-03-29 21:05 UTC (permalink / raw) To: u-boot Dear Nicholas Kinar, In message <4D92428E.6030503@usask.ca> you wrote: > > (1) Does replacing jffs2_1pass.c with jffs2_nand_1pass.c in the fs/jffs2 > directory influence the robustness of the fsload code? JFFS2 is more or less deprecated these days. FOr new projects, we recommend to use UBI/ UBIFS instead. > (2) Does it take a long time to load the Linux kernel from a JFFS2 > filesystem on NAND flash using the fsload command (i.e. JFFS2 has always been slow, especially when mounting larger file systems. This is one of the resons we recommend UBIFS instead. > or has this been cleaned up in the current u-boot-2010.09 code? v2010.09 is in no way "current". The latest release available at this moment is v2010.12, and v2011.03 is a mere few days aways. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de It seems intuitively obvious to me, which means that it might be wrong. -- Chris Torek ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload 2011-03-29 21:05 ` Wolfgang Denk @ 2011-03-29 21:46 ` Nicholas Kinar 2011-03-29 21:51 ` Wolfgang Denk 2011-03-30 7:17 ` Joakim Tjernlund 1 sibling, 1 reply; 14+ messages in thread From: Nicholas Kinar @ 2011-03-29 21:46 UTC (permalink / raw) To: u-boot On 29/03/2011 3:05 PM, Wolfgang Denk wrote: > Dear Nicholas Kinar, > > In message<4D92428E.6030503@usask.ca> you wrote: >> (1) Does replacing jffs2_1pass.c with jffs2_nand_1pass.c in the fs/jffs2 >> directory influence the robustness of the fsload code? > JFFS2 is more or less deprecated these days. FOr new projects, we > recommend to use UBI/ UBIFS instead. > >> (2) Does it take a long time to load the Linux kernel from a JFFS2 >> filesystem on NAND flash using the fsload command (i.e. > JFFS2 has always been slow, especially when mounting larger file > systems. This is one of the resons we recommend UBIFS instead. > >> or has this been cleaned up in the current u-boot-2010.09 code? > v2010.09 is in no way "current". The latest release available at this > moment is v2010.12, and v2011.03 is a mere few days aways. > > Best regards, > > Wolfgang Denk > Thanks for your response, Wolfgang - I will switch the file system to UBI/UBIFS, and then post back what I've done. I've been looking in the include/configs/sheevaplug.h directory, and I think that this small embedded computer is now using UBIFS as the NAND flash file system. So changing the configs for my embedded system should be reasonably straightforward. I would assume that the "fsload" command will also work with UBIFS as well. In my custom system, At91Bootstrap is situated on SPI Dataflash. The At91Bootstrap loads U-Boot from the same Dataflash. Then, I would like U-Boot to load the Linux kernel from the UBI file system on a large 2 GByte NAND flash. This should be much better than using JFFS2 on the large NAND flash. Nicholas ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload 2011-03-29 21:46 ` Nicholas Kinar @ 2011-03-29 21:51 ` Wolfgang Denk 2011-04-02 17:38 ` Nicholas Kinar 0 siblings, 1 reply; 14+ messages in thread From: Wolfgang Denk @ 2011-03-29 21:51 UTC (permalink / raw) To: u-boot Dear Nicholas Kinar, In message <4D92531E.4030206@usask.ca> you wrote: > > I would assume that the "fsload" command will also work with UBIFS as well. No. UBIFS uses it's own command set; you will use "ubifsload" instead. > In my custom system, At91Bootstrap is situated on SPI Dataflash. The > At91Bootstrap loads U-Boot from the same Dataflash. Then, I would like > U-Boot to load the Linux kernel from the UBI file system on a large 2 > GByte NAND flash. This should be much better than using JFFS2 on the > large NAND flash. Indeed. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "One day," said a dull voice from down below, "I'm going to be back in form again and you're going to be very sorry you said that. For a very long time. I might even go so far as to make even more Time just for you to be sorry in." - Terry Pratchett, _Small Gods_ ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload 2011-03-29 21:51 ` Wolfgang Denk @ 2011-04-02 17:38 ` Nicholas Kinar 2011-04-03 1:50 ` Nicholas Kinar 0 siblings, 1 reply; 14+ messages in thread From: Nicholas Kinar @ 2011-04-02 17:38 UTC (permalink / raw) To: u-boot On 11-03-29 03:46 PM, Nicholas Kinar wrote: >> Thanks for your response, Wolfgang - I will switch the file system to >> UBI/UBIFS, and then post back what I've done. I've been looking in the >> include/configs/sheevaplug.h directory, and I think that this small >> embedded computer is now using UBIFS as the NAND flash file system. So >> changing the configs for my embedded system should be reasonably >> straightforward. >> On 11-03-29 03:51 PM, Wolfgang Denk wrote: > Dear Nicholas Kinar, > > In message<4D92531E.4030206@usask.ca> you wrote: >> I would assume that the "fsload" command will also work with UBIFS as well. > No. UBIFS uses it's own command set; you will use "ubifsload" instead. > >> In my custom system, At91Bootstrap is situated on SPI Dataflash. The >> At91Bootstrap loads U-Boot from the same Dataflash. Then, I would like >> U-Boot to load the Linux kernel from the UBI file system on a large 2 >> GByte NAND flash. This should be much better than using JFFS2 on the >> large NAND flash. > Indeed. > > Best regards, > > Wolfgang Denk > Thanks again for your help, Wolfgang; this is greatly appreciated. I've now set up U-Boot so that I can read and mount UBI partitions on my NAND flash. (Booting the kernel from UBI is another matter - see below for further details.) Qualitatively, I find that UBI mounts much quicker than JFFS2, and I will be using this file system for my new embedded system. To turn on U-Boot support, I had to include the following defines in my board config file. After doing so, I was able see the ubi commands after typing the U-Boot help command. These are the defines from my board config file: #define CONFIG_CMD_NAND #define CONFIG_CMD_UBI #define CONFIG_CMD_UBIFS #define CONFIG_RBTREE #define CONFIG_MTD_DEVICE #define CONFIG_MTD_PARTITIONS #define CONFIG_CMD_MTDPARTS #define CONFIG_LZO I set up three partitions on the NAND flash by defining the mtdids and mtdparts environment variables. Here is the output of the "mtdparts" command in U-Boot: U-Boot> mtdparts device nand0 <flash>, # parts = 3 #: name size offset mask_flags 0: kernel 0x00a00000 0x00000000 0 1: root 0x06400000 0x00a00000 0 2: storage 0x79200000 0x06e00000 0 active partition: nand0,0 - (kernel) 0x00a00000 @ 0x00000000 defaults: mtdids : nand0=flash mtdparts: mtdparts=flash:10M(kernel),100M(root),-(storage) Then, I switched to each partition using the ubi part commands. After switching to each partition, I created a volume on each partition. The sequence of commands are shown below. Each command completed successfully without errors: U-Boot> ubi part kernel U-Boot> ubi create container U-Boot> ubi part root U-Boot> ubi create container U-Boot> ubi part storage U-Boot> ubi create container On the host Linux system, I created kernel and root image files using the mkfs.ubifs command-line tools (compiled from git): mkfs.ubifs -x none -r ./images -m 4096 -e 258048 -c 43 -U -v -o kernel.img mkfs.ubifs -x none -r ./target -m 4096 -e 258048 -c 450 -U -v -o root.img These image files were transferred to the target system over the serial port using the U-Boot "loadb" command. The image files were then copied to each UBI partition using the "ubi write" command. By using the "ubifsmount" command, I am able to mount each of the "container" partitions and read the contents using the "ubifsls" command. For example: U-Boot> ubi part kernel Creating 1 MTD partitions on "nand0": 0x000000000000-0x000000a00000 : "mtd=0" UBI: attaching mtd1 to ubi0 UBI: physical eraseblock size: 262144 bytes (256 KiB) UBI: logical eraseblock size: 258048 bytes UBI: smallest flash I/O unit: 4096 UBI: sub-page size: 1024 UBI: VID header offset: 1024 (aligned 1024) UBI: data offset: 4096 UBI: attached mtd1 to ubi0 UBI: MTD device name: "mtd=0" UBI: MTD device size: 10 MiB UBI: number of good PEBs: 40 UBI: number of bad PEBs: 0 UBI: max. allowed volumes: 128 UBI: wear-leveling threshold: 4096 UBI: number of internal volumes: 1 UBI: number of user volumes: 1 UBI: available PEBs: 0 UBI: total number of reserved PEBs: 40 UBI: number of PEBs reserved for bad PEB handling: 2 UBI: max/mean erase counter: 4/1 U-Boot> ubifsmount container UBIFS: mounted UBI device 0, volume 0, name "container" UBIFS: mounted read-only UBIFS: file system size: 6193152 bytes (6048 KiB, 5 MiB, 24 LEBs) UBIFS: journal size: 2322433 bytes (2268 KiB, 2 MiB, 8 LEBs) UBIFS: media format: w4/r0 (latest is w4/r0) UBIFS: default compressor: no compression UBIFS: reserved for root: 0 bytes (0 KiB) U-Boot> ubifsls 1256920 Thu Mar 31 16:19:57 2011 uImage I then used the "ubifsload" command to load the uImage into SDRAM memory: U-Boot> ubifsload 0x22000000 uImage Loading file 'uImage' to addr 0x22000000 with size 1256920 (0x00132dd8)... Done The "bootargs" environment variable was set to be the following: U-Boot> setenv bootargs console=ttyS0,115200 rootfstype=ubifs ubi.mtd=1 root=ubi0:container mtdparts=flash:10M(kernel),100M(root),-(storage) However, after running the "bootm" command, I find that I cannot boot the Linux kernel, and the booting process hangs: U-Boot> bootm ## Booting kernel from Legacy Image at 22000000 ... Image Name: Linux-2.6.37 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1256856 Bytes = 1.2 MiB Load Address: 20008000 Entry Point: 20008000 Verifying Checksum ... OK Loading Kernel Image ... OK OK Starting kernel ... In the Linux kernel xconfig, I've switched on support for UBI and UBIFS. I am wondering what might be the problem here. Are the bootargs being passed properly to the Linux kernel? Nicholas ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload 2011-04-02 17:38 ` Nicholas Kinar @ 2011-04-03 1:50 ` Nicholas Kinar 2011-04-04 1:25 ` Nicholas Kinar 0 siblings, 1 reply; 14+ messages in thread From: Nicholas Kinar @ 2011-04-03 1:50 UTC (permalink / raw) To: u-boot Nicholas Kinar wrote: > I then used the "ubifsload" command to load the uImage into SDRAM memory: > U-Boot> ubifsload 0x22000000 uImage > Loading file 'uImage' to addr 0x22000000 with size 1256920 (0x00132dd8)... > Done > > The "bootargs" environment variable was set to be the following: > > U-Boot> setenv bootargs console=ttyS0,115200 rootfstype=ubifs ubi.mtd=1 > root=ubi0:container mtdparts=flash:10M(kernel),100M(root),-(storage) > > However, after running the "bootm" command, I find that I cannot boot > the Linux kernel, and the booting process hangs: > > U-Boot> bootm > ## Booting kernel from Legacy Image at 22000000 ... > Image Name: Linux-2.6.37 > Image Type: ARM Linux Kernel Image (uncompressed) > Data Size: 1256856 Bytes = 1.2 MiB > Load Address: 20008000 > Entry Point: 20008000 > Verifying Checksum ... OK > Loading Kernel Image ... OK > OK > > Starting kernel ... > > In the Linux kernel xconfig, I've switched on support for UBI and > UBIFS. I am wondering what might be the problem here. Are the bootargs > being passed properly to the Linux kernel? > > Nicholas > I now strongly believe that the bootargs are not being passed in properly to the kernel. Having found a posting on the AT91 website [1], I now realize that the Linux kernel has been built with a load address of 0x20008000, but must be loaded to different address 0x20080000. Posting: [1] http://www.at91.com/forum/viewtopic.php/f,12/t,5038/start,0/st,0/sk,t/sd,a/ Now the kernel boots, but as shown below a kernel panic occurs, so I think that the issue might be due to the "root=ubi0:container" bootarg. How would I set the root bootarg for this particular NAND flash filesystem? My mtdparts is the following: U-Boot> mtdparts device nand0 <flash>, # parts = 3 #: name size offset mask_flags 0: kernel 0x00a00000 0x00000000 0 1: root 0x06400000 0x00a00000 0 2: storage 0x79200000 0x06e00000 0 active partition: nand0,0 - (kernel) 0x00a00000 @ 0x00000000 defaults: mtdids : nand0=flash mtdparts: mtdparts=flash:10M(kernel),100M(root),-(storage) Now booting the kernel: U-Boot> bootm 0x20080000 ## Booting kernel from Legacy Image at 20080000 ... Image Name: Linux-2.6.37 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1256880 Bytes = 1.2 MiB Load Address: 20008000 Entry Point: 20008000 Verifying Checksum ... OK Loading Kernel Image ... OK OK Starting kernel ... Uncompressing Linux... done, booting the kernel. Linux version 2.6.37 (nkinar at matilda) (gcc version 4.3.5 (Buildroot 2011.02) ) #3 Sat Apr 2 17:28:21 CST 2011 CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177 CPU: VIVT data cache, VIVT instruction cache Machine: Atmel AT91SAM9RL-EK Memory policy: ECC disabled, Data cache writeback Clocks: CPU 200 MHz, master 100 MHz, main 12.000 MHz Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 Kernel command line: console=ttyS0,115200 root=ubi0:container mtdparts=flash:10M(kernel),100M(root),-(storage) rw rootfstype =ubifs PID hash table entries: 256 (order: -2, 1024 bytes) Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) Memory: 64MB = 64MB total Memory: 62348k/62348k available, 3188k reserved, 0K highmem Virtual kernel memory layout: vector : 0xffff0000 - 0xffff1000 ( 4 kB) fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) DMA : 0xffc00000 - 0xffe00000 ( 2 MB) vmalloc : 0xc4800000 - 0xfee00000 ( 934 MB) lowmem : 0xc0000000 - 0xc4000000 ( 64 MB) modules : 0xbf000000 - 0xc0000000 ( 16 MB) .init : 0xc0008000 - 0xc0023000 ( 108 kB) .text : 0xc0023000 - 0xc025537c (2249 kB) .data : 0xc0256000 - 0xc026e3e0 ( 97 kB) NR_IRQS:192 AT91: 128 gpio irqs in 4 banks Console: colour dummy device 80x30 console [ttyS0] enabled Calibrating delay loop... 99.53 BogoMIPS (lpj=497664) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 512 CPU: Testing write buffer coherency: ok NET: Registered protocol family 16 bio: create slab <bio-0> at 0 SCSI subsystem initialized i2c-gpio i2c-gpio: using pins 55 (SDA) and 56 (SCL) Switching to clocksource pit NET: Registered protocol family 1 msgmni has been set to 121 io scheduler noop registered (default) atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL brd: module loaded loop: module loaded NAND device: Manufacturer ID: 0x20, Chip ID: 0xd5 (ST Micro ) Scanning device for bad blocks Bad eraseblock 65 at 0x000001040000 Bad eraseblock 1014 at 0x00000fd80000 Bad eraseblock 1159 at 0x0000121c0000 Bad eraseblock 2072 at 0x000020600000 Bad eraseblock 2536 at 0x000027a00000 Bad eraseblock 2540 at 0x000027b00000 Bad eraseblock 3101 at 0x000030740000 Bad eraseblock 3343 at 0x0000343c0000 Bad eraseblock 3778 at 0x00003b080000 Bad eraseblock 4516 at 0x000046900000 Bad eraseblock 4712 at 0x000049a00000 Bad eraseblock 4807 at 0x00004b1c0000 Bad eraseblock 5254 at 0x000052180000 Bad eraseblock 5256 at 0x000052200000 Bad eraseblock 8149 at 0x00007f540000 Creating 2 MTD partitions on "atmel_nand": 0x000000000000-0x000000040000 : "Partition 1" 0x000000040000-0x000080000000 : "Partition 2" atmel_spi atmel_spi.0: Atmel SPI Controller at 0xfffcc000 (irq 13) mtd_dataflash spi0.0: AT45DB021B (264 KBytes) pagesize 264 bytes (OTP) mice: PS/2 mouse device common for all mice rtc-at91sam9 at91_rtt.0: rtc core: registered at91_rtt as rtc0 rtc-at91sam9 at91_rtt.0: rtc0: SET TIME! i2c /dev entries driver AT91SAM9 Watchdog: sorry, watchdog is disabled at91_wdt: probe of at91_wdt failed with error -5 rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clock VFS: Cannot open root device "ubi0:container" or unknown-block(0,0) Please append a correct "root=" boot option; here are the available partitions: 1f00 256 mtdblock0 (driver?) 1f01 2096896 mtdblock1 (driver?) 1f02 264 mtdblock2 (driver?) Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) [<c0028240>] (unwind_backtrace+0x0/0xec) from [<c01c3dd8>] (panic+0x4c/0x180) [<c01c3dd8>] (panic+0x4c/0x180) from [<c0009064>] (mount_block_root+0x25c/0x2b4) [<c0009064>] (mount_block_root+0x25c/0x2b4) from [<c00091b4>] (prepare_namespace+0x8c/0x1c8) [<c00091b4>] (prepare_namespace+0x8c/0x1c8) from [<c00085ac>] (kernel_init+0x10c/0x150) [<c00085ac>] (kernel_init+0x10c/0x150) from [<c00248c4>] (kernel_thread_exit+0x0/0x8) ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload 2011-04-03 1:50 ` Nicholas Kinar @ 2011-04-04 1:25 ` Nicholas Kinar 0 siblings, 0 replies; 14+ messages in thread From: Nicholas Kinar @ 2011-04-04 1:25 UTC (permalink / raw) To: u-boot Nicholas Kinar wrote: > > I now strongly believe that the bootargs are not being passed in > properly to the kernel. Having found a posting on the AT91 website [1], > I now realize that the Linux kernel has been built with a load address > of 0x20008000, but must be loaded to different address 0x20080000. > > Posting: > [1] > http://www.at91.com/forum/viewtopic.php/f,12/t,5038/start,0/st,0/sk,t/sd,a/ > > Now the kernel boots, but as shown below a kernel panic occurs, so I > think that the issue might be due to the "root=ubi0:container" bootarg. > How would I set the root bootarg for this particular NAND flash filesystem? > Yes, this was exactly the issue; the environment variables were not getting passed in properly to the kernel. Here are the environment variables that I used to successfully boot the Linux kernel: bootargs=noinitrd console=ttyS0,115200 ubi.mtd=1 root=ubi0:rootfs mtdparts=flash:10M(kernel),100M(root),-(storage) rw rootfstype=ubifs nand-boot=ubi part kernel; ubifsmount kernelfs; ubifsload 0x20080000 uImage; bootm 0x20080000 bootcmd=run nand-boot Note that on my setup, "root=ubi0:rootfs", where "rootfs" is the name of the volume on the UBI "root" partition, which is indicated by "ubi.mtd=1". The UBI device being used in the system is "ubi0". I've also checked to see if support for UBIFS and UBI are compiled into the kernel (and not loaded as a module). I had to pass "noinitrd" to ensure that the kernel detected the UBI file system on the flash. In addition, as shown in a U-Boot tutorial (http://free-electrons.com/doc/u-boot.pdf), I was able to use a nice script (nand-boot) that runs from the bootcmd. So thank you very much to those on this mailing list who helped me to get started with this! Nicholas ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload 2011-03-29 21:05 ` Wolfgang Denk 2011-03-29 21:46 ` Nicholas Kinar @ 2011-03-30 7:17 ` Joakim Tjernlund 2011-03-30 8:54 ` Wolfgang Denk 1 sibling, 1 reply; 14+ messages in thread From: Joakim Tjernlund @ 2011-03-30 7:17 UTC (permalink / raw) To: u-boot > > Dear Nicholas Kinar, > > In message <4D92428E.6030503@usask.ca> you wrote: > > > > (1) Does replacing jffs2_1pass.c with jffs2_nand_1pass.c in the fs/jffs2 > > directory influence the robustness of the fsload code? > > JFFS2 is more or less deprecated these days. FOr new projects, we > recommend to use UBI/ UBIFS instead. JFFS2 deprecated? It is very stable and works well for NOR based filesystems. Do you use UBIFS for NOR as well these days? > > > (2) Does it take a long time to load the Linux kernel from a JFFS2 > > filesystem on NAND flash using the fsload command (i.e. > > JFFS2 has always been slow, especially when mounting larger file > systems. This is one of the resons we recommend UBIFS instead. The u-boot impl. is a bad version of the one in linux. The u-boot version should be rewritten/fixed to match current Linux. Jocke ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload 2011-03-30 7:17 ` Joakim Tjernlund @ 2011-03-30 8:54 ` Wolfgang Denk 0 siblings, 0 replies; 14+ messages in thread From: Wolfgang Denk @ 2011-03-30 8:54 UTC (permalink / raw) To: u-boot Dear Joakim Tjernlund, In message <OFA7DEB7BE.7D093C64-ONC1257863.0027BEFD-C1257863.00281994@transmode.se> you wrote: > > JFFS2 deprecated? It is very stable and works well for NOR based filesystems. Yes, we consider it deprecated, and we do not use it in any new projects / products. > Do you use UBIFS for NOR as well these days? Yes, we do. [And yes, we know about the problems it has in certain configurations, but 1) these are pretty rare these days and 2) we are working on fixes.] > > JFFS2 has always been slow, especially when mounting larger file > > systems. This is one of the resons we recommend UBIFS instead. > > The u-boot impl. is a bad version of the one in linux. The u-boot > version should be rewritten/fixed to match current Linux. Patches welcome. Nevertheless, the Linux mount times for JFFS2 are still slower than UBIFS times, aren't they? Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "A fractal is by definition a set for which the Hausdorff Besicovitch dimension strictly exceeds the topological dimension." - Mandelbrot, _The Fractal Geometry of Nature_ ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2011-04-04 1:25 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-03-29 16:14 [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload Nicholas Kinar 2011-03-29 17:37 ` Nicholas Kinar 2011-03-29 17:56 ` Scott Wood 2011-03-29 20:35 ` Nicholas Kinar 2011-03-29 20:46 ` Scott Wood 2011-03-29 20:57 ` Nicholas Kinar 2011-03-29 21:05 ` Wolfgang Denk 2011-03-29 21:46 ` Nicholas Kinar 2011-03-29 21:51 ` Wolfgang Denk 2011-04-02 17:38 ` Nicholas Kinar 2011-04-03 1:50 ` Nicholas Kinar 2011-04-04 1:25 ` Nicholas Kinar 2011-03-30 7:17 ` Joakim Tjernlund 2011-03-30 8:54 ` Wolfgang Denk
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox