Make rootfs image without Qtopia

Fernando Vilmar Palha
Greetings.

I'm starting the development with Mini2440.

The main objective is develop a WebService. I don't need LCD.

How I can make a rootfs linux image without graphic support (without
Qtopia)?

How to use the mkyaffs2image?

Regards.

penguin
Fernando,

http://wiki.iface.ch/index.php/Basic_rootfs_for_Mini2440 is a beautiful
tutorial after following which you will get working rootfs with only
minimalistic utilities, no graphics at all.

At first, you'd better use NFS. After you successfully boot linux and get
shell prompt you can build yaffs image and upload it to NAND. 
Run mkyaffs2image with no args and you will see that it is no brainer.

Fernando Vilmar Palha
Thanks penguin.

I will try this steps.

Fernando Vilmar Palha
Hi.

I'm following this steps and I found erros/warnings.

1) ERROR: Cannot umount
2) Warning: unable to open an initial console.

Details in attached.

Any tips?

Juergen Beisert
> 2) Warning: unable to open an initial console.

The dev/ directory in your root filesystem seems empty. Might be broken in
any way?

Fernando Vilmar Palha
Thanks Juergen.

I don't did:

$ cd ~/palha/target
~/palha/target$ sudo mkdir dev
~/palha/target$ cd dev
~/palha/target/dev$ sudo mknod console c 4 0

Now, works.

I will try the next steps.

Fernando Vilmar Palha
Hi.

I'm following this steps and I found erros/warnings.

1) Kernel panic - not syncing: No init found.  Try passing init= option to
kernel.

Details in attached.

Any tips?

Fernando Vilmar Palha
Hi.

The partitions are:

Creating 5 MTD partitions on "NAND 1GiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "supervivi"
0x000000040000-0x000000060000 : "param"
0x000000060000-0x000000560000 : "Kernel"
0x000000560000-0x000040560000 : "root"
mtd: partition "root" extends beyond the end of device "NAND 1GiB 3,3V
8-bit" -- size truncated to 0x3faa0000
0x000000000000-0x000040000000 : "nand

It is a problem?

Juergen Beisert
Keep your partitions in the NAND *in* the NAND. You can't use larger
partitions than your real NAND device is in size.

Fernando Vilmar Palha
Thanks Juergen.

How I can do it?

I must define this in u-boot?

Fernando Vilmar Palha
U-Boot 1.3.2-mini2440 (Feb 24 2010 - 13:04:49)

I2C:   ready
DRAM:  64 MB
Flash:  2 MB
NAND:  Bad block table not found for chip 0
Bad block table not found for chip 0
1024 MiB
Found Environment offset in OOB..
USB:   S3C2410 USB Deviced
In:    serial
Out:   serial
Err:   serial
MAC: 08:08:11:18:12:27
Hit any key to stop autoboot:  0
MINI2440 #
MINI2440 # printenv
bootdelay=3
baudrate=115200
ethaddr=08:08:11:18:12:27
netmask=255.255.255.0
usbtty=cdc_acm
mini2440=mini2440=0tb
bootargs_base=console=ttySAC0,115200 noinitrd
bootargs_init=init=/sbin/init
root_nand=root=/dev/mtdblock3 rootfstype=jffs2
root_mmc=root=/dev/mmcblk0p2 rootdelay=2
root_nfs=/mnt/nfs
set_root_nfs=setenv root_nfs root=/dev/nfs rw
nfsroot=${serverip}:${root_nfs}
ifconfig_static=run setenv ifconfig
ip=${ipaddr}:${serverip}::${netmask}:mini2440:eth0
ifconfig_dhcp=run setenv ifconfig ip=dhcp
ifconfig=ip=dhcp
set_bootargs_mmc=setenv bootargs ${bootargs_base} ${bootargs_init}
${mini2440} ${root_mmc}
set_bootargs_nand=setenv bootargs ${bootargs_base} ${bootargs_init}
${mini2440} ${root_nand}
set_bootargs_nfs=run set_root_nfs; setenv bootargs ${bootargs_base}
${bootargs_init} ${mini2440} ${root_nfs} ${ifconfig}
mtdids=nand0=mini2440-nand
mtdparts=mtdparts=mini2440-nand:0x00040000(u-boot),0x00020000(u-boot_env),0x0050
0000(kernel),0x3faa0000(rootfs)
bootcmd=nfs 0x31000000 192.168.0.47:/home/palha/fadevel/target/uImage ;
bootm
ipaddr=192.168.0.49
serverip=192.168.0.47
bootargs=console=ttySAC0,115200 ip=192.168.0.49:192.168.0.47::255.255.255.0
root=/dev/nfs nfsroot=192.168.0.47:/home/palha/fadevel/target
partition=nand0,0
mtddevnum=0
mtddevname=u-boot

