need smaller filesystem for NOR
I primarily boot from one of two 128Mb NAND areas, but I have an 8Mb NOR failsafe if NAND is bad. I have about 5.5Mb available for the Filesystem after loading at91bootstrap, uboot, uboot-env, and kernel. ...(using buildroot-2011.11)...
The rootfs.jffs2 for NAND is 41Mb.
I need one for NOR that is less than 5.5Mb.
Is there a good method or script to copy buildroot's rootfs.jffs2 to make a smaller copy for NOR?
My first attempt leads to
VFS: Mounted root (jffs2 filesystem) on device 31:1. Freeing init memory: 104K
Warning: unable to open an initial console.
Kernel panic - not syncing: No init found. Try passing init= option to kernel. [<c0028678>] (unwind_backtrace+0x0/0xdc) from [<c0243990>] (panic+0x34/0x110) [<c0243990>] (panic+0x34/0x110) from [<c002254c>] (init_post+0x138/0x170) [<c002254c>] (init_post+0x138/0x170) from [<c0008408>] (kernel_init+0xbc/0xe8) [<c0008408>] (kernel_init+0xbc/0xe8) from [<c003b634>] (do_exit+0x0/0x5a4) [<c003b634>] (do_exit+0x0/0x5a4) from [<00000003>] (0x3)
I think this means the file system is found and mounted, and for some reason, init isn't found, although I have played with init= to no avail, and if I mount my little jffs2, I do see busybox and all the links (/bin/init).
I tried to trying to hack it (unsuccessfully) with a post-build script that tries to do what buildroot does:
#!/bin/bash
TARGET_DIR="${PWD}/output/target" BUILD_DIR="${PWD}/output/build" HOST_DIR="${PWD}/output/host" STAGE_DIR="${PWD}/output/NORtarget" TARGET_IMG="${PWD}/output/images/NORrootfs.jffs2" FILTER_LIST=${PWD}/boarts/atmel/at91sam9g20ek/nor_flash_list.txt ROOTFS_DEVICE_TABLES="${PWD}/target/generic/device_table.txt" FULL_DEVICE_TABLE="$BUILD_DIR/_device_table.txt"
echo "[--] Remove old image: ${TARGET_DIR}"
rm -rf "${TARGET_DIR}"
echo "[--] Coypy into new image"
rsync -a \
--exclude-from=${FILTER_LIST} \
${TARGET_DIR}/ ${STAGE_DIR}
echo "[--] Size of new image:"
du -sh ${STAGE_DIR}
echo "[--] Make device table:"
cat $ROOTFS_DEVICE_TABLES > $FULL_DEVICE_TABLE
FAKEROOT_SCRIPT="#!/bin/bash
chown -R 0:0 ${TARGET_DIR}
${HOST_DIR}/usr/bin/makedevs \
-d ${BUILD_DIR}/_device_table.txt \
${TARGET_DIR}
${HOST_DIR}/usr/sbin/mkfs.jffs2 \
-e 0x20000 -l -s 0x1000 -n \
-d ${TARGET_DIR} \
-o ${TARGET_IMG}
${HOST_DIR}/usr/bin/makedevs \
-d ${BUILD_DIR}/_device_table.txt \
${TARGET_DIR}
"
echo "[--] Call FAKEROOT_SCRIPT"
echo "${FAKEROOT_SCRIPT}"
$HOST_DIR/usr/bin/fakeroot -- /bin/bash -c "${FAKEROOT_SCRIPT}" echo $?
Dear John Stile,
Quoted 22 lines · John Stile
I primarily boot from one of two 128Mb NAND areas, but I have an 8Mb NOR failsafe if NAND is bad. I have about 5.5Mb available for the Filesystem after loading at91bootstrap, uboot, uboot-env, and kernel. ...(using buildroot-2011.11)...
The rootfs.jffs2 for NAND is 41Mb.
I need one for NOR that is less than 5.5Mb.Is there a good method or script to copy buildroot's rootfs.jffs2 to make a smaller copy for NOR?
My first attempt leads to
VFS: Mounted root (jffs2 filesystem) on device 31:1. Freeing init memory: 104K
Warning: unable to open an initial console.Kernel panic - not syncing: No init found. Try passing init= option to kernel. [<c0028678>] (unwind_backtrace+0x0/0xdc) from [<c0243990>] (panic+0x34/0x110) [<c0243990>] (panic+0x34/0x110) from [<c002254c>] (init_post+0x138/0x170) [<c002254c>] (init_post+0x138/0x170) from [<c0008408>] (kernel_init+0xbc/0xe8) [<c0008408>] (kernel_init+0xbc/0xe8) from [<c003b634>] (do_exit+0x0/0x5a4) [<c003b634>] (do_exit+0x0/0x5a4) from [<00000003>] (0x3)
Quoted 4 lines
I think this means the file system is found and mounted, and for some reason, init isn't found, although I have played with init= to no avail, and if I mount my little jffs2, I do see busybox and all the links (
/bin/init).
Beware that if a NAND or NOR partition is empty and properly erase, jffs2 will happily mount it and show a filesystem that contains no file. So the behavior you're seeing here could perfectly happen if your NAND or NOR partition is simply empty.
Quoted 2 lines
I tried to trying to hack it (unsuccessfully) with a post-build script that tries to do what buildroot does:
Rather than doing this, what about having a separate Buildroot project that is used to build your small NOR failsafe filesystem? If it's only a 5.5 MB filesystem, most likely there isn't too much in it. Both Buildroot projects can share the same Buildroot source tree, but be built in different directories.
Let's say ~/buildroot/ contains the Buildroot sources, ~/buildroot/configs/project_defconfig and ~/buildroot/configs/project_failsafe_defconfig are respectively the Buildroot configuration for your full filesystem and for the small failsafe filesystem. Then you can do:
mkdir -p ~/project/full/
cd ~/project/full/
make -C ~/buildroot O=$(pwd) project_defconfig
make
mkdir -p ~/project/failsafe/
cd ~/project/failsafe
make -C ~/buildroot O=$(pwd) project_failsafe_defconfig make
And that's it.
Best regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
John, All,
Quoted 10 lines · On Friday 08 February 2013 John Stile wrote:
I primarily boot from one of two 128Mb NAND areas, but I have an 8Mb NOR failsafe if NAND is bad. I have about 5.5Mb available for the Filesystem after loading at91bootstrap, uboot, uboot-env, and kernel. ...(using buildroot-2011.11)...
The rootfs.jffs2 for NAND is 41Mb.
I need one for NOR that is less than 5.5Mb.Is there a good method or script to copy buildroot's rootfs.jffs2 to make a smaller copy for NOR?
I would simply create a completely separated system from scratch, with only the packages that you need.
For example:
$ make O="$(pwd)/complete_system" complete_defconfig $ make O="$(pwd)/complete_system" $ make O="$(pwd)/failsafe_system" failsafe_defconfig $ make O="$(pwd)/failsafe_system"
And then grab the corresponding images from:
complete_system/images/ <- the full-featured system
failsafe_system/images/ <- the failsafe system
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
Dear Thomas Petazzoni,
Quoted 30 lines · Thomas Petazzoni
Dear John Stile,
Quoted 22 lines · John Stile
I primarily boot from one of two 128Mb NAND areas, but I have an 8Mb NOR failsafe if NAND is bad. I have about 5.5Mb available for the Filesystem after loading at91bootstrap, uboot, uboot-env, and kernel. ...(using buildroot-2011.11)...
The rootfs.jffs2 for NAND is 41Mb.
I need one for NOR that is less than 5.5Mb.Is there a good method or script to copy buildroot's rootfs.jffs2 to make a smaller copy for NOR?
My first attempt leads to
VFS: Mounted root (jffs2 filesystem) on device 31:1. Freeing init memory: 104K
Warning: unable to open an initial console.Kernel panic - not syncing: No init found. Try passing init= option to kernel. [<c0028678>] (unwind_backtrace+0x0/0xdc) from [<c0243990>] (panic+0x34/0x110) [<c0243990>] (panic+0x34/0x110) from [<c002254c>] (init_post+0x138/0x170) [<c002254c>] (init_post+0x138/0x170) from [<c0008408>] (kernel_init+0xbc/0xe8) [<c0008408>] (kernel_init+0xbc/0xe8) from [<c003b634>] (do_exit+0x0/0x5a4) [<c003b634>] (do_exit+0x0/0x5a4) from [<00000003>] (0x3)Quoted 4 lines
I think this means the file system is found and mounted, and for some reason, init isn't found, although I have played with init= to no avail, and if I mount my little jffs2, I do see busybox and all the links (
/bin/init).
Quoted 4 lines
Beware that if a NAND or NOR partition is empty and properly erase, jffs2 will happily mount it and show a filesystem that contains no file. So the behavior you're seeing here could perfectly happen if your NAND or NOR partition is simply empty.
To check for an empty file system I compared the hex dump of my jffs2 image to the contents of NOR, and they are the same.
From the uboot prompt I ran: md.b 0xD0294000 0x19
From the shell I ran: od -t x1z NORrootfs.jffs2
Both are identical, and I can mount my .jffs2 and see it contains stuff.
Could it be my bootargs mtdparts pointing to the wrong place?
bootargs=mem=64M console=ttyS0,115200 mtdparts=dataflash0:2640k(bootstrap/uboot/env/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=jffs2
I also tried exchanging 'dataflash0' for 'dataflash1', with no change in behavior.
This is the first time I have tried to put a file system on NOR.
Quoted 8 lines
Quoted 2 lines
I tried to trying to hack it (unsuccessfully) with a post-build script that tries to do what buildroot does:
Rather than doing this, what about having a separate Buildroot project that is used to build your small NOR failsafe filesystem? If it's only a 5.5 MB filesystem, most likely there isn't too much in it. Both Buildroot projects can share the same Buildroot source tree, but be built in different directories.
I would like to try this.
Quoted 12 lines
Let's say ~/buildroot/ contains the Buildroot sources, ~/buildroot/configs/project_defconfig and ~/buildroot/configs/project_failsafe_defconfig are respectively the Buildroot configuration for your full filesystem and for the small failsafe filesystem. Then you can do:
mkdir -p ~/project/full/
cd ~/project/full/
make -C ~/buildroot O=$(pwd)project_defconfig
make
Quoted 4 lines
mkdir -p ~/project/failsafe/
cd ~/project/failsafe
make -C ~/buildroot O=$(pwd)project_failsafe_defconfigmake
From this I wonder if I have been organizing my buildroot incorrectly.
My buidroot works out of a directory named buildroot-2011.11. My config is just called buildroot-2011.11/.config, so I just run 'make' without an options.
Should .config be stored under configs instead?
I also hold all my special stuff under:
buildroot-2011.11/board/atmel/at91sam9g20ek/
|-at91bootstrap-patches |-kernel-configs |-kernel-patches |-post-build |-uboot-2013-patches |-uboot-patches |-uClibc-config
Following your gracious directions, ...
cp buildroot-2011.11/.config \
buildroot-2011.11/configs/project_failsafe_defconfig
I had to edited the new config manually to remove almost everything.
How do I run 'make menuconfig' on buildroot-2011.11/configs/project_failsafe_defconfig?
mkdir -p failsafe
cd failsafe
make -C ../buildroot-2011.11 O=$(pwd) project_failsafe_defconfig make
This rebuilt everything, but fails on my post-build scripts, but I kinda need some of those. The post-build script calls make on the programs that implement my firmware rescue web server interface.
**** POST-BUILD SCRIPTS: ****
ERROR: Cant read
buildroot .config: /home/jstile/svn_rmserver/failsafe/target/../../.config
If I comment out BR2_ROOTFS_POST_BUILD_SCRIPT the image is created (failsafe/images/rootfs.jffs2) but over the size I need.
I was able to create a jffs2 of 4.9Mb, but this new image is 6.8Mb. Still too big. I've got 5.5.Mb of NOR available.
Quoted 44 lines · John Stile
Dear Thomas Petazzoni,
Quoted 30 lines · Thomas Petazzoni
Dear John Stile,
Quoted 22 lines · John Stile
I primarily boot from one of two 128Mb NAND areas, but I have an 8Mb NOR failsafe if NAND is bad. I have about 5.5Mb available for the Filesystem after loading at91bootstrap, uboot, uboot-env, and kernel. ...(using buildroot-2011.11)...
The rootfs.jffs2 for NAND is 41Mb.
I need one for NOR that is less than 5.5Mb.Is there a good method or script to copy buildroot's rootfs.jffs2 to make a smaller copy for NOR?
My first attempt leads to
VFS: Mounted root (jffs2 filesystem) on device 31:1. Freeing init memory: 104K
Warning: unable to open an initial console.Kernel panic - not syncing: No init found. Try passing init= option to kernel. [<c0028678>] (unwind_backtrace+0x0/0xdc) from [<c0243990>] (panic+0x34/0x110) [<c0243990>] (panic+0x34/0x110) from [<c002254c>] (init_post+0x138/0x170) [<c002254c>] (init_post+0x138/0x170) from [<c0008408>] (kernel_init+0xbc/0xe8) [<c0008408>] (kernel_init+0xbc/0xe8) from [<c003b634>] (do_exit+0x0/0x5a4) [<c003b634>] (do_exit+0x0/0x5a4) from [<00000003>] (0x3)Quoted 4 lines
I think this means the file system is found and mounted, and for some reason, init isn't found, although I have played with init= to no avail, and if I mount my little jffs2, I do see busybox and all the links (
/bin/init).Quoted 4 lines
Beware that if a NAND or NOR partition is empty and properly erase, jffs2 will happily mount it and show a filesystem that contains no file. So the behavior you're seeing here could perfectly happen if your NAND or NOR partition is simply empty.
To check for an empty file system I compared the hex dump of my jffs2 image to the contents of NOR, and they are the same.
From the uboot prompt I ran: md.b0xD02940000x19
From the shell I ran: od -t x1z NORrootfs.jffs2
Both are identical, and I can mount my .jffs2 and see it contains stuff.
Quoted 8 lines
Could it be my bootargs mtdparts pointing to the wrong place?
bootargs=mem=64M console=ttyS0,115200 mtdparts=dataflash0:2640k(bootstrap/uboot/env/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=jffs2I also tried exchanging 'dataflash0' for 'dataflash1', with no change in behavior.
This is the first time I have tried to put a file system on NOR.
I discovered the kernel mtdparts statement to control the mtd partition layout, which I guess is a good staring point for mounting the root file system, but I still can't mount.
I gleaned the information from the kernel boot messages and the kernel drivers/mtd/devices/at91_dataflash.c.
Default kernel boot messages for NAND and NOR:
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron NAND 256MiB 3,3V 8-bit) AT91 NAND: 8-bit, Software ECC
Scanning device for bad blocks
mtd: no mtd-id
Creating 3 MTD partitions on "atmel_nand":
0x000000000000-0x000000400000 : "Bootstrap" 0x000000400000-0x000004000000 : "Partition 1" 0x000004000000-0x000010000000 : "Partition 2"
atmel_spi atmel_spi.0: Atmel SPI Controller at 0xfffc8000 (irq 12) mtd_dataflash spi0.1: AT45DB642x (8448 KBytes) pagesize 1056 bytes (OTP)
I changed my boot args to:
bootargs=mem=64M console=ttyS0,115200 mtdparts=spi0.1-AT45DB642x:2640k(bootstrap/env/uboot/kernel)ro,-(rootfs);atmel_nand:128k(bootstrap1)ro,256k(uboot1)ro,128k(env1)ro,1536K(unused),2M(linux1),124M(rootfs1),128k(bootstrap2)ro,256k(uboot2)ro,128k(env2)ro,1536k(unused2),2M(linux2),124M(rootfs2) root=/dev/mtdblock2 rw rootfstype=jffs2
Now kernel boot messages for NAND and NOR show my partitions, but fail to find the root filesystem:
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron NAND 256MiB 3,3V 8-bit) AT91 NAND: 8-bit, Software ECC
Scanning device for bad blocks
12 cmdlinepart partitions found on MTD device atmel_nand
Creating 12 MTD partitions on "atmel_nand":
0x000000000000-0x000000020000 : "bootstrap1" 0x000000020000-0x000000060000 : "uboot1" 0x000000060000-0x000000080000 : "env1"
0x000000080000-0x000000200000 : "unused" 0x000000200000-0x000000400000 : "linux1" 0x000000400000-0x000008000000 : "rootfs1" 0x000008000000-0x000008020000 : "bootstrap2" 0x000008020000-0x000008060000 : "uboot2" 0x000008060000-0x000008080000 : "env2"
0x000008080000-0x000008200000 : "unused2" 0x000008200000-0x000008400000 : "linux2" 0x000008400000-0x000010000000 : "rootfs2"
atmel_spi atmel_spi.0: Atmel SPI Controller at 0xfffc8000 (irq 12) mtd_dataflash spi0.1: AT45DB642x (8448 KBytes) pagesize 1056 bytes (OTP) 2 cmdlinepart partitions found on MTD device spi0.1-AT45DB642x Creating 2 MTD partitions on "spi0.1-AT45DB642x":
0x000000000000-0x000000294000 : "bootstrap/env/uboot/kernel" 0x000000294000-0x000000840000 : "rootfs"
...
rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clock
jffs2: Too few erase blocks (1)
List of all partitions:
1f00 128 mtdblock0 (driver?) 1f01 256 mtdblock1 (driver?) 1f02 128 mtdblock2 (driver?) 1f03 1536 mtdblock3 (driver?) 1f04 2048 mtdblock4 (driver?) 1f05 126976 mtdblock5 (driver?) 1f06 128 mtdblock6 (driver?) 1f07 256 mtdblock7 (driver?) 1f08 128 mtdblock8 (driver?) 1f09 1536 mtdblock9 (driver?) 1f0a 2048 mtdblock10 (driver?) 1f0b 126976 mtdblock11 (driver?) 1f0c 2640 mtdblock12 driver: mtd_dataflash 1f0d 5808 mtdblock13 driver: mtd_dataflash No filesystem could mount root, tried: jffs2 Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
ORDER in mtdparts does not matter (NAND always before NOR)?
Next I changed from:
root=/dev/mtdblock2
to:
root=/dev/mtdblock 13
The kernel messages now show my desire layout at boot time, however, the the file system still does not mount, but the root file system is not found.
Kernel boot messages for NAND and NOR:
...
rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clock JFFS2 write-buffering enabled buffer (1056) erasesize (8448)
Node at 0x00001cd8 with length 0x00000489 would run over the end of the erase block Perhaps the file system was created with the wrong erase size? jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001cdc: 0x0489 instead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001ce0: 0x651a instead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001ce4: 0x0006 instead
...
Further such events for this erase block will not be printed
VFS: Mounted root (jffs2 filesystem) on device 31:13.
Freeing init memory: 104K
Kernel panic - not syncing: Attempted to kill init! [<c0028678>] (unwind_backtrace+0x0/0xdc) from [<c0243990>] (panic+0x34/0x110)
I think this means I am close.
Next I tried to edit my jffs options in the .config for my recovery 'failsafe' buildroot:
Filesystem images --->
[*] jffs2 root filesystem
Flash Type (Select custom page and erase size) ---> (0x1065) Page Size
(0xC60) Erase block size
I gleaned these numbers from the output o the sam-ba utility used to load the NOR flash, but they still don't work.
This had no effect.
Quoted 1 line · John Stile
On Fri, 2013-02-08 at 13:34 -0800, John Stile wrote:
[snip]
Quoted 4 lines
Next I changed from:
root=/dev/mtdblock2
to:
root=/dev/mtdblock 13
A jffs2 filesystem should be mounted through /dev/mtdN, not through/dev/mtdblockN. So root=/dev/mtd13 is a better idea.
Quoted 23 lines
The kernel messages now show my desire layout at boot time, however, the the file system still does not mount, but the root file system is not found.
Kernel boot messages for NAND and NOR:
...
rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clock JFFS2 write-buffering enabled buffer (1056) erasesize (8448)
Node at0x00001cd8with length0x00000489would run over the end of the erase block Perhaps the file system was created with the wrong erase size?jffs2_scan_eraseblock(): Magic bitmask0x1985not found at0x00001cdc:0x0489insteadjffs2_scan_eraseblock(): Magic bitmask0x1985not found at0x00001ce0:0x651ainsteadjffs2_scan_eraseblock(): Magic bitmask0x1985not found at0x00001ce4:0x0006instead
...
Further such events for this erase block will not be printed
VFS: Mounted root (jffs2 filesystem) on device 31:13.
Freeing init memory: 104KKernel panic - not syncing: Attempted to kill init! [<c0028678>] (unwind_backtrace+0x0/0xdc) from [<c0243990>] (panic+0x34/0x110)I think this means I am close.
Quoted 7 lines
Next I tried to edit my jffs options in the .config for my recovery 'failsafe' buildroot:
Filesystem images --->
[*] jffs2 root filesystem
Flash Type (Select custom page and erase size) ---> (0x1065) Page Size
(0xC60) Erase block size
Those numbers are unlikely. 0x1065 is a very odd number (literally).
Also, the erase block size is always larger than the page size, and for NOR I think it's normally equal to it.
These questions are however more appropriate for
linux-mtd at lists.infradead.org because they are not buildroot related.
However, if you want a quick fix: you can also choose theBR2_TARGET_ROOTFS_INITRAMFS ("initial RAM filesystem linked into linux kernel") option. With your huge 5.5MB rootfs that will kill build and boot time, but it means you don't have to bother with writing the JFFS2 to NOR or even partitioning your NOR. It's all in a single uImage.
You could even create a FIT image that includes both kernel and rootfs
(as a cpio archive, "cpio the root filesystem (for use as an initial RAM filesystem)") but buildroot doesn't have support for that.
Regards,
Arnout
Quoted 11 lines
I gleaned these numbers from the output o the sam-ba utility used to load the NOR flash, but they still don't work.
This had no effect.
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
Quoted 159 lines · John Stile
Quoted 44 lines · John Stile
Dear Thomas Petazzoni,
Quoted 30 lines · Thomas Petazzoni
Dear John Stile,
Quoted 22 lines · John Stile
I primarily boot from one of two 128Mb NAND areas, but I have an 8Mb NOR failsafe if NAND is bad. I have about 5.5Mb available for the Filesystem after loading at91bootstrap, uboot, uboot-env, and kernel. ...(using buildroot-2011.11)...
The rootfs.jffs2 for NAND is 41Mb.
I need one for NOR that is less than 5.5Mb.Is there a good method or script to copy buildroot's rootfs.jffs2 to make a smaller copy for NOR?
My first attempt leads to
VFS: Mounted root (jffs2 filesystem) on device 31:1. Freeing init memory: 104K
Warning: unable to open an initial console.Kernel panic - not syncing: No init found. Try passing init= option to kernel. [<c0028678>] (unwind_backtrace+0x0/0xdc) from [<c0243990>] (panic+0x34/0x110) [<c0243990>] (panic+0x34/0x110) from [<c002254c>] (init_post+0x138/0x170) [<c002254c>] (init_post+0x138/0x170) from [<c0008408>] (kernel_init+0xbc/0xe8) [<c0008408>] (kernel_init+0xbc/0xe8) from [<c003b634>] (do_exit+0x0/0x5a4) [<c003b634>] (do_exit+0x0/0x5a4) from [<00000003>] (0x3)Quoted 4 lines
I think this means the file system is found and mounted, and for some reason, init isn't found, although I have played with init= to no avail, and if I mount my little jffs2, I do see busybox and all the links (
/bin/init).Quoted 4 lines
Beware that if a NAND or NOR partition is empty and properly erase, jffs2 will happily mount it and show a filesystem that contains no file. So the behavior you're seeing here could perfectly happen if your NAND or NOR partition is simply empty.
To check for an empty file system I compared the hex dump of my jffs2 image to the contents of NOR, and they are the same.
From the uboot prompt I ran: md.b0xD02940000x19
From the shell I ran: od -t x1z NORrootfs.jffs2
Both are identical, and I can mount my .jffs2 and see it contains stuff.Quoted 8 lines
Could it be my bootargs mtdparts pointing to the wrong place?
bootargs=mem=64M console=ttyS0,115200 mtdparts=dataflash0:2640k(bootstrap/uboot/env/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=jffs2I also tried exchanging 'dataflash0' for 'dataflash1', with no change in behavior.
This is the first time I have tried to put a file system on NOR.
I discovered the kernel mtdparts statement to control the mtd partition layout, which I guess is a good staring point for mounting the root file system, but I still can't mount.
I gleaned the information from the kernel boot messages and the kernel
drivers/mtd/devices/at91_dataflash.c.Default kernel boot messages for NAND and NOR:
NAND device: Manufacturer ID:0x2c, Chip ID:0xda(Micron NAND 256MiB 3,3V 8-bit) AT91 NAND: 8-bit, Software ECC
Scanning device for bad blocks
mtd: no mtd-id
Creating 3 MTD partitions on "atmel_nand":
0x000000000000-0x000000400000 : "Bootstrap" 0x000000400000-0x000004000000 : "Partition 1" 0x000004000000-0x000010000000 : "Partition 2"
atmel_spiatmel_spi.0: Atmel SPI Controller at0xfffc8000(irq 12)mtd_dataflashspi0.1: AT45DB642x (8448 KBytes) pagesize 1056 bytes (OTP)I changed my boot args to:
bootargs=mem=64M console=ttyS0,115200 mtdparts=spi0.1-AT45DB642x:2640k(bootstrap/env/uboot/kernel)ro,-(rootfs);atmel_nand:128k(bootstrap1)ro,256k(uboot1)ro,128k(env1)ro,1536K(unused),2M(linux1),124M(rootfs1),128k(bootstrap2)ro,256k(uboot2)ro,128k(env2)ro,1536k(unused2),2M(linux2),124M(rootfs2) root=/dev/mtdblock2 rw rootfstype=jffs2Now kernel boot messages for NAND and NOR show my partitions, but fail to find the root filesystem:
NAND device: Manufacturer ID:0x2c, Chip ID:0xda(Micron NAND 256MiB 3,3V 8-bit) AT91 NAND: 8-bit, Software ECC
Scanning device for bad blocks
12 cmdlinepart partitions found on MTD deviceatmel_nand
Creating 12 MTD partitions on "atmel_nand":
0x000000000000-0x000000020000 : "bootstrap1" 0x000000020000-0x000000060000 : "uboot1" 0x000000060000-0x000000080000 : "env1"
0x000000080000-0x000000200000 : "unused" 0x000000200000-0x000000400000 : "linux1" 0x000000400000-0x000008000000 : "rootfs1" 0x000008000000-0x000008020000 : "bootstrap2" 0x000008020000-0x000008060000 : "uboot2" 0x000008060000-0x000008080000 : "env2"
0x000008080000-0x000008200000 : "unused2" 0x000008200000-0x000008400000 : "linux2" 0x000008400000-0x000010000000 : "rootfs2"
atmel_spiatmel_spi.0: Atmel SPI Controller at0xfffc8000(irq 12)mtd_dataflashspi0.1: AT45DB642x (8448 KBytes) pagesize 1056 bytes (OTP) 2 cmdlinepart partitions found on MTD device spi0.1-AT45DB642x Creating 2 MTD partitions on "spi0.1-AT45DB642x":
0x000000000000-0x000000294000 : "bootstrap/env/uboot/kernel" 0x000000294000-0x000000840000 : "rootfs"
...
rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clock
jffs2: Too few erase blocks (1)
List of all partitions:1f00 128 mtdblock0 (driver?) 1f01 256 mtdblock1 (driver?) 1f02 128 mtdblock2 (driver?) 1f03 1536 mtdblock3 (driver?) 1f04 2048 mtdblock4 (driver?) 1f05 126976 mtdblock5 (driver?) 1f06 128 mtdblock6 (driver?) 1f07 256 mtdblock7 (driver?) 1f08 128 mtdblock8 (driver?) 1f09 1536 mtdblock9 (driver?) 1f0a 2048 mtdblock10 (driver?) 1f0b 126976 mtdblock11 (driver?) 1f0c 2640 mtdblock12 driver: mtd_dataflash 1f0d 5808 mtdblock13 driver: mtd_dataflash No filesystem could mount root, tried: jffs2 Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)ORDER in mtdparts does not matter (NAND always before NOR)?
Next I changed from:
root=/dev/mtdblock2
to:
root=/dev/mtdblock 13The kernel messages now show my desire layout at boot time, however, the the file system still does not mount, but the root file system is not found.
Kernel boot messages for NAND and NOR:
...
rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clock JFFS2 write-buffering enabled buffer (1056) erasesize (8448)
Node at0x00001cd8with length0x00000489would run over the end of the erase block Perhaps the file system was created with the wrong erase size?jffs2_scan_eraseblock(): Magic bitmask0x1985not found at0x00001cdc:0x0489insteadjffs2_scan_eraseblock(): Magic bitmask0x1985not found at0x00001ce0:0x651ainsteadjffs2_scan_eraseblock(): Magic bitmask0x1985not found at0x00001ce4:0x0006instead
...
Further such events for this erase block will not be printed
VFS: Mounted root (jffs2 filesystem) on device 31:13.
Freeing init memory: 104KKernel panic - not syncing: Attempted to kill init! [<c0028678>] (unwind_backtrace+0x0/0xdc) from [<c0243990>] (panic+0x34/0x110)I think this means I am close.
Next I tried to edit my jffs options in the .config for my recovery 'failsafe' buildroot:
Filesystem images --->
[*] jffs2 root filesystem
Flash Type (Select custom page and erase size) ---> (0x1065) Page Size
(0xC60) Erase block size
Quoted 5 lines
I gleaned these numbers from the output o the sam-ba utility used to load the NOR flash, but they still don't work.
This had no effect.
I solved my problem.
I had to find the correct flash setting for jffs2. This sent me in the right direction:
http://www.at91.com/forum/viewtopic.php/f,9/t,4983/
Filesystem images --->
[*] jffs2 root filesystem
Flash Type (AT45 dataflash with 1056 byte pagesize)
I am using a separate buildroot config (per Thomas Petazzoni's advice). Thank you.
Dear Arnout Vandecappelle,
Quoted 2 lines · Arnout Vandecappelle
A jffs2 filesystem should be mounted through
/dev/mtdN, not through/dev/mtdblockN. So root=/dev/mtd13 is a better idea.
Really? I've always used root=/dev/mtdblockX without any problems. Your statement even seems to contradict
http://www.linux-mtd.infradead.org/faq/jffs2.html#L_mtdblock :
"""
There are two cases where this does not work. The first is when JFFS2 is used as a root filesystem. For now, this requires the mtdblock device to be specified for root= on the kernel command line. The second case is when the mount binary that is being used does not play nicely with the above format. The BusyBox version of mount is known to not work without the mtdblock device.
"""
Quoted 11 lines
Quoted 7 lines
Next I tried to edit my jffs options in the .config for my recovery 'failsafe' buildroot:
Filesystem images --->
[*] jffs2 root filesystem
Flash Type (Select custom page and erase size) ---> (0x1065) Page Size
(0xC60) Erase block sizeThose numbers are unlikely.
0x1065is a very odd number (literally).
Also, the erase block size is always larger than the page size, and for NOR I think it's normally equal to it.
I remember dataflash having bizarre erase block sizes, but I don't think it was an odd number.
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
Hi,
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Next I tried to edit my jffs options in the .config for my recovery 'failsafe' buildroot:
Filesystem images --->
[*] jffs2 root filesystem
Flash Type (Select custom page and erase size) ---> (0x1065) Page Size
(0xC60) Erase block sizeThose numbers are unlikely.
0x1065is a very odd number (literally). Also, the erase block size is always larger than the page size, and for NOR I think it's normally equal to it.
Thomas> I remember dataflash having bizarre erase block sizes, but I don't Thomas> think it was an odd number.
No, it's afaik 256bytes + 8 extra, or multiples of this. Judging from the above, I guess John wanted 1056 (0x420) page size.
Signature · 1 line
Bye, Peter Korsgaard