Environment size: 1269/131068 bytes

Juergen Beisert
This line defines the partitions and their sizes:
mtdparts=mtdparts=mini2440-nand:0x00040000(u-boot),0x00020000(u-boot_env),0x0050
0000(kernel),0x3faa0000(rootfs)

You should adapt it to your real NAND size. Best would be to use the '-'
for the size of the (rootfs), as this will use automatically the remaining
space in the NAND.

Fernando Vilmar Palha
Hi Juergen.

Thanks for help.

Previously in u-boot, I executed the commad:

#dynpart
mtdparts
mtdparts=mini2440-nand:0x00040000(u-boot),0x00020000(u-boot_env),0x00500000(kern
el),0x3faa0000(rootfs)

So now, I executed the command:

#setenv mtdparts
mtdparts=mini2440-nand:0x00040000(u-boot),0x00020000(u-boot_env),0x00500000(kern
el),0x3f540000(rootfs)

#saveenv

But, the result is:

Creating 5 MTD partitions on "NAND 1GiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "supervivi"
0x000000040000-0x000000060000 : "param"
0x000000060000-0x000000560000 : "Kernel"
0x000000560000-0x000040560000 : "root"
mtd: partition "root" extends beyond the end of device "NAND 1GiB 3,3V
8-bit" -- size truncated to 0x3faa0000
0x000000000000-0x000040000000 : "nand"

Nothing changed.

What is wrong? Why occur the Kernel panic - No init found?

Regards.

Juergen Beisert
As you can see, the kernel reports different partition names than the ones
you have defined in the mtdparts line. Seems your kernel has compiled in
this partitioning information into the kernel. You must configure a kernel
without this broken "feature".

Fernando Vilmar Palha
Thanks Juergen, I fixed it by modifying the file:

~/fadevel/linux-2.6.32.2$ joe arch/arm/mach-s3c2440/mach-mini2440.c

and changing:

static struct mtd_partition friendly_arm_default_nand_part[] = {
        [0] = {
                .name   = "supervivi",
                .size   = 0x00040000,
                .offset = 0,
        },
        [1] = {
                .name   = "param",
                .offset = 0x00040000,
                .size   = 0x00020000,
        },
        [2] = {
                .name   = "Kernel",
                .offset = 0x00060000,
                .size   = 0x00500000,
        },
        [3] = {
                .name   = "root",
                .offset = 0x00560000,
                .size   = 0x3faa0000, //1024 * 1024 * 1024,
        },
        [4] = {
                .name   = "nand",
                .offset = 0x00000000,
                .size   = 1024 * 1024 * 1024, //
        }
};

The result is:

Creating 5 MTD partitions on "NAND 1GiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "supervivi"
0x000000040000-0x000000060000 : "param"
0x000000060000-0x000000560000 : "Kernel"
0x000000560000-0x000040000000 : "root"
0x000000000000-0x000040000000 : "nand"

But, the Kernel panic still occurs.

"Kernel panic - not syncing: No init found.  Try passing init= option to
kernel."

Any tips?

Fernando Vilmar Palha
Attachment: log20120906.txt (19.15 KB)
Hi.

I need help to build an rootfs minimal to Mini2440.

Always the result is "Kernel panic".

---------------------------------------------
MINI2440 # resetþ

U-Boot 1.3.2-mini2440 (Feb 24 2010 - 13:04:49)

I2C:   ready
DRAM:  64 MB
Flash:  2 MB
NAND:  Bad block table not found for chip 0
Bad block table not found for chip 0
1024 MiB
Found Environment offset in OOB..
USB:   S3C2410 USB Deviced
In:    serial
Out:   serial
Err:   serial
MAC: 08:08:11:18:12:27
Hit any key to stop autoboot:  0
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:08:11:18:12:27
File transfer via NFS from server 192.168.0.47; our IP address is
192.168.0.49
Filename '/home/palha/fadevel/target/uImage'.
Load address: 0x31000000
Loading: #################################################################
         #################################################################
         #########################################################***
ERROR: Cannot umount
## Booting kernel from Legacy Image at 31000000 ...
   Image Name:   Linux-2.6.32.2-FriendlyARM
   Created:      2012-09-05  13:31:53 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2287288 Bytes =  2.2 MB
   Load Address: 30008000
   Entry Point:  30008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux......
Freeing init memory: 164K
Failed to execute linuxrc.  Attempting defaults...
Kernel panic - not syncing: No init found.  Try passing init= option to
kernel.
-----------------------

Details in attached.

Regards.

Fernando Vilmar Palha
Hi.

The "ERROR: Cannot umount" was solved with:

http://www.friendlyarm.net/forum/topic/800 

(Dee) - Add IP address of mini2440 in /etc/hosts file.

But, the Kernel panic still occurs.

Renato Aloi
Hey guys! Great help from this forum!

What happened to the link? Its broken. I would love to take a look at it!

Fernando, pelo seu nome, fala português? Me escreve pra gente trocar umas
ideias se vc entender esse texto.

Tks
Renato

davef
Not broken here in NZ.

ayyap
Attachment: problem in loading rootfs_jffs2 (21.42 KB)
Hi,

I used the Qtopia root file system downloaded from the download section of
mini2440 and created jffs2 filesystem type. I dowmloaded into the mini2440
1GB board using Uboot following Bill's forum.and on boot up kernel was
uncompressed and  I could see the root mounted message in the minicom but
with some warnings/errors. In the display I can Logo screen showing the
text "Starting Qtopia, please waiting..." and stuck at that point.

I have attached the minicom log along with this post.

Can anybody please help me to fix this?

Thanks in Advance.

davef
Are you loading from a SD card?  I recall getting errors like at the end of
your attachment, but it always keep working.

The "bad magic number" might be more of a worry.  Search here and Bills
forum for that.

Ayyappan Mk
Hi davef,

I am not finding any post related to magic number in this forum or Bill's
Forum. When I googled i saw somewhere that while creating jffs2 image we
have to add the option --pad in mkfs.jffs2 command. I tried that but still
it behaves the same. One more observation I am able to browse the target
root file system folder hierarchy using minicom connectivity and when I
went to /bin/ in the target and executed qtopia binary it showed no error
and showed like it was executed and command prompt was shown in the next
line.

Can u please help me to fix that problem?

thanks.

davef
Sorry, I meant to say search " magic bitmask not found".

I never saw the words "Expect badness" at the end.

Are you using an SD card?  Maybe, try another one.

Ayyappan Mk
Hi davef,

I saw some posts reporting that SD card size greater than 1GB creating some
problems.
What is your advice to use which size SD card?
I am using 1GB SD card now. 

By formatting that SD card and using it again will it help to solve the
problem?

My doubt still I am having is kernel,uboot are loaded into the NAND using
that SD card only. I think in bootup uboot and kernel are loaded
properly.Only the rootfs creating problems upto my knowledge.

Is there any difference as uboot, kernel working properly if i am right and
rootfs not working? Can u please let me know that?

Please reply to all my queries.

Thanks.

ayyap
Attachment: MMC error (576 Byte)
Hi davef,

I retried by formatting my 1GB Sd card with FAT option and 16 KB block
size. And then I copied the rootfs file to SD Card and executed the
commands as in the attachment. It showed the error in minicom. I doubt I am
not loading proper MMC dev:partnum. How to find the dev:partnum of the MMC
attached to mini2440?

Please reply!

ayyap
The commands in the attachment are executed in Uboot terminal by connecting
the board through minicom.

Ayyappan Mk
At first I formatted in Windows 7 and then I formatted in Ubuntu using as
below command.

sudo mkfs.vfat -I /dev/sdc

And used the mmc card and connected the board thru minicom and gave the
following command. 

MINI2440 # mmcinit      
mmc: Probing for SDHC ...
mmc: SD 2.0 or later card found
trying to detect SD Card...
Manufacturer:       0x02, OEM "TM"
Product name:       "SA01G", revision 0.4
Serial number:      268923718
Manufacturing date: 7/2010
CRC:                0x09, b0 = 1
READ_BL_LEN=15, C_SIZE_MULT=7, C_SIZE=3437
size = 568328192
SD Card detected RCA: 0x1234 type: SD
** Partition 1 not valid on device 0 **

Where I m doing wrong?

please help.

Dave Festing
Attachment: HowTo boot with an SD card.zip (27 KB)
Sorry I was away.  All the SD cards I ran on the mini2440 were formatted in
ext4.  Also, the kernel needed to re-compiled for ext4

Read the attached, it might help.

Dave Festing
make that ext3.  Not sure if ext3 has to be enabled in the kernel.  Check
using:
  makemenuconfig

Ayyappan Mk
Sorry davef, 

The zip file you have attached was showing as corrupted when i try to
extract.Can u please reattach the correct one?

Thanks,
Ayyappan M.

davef
Sorry, forgot to mentioned to rename it as a .doc file.  The forum can't
handle .doc files.

Ayyappan Mk
Hi davef,

The content of the doc file you attached seems to be that SD card having
kernel and rootfs executing from SD Card while board is running(if I am
right).But I was trying to flash the NAND memory into mini2440 with SD card
having rootfs file temporarily, by loading rootfs file into mini2440 SDRAM
and from there write to Nand in the rootfs partition of Nand. Seems you
have misunderstood my problem.

Please help to fix my problem exactly.

davef
My understanding is that the kernel is loaded into RAM and the rootfs in
run on the SD card.  Originally, I called this document "Booting from an SD
card" and was told that was incorrect.

However, my knowledge in this area is quite limited. 

Sorry, I don't understand how an SDcard formatted in vfat could be used in
this application.

Ayyappan Mk
Hi,

As I got into troubles while using SD card I tried tftp to flash the rootfs
image into the board. While doing that on executing the command:

MINI2440#tftp 0x31000000 rootfs.jffs2

It proceeded to load in the RAM starting from RAM Address 0x31000000.It
showed ## for many lines and at a point "32 MB was received" shown and
continued with ## printing in the command line and got blocked and hanged
at one point. The number of lines where ## were printed was nearly same
before and after "32 MB was received" line. My rootfs.jffs2 image was of
size 105.5 MB.
And in the UBoot bootup sequence in the minicom command line printed like
follows,

Welcome to minicom 2.5

OPTIONS: I18n                                                              
 
Compiled on May  2 2011, 00:39:27.                                         
 
Port /dev/ttyUSB0                                                          
 
                                                                           
 
Press CTRL-A Z for help on special keys                                    
         
                                                                           
         
                                                                           
         
                                                                           
         
U-Boot 1.3.2-mini2440 (Aug 18 2010 - 16:23:28)                             
         
                                                                           
 
I2C:   ready                                                               
 
DRAM:  64 MB                            
NOR Flash not found. Use hardware switch and 'flinit'
Flash:  0 kB                            
NAND:  1024 MiB                         
Found Environment offset in OOB..       
USB:   S3C2410 USB Deviced              
In:    serial
Out:   serial
Err:   serial
MAC: 08:08:11:18:12:27
Hit any key to stop autoboot:  0 

Loading from NAND 1GiB 3,3V 8-bit, offset 0x60000


The notable point above is DRAM:64MB.

Does this causes the problem to load the 105.5 MB rootfs file into RAM?
Is not the RAM size in 1GB mini2440 is in 128 MB bank size?
If it is 128 MB bank size then does the Uboot binary has configured DRAM as
64 MB size?

Anybody please reply to my queries.

davef
From the product page:

RAM: 64 MB, 32 bit Bus
Flash: up to 1GB NAND Flash

Why are you trying to load the rootfs into RAM?

Ayyappan Mk
Hi davef,
it is done as usual.according to Bill's forum we are loading the image to
RAM from there using nand write.jffs2 we will flash to nand. If there is
any simple way without using RAM please let me know, my problem will be
solved.

Thanks.

davef
Re-read Forrest Bao's tutorial, which sounds like exactly what you are
doing.

Does the OSLEAS mini2440 quickstart guide give you any clues on using TFTP
and/or NFS.

Another keyword is usbpush

Good luck!