LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 09-28-2011, 07:18 AM   #1
ammayappan
LQ Newbie
 
Registered: Sep 2011
Posts: 14

Rep: Reputation: Disabled
KERNEL with inbuilt ramfs


Hi,

I am trying to compile the kernel with the initial ramfs built inside it.
My initramfs is initramfs_data.cpio.gz which contains the executable called init which will display "hello world".

I have enabled the option below using make menuconfig
General options --> CONFIG_INITRAMGS_SOURCE with initramfs_data.cpio.gz.

I am using the QEMU for emulating the ARM and trying to boot up the kernel from ram disk.The below is the command i use to boot up the kernel.

$ qemu-system-arm M versatilepb -m 128M -kernel zImage -append "root=/dev/ram rdinit=/init

Output of the above command is as follows:

Uncompressing Linux... done, booting the kernel.
Linux version 3.0.0 (ammayappan@ammayappan-OptiPlex-380) (gcc version 4.5.2 (Sourcery G++ Lite 2011.03-41) ) #13 Wed Sep 28 15:51:36 IST 2011
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00093177
CPU: VIVT data cache, VIVT instruction cache
Machine: ARM-Versatile PB
Memory policy: ECC disabled, Data cache writeback
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956ms
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
Kernel command line: root=/dev/ram rdinit=/test console=ttyAMA0
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 126000k/126000k available, 5072k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xffc00000 - 0xffe00000 ( 2 MB)
vmalloc : 0xc8800000 - 0xd8000000 ( 248 MB)
lowmem : 0xc0000000 - 0xc8000000 ( 128 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.init : 0xc0008000 - 0xc006f000 ( 412 kB)
.text : 0xc006f000 - 0xc0398150 (3237 kB)
.data : 0xc039a000 - 0xc03b6340 ( 113 kB)
.bss : 0xc03b6364 - 0xc03d01b0 ( 104 kB)
NR_IRQS:192
VIC @f1140000: id 0x00041190, vendor 0x41
Console: colour dummy device 80x30
Calibrating delay loop... 317.03 BogoMIPS (lpj=1585152)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
Serial: AMBA PL011 UART driver
dev:f1: ttyAMA0 at MMIO 0x101f1000 (irq = 12) is a PL011 rev1
console [ttyAMA0] enabled
dev:f2: ttyAMA1 at MMIO 0x101f2000 (irq = 13) is a PL011 rev1
dev:f3: ttyAMA2 at MMIO 0x101f3000 (irq = 14) is a PL011 rev1
fpga:09: ttyAMA3 at MMIO 0x10009000 (irq = 38) is a PL011 rev1
bio: create slab <bio-0> at 0
Switching to clocksource timer3
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NetWinder Floating Point Emulator V0.97 (double precision)
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 246
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
clcd-pl11x dev:20: PL110 rev0 at 0x10120000
CLCD: unknown LCD panel ID 0x00001000, using VGA
clcd-pl11x dev:20: Versatile hardware, VGA display
Console: switching to colour frame buffer device 80x60
brd: module loaded
physmap platform flash device: 04000000 at 34000000
physmap-flash physmap-flash.0: map_probe failed
smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <nico@fluxnic.net>
eth0: SMC91C11xFD (rev 1) at c8800000 IRQ 25 [nowait]
eth0: Ethernet addr: 52:54:00:12:34:56
mousedev: PS/2 mouse device common for all mice
TCP cubic registered
NET: Registered protocol family 17
VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev 0
Warning: unable to open an initial console.
input: AT Raw Set 2 keyboard as /devices/fpga:06/serio0/input/input0
input: ImExPS/2 Generic Explorer Mouse as /devices/fpga:07/serio1/input/input1
VFS: Cannot open root device "ram" or unknown-block(1,0)
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
[<c008089c>] (unwind_backtrace+0x0/0xf0) from [<c02df524>] (panic+0x58/0x180)
[<c02df524>] (panic+0x58/0x180) from [<c0008d54>] (mount_block_root+0x15c/0x20c)
[<c0008d54>] (mount_block_root+0x15c/0x20c) from [<c0008fa4>] (mount_root+0xa4/0xc8)
[<c0008fa4>] (mount_root+0xa4/0xc8) from [<c000912c>] (prepare_namespace+0x164/0x1bc)
[<c000912c>] (prepare_namespace+0x164/0x1bc) from [<c0008a10>] (kernel_init+0xe4/0x118)
[<c0008a10>] (kernel_init+0xe4/0x118) from [<c007ba40>] (kernel_thread_exit+0x0/0x8)

Any ideas please...

thanks and regards
ammayappan

Last edited by ammayappan; 09-28-2011 at 09:00 AM.
 
Old 09-28-2011, 08:41 AM   #2
towheedm
Member
 
Registered: Sep 2011
Location: Trinidad & Tobago
Distribution: Debian Stretch
Posts: 612

Rep: Reputation: 125Reputation: 125
You have a kernel panic towards the bottom of your kernel messages. The kernel cannot mount the root fs because the driver for the ram disk was not built into the initramfs.

If you specify only one initramfs archive, it must include the driver for the device that the root fs resides on. In this case, a driver for the ram disk.

I don't use ram disks so unfortunately I cannot say what that diver may be.

You may also need to statically link the 'RAM block device support'.
Device Drives -> Block Devices -> CONFIG_BLK_DEV_RAM=y

Last edited by towheedm; 09-28-2011 at 08:58 AM.
 
Old 09-29-2011, 08:57 AM   #3
michael jo
LQ Newbie
 
Registered: Sep 2011
Posts: 2

Rep: Reputation: Disabled
Hi ,
i am trying to build the initramfs into the kernel,so that i don’t need the initrd kernel parameter while booting.
As the above user said, i have my CONFIG_BLK_DEV_RAM enabled & also referred to the link http://processors.wiki.ti.com/index.php/Initrd and tried the following.

i) Compiled the the busybox and created the contents of the _install folder to be as the rootfs.cpio.gz. with the soft link called init to the /bin/busybox (as specified by the link )
ii) Created default config,and in menuconfig,in the CONFIG_INITRAMFS_SOURCE, gave the absolute path of the rootfs.cpio.gz.
iii) Bompiled the kernel
iv) Booted the kernel with the command.
qemu-system-arm -M versatilepb -m 128M -kernel zImage -append “console=ttyAMA0 ” -serial stdio

And i get the below as my output..
Uncompressing Linux… done, booting the kernel.
Linux version 3.0.0 (mike@mike-OptiPlex-380) (gcc version 4.5.2 (Sourcery G++ Lite 2011.03-41) ) #5 Thu Sep 29 16:17:32 IST 2011
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00093177
CPU: VIVT data cache, VIVT instruction cache
Machine: ARM-Versatile PB
Memory policy: ECC disabled, Data cache writeback
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956ms
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
Kernel command line: console=ttyAMA0
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 125216k/125216k available, 5856k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 – 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 – 0xfffe0000 ( 896 kB)
DMA : 0xffc00000 – 0xffe00000 ( 2 MB)
vmalloc : 0xc8800000 – 0xd8000000 ( 248 MB)
lowmem : 0xc0000000 – 0xc8000000 ( 128 MB)
modules : 0xbf000000 – 0xc0000000 ( 16 MB)
.init : 0xc0008000 – 0xc0134000 (1200 kB)
.text : 0xc0134000 – 0xc045d150 (3237 kB)
.data : 0xc045e000 – 0xc047a340 ( 113 kB)
.bss : 0xc047a364 – 0xc04941b0 ( 104 kB)
NR_IRQS:192
VIC @f1140000: id 0×00041190, vendor 0×41
Console: colour dummy device 80×30
Calibrating delay loop… 329.31 BogoMIPS (lpj=1646592)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
Serial: AMBA PL011 UART driver
dev:f1: ttyAMA0 at MMIO 0x101f1000 (irq = 12) is a PL011 rev1
console [ttyAMA0] enabled
dev:f2: ttyAMA1 at MMIO 0x101f2000 (irq = 13) is a PL011 rev1
dev:f3: ttyAMA2 at MMIO 0x101f3000 (irq = 14) is a PL011 rev1
fpga:09: ttyAMA3 at MMIO 0×10009000 (irq = 38) is a PL011 rev1
bio: create slab at 0
Switching to clocksource timer3
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NetWinder Floating Point Emulator V0.97 (double precision)
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 244
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
clcd-pl11x dev:20: PL110 rev0 at 0×10120000
CLCD: unknown LCD panel ID 0×00001000, using VGA
clcd-pl11x dev:20: Versatile hardware, VGA display
Console: switching to colour frame buffer device 80×60
brd: module loaded
physmap platform flash device: 04000000 at 34000000
physmap-flash physmap-flash.0: map_probe failed
smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre
eth0: SMC91C11xFD (rev 1) at c8800000 IRQ 25 [nowait]
eth0: Ethernet addr: 52:54:00:12:34:56
mousedev: PS/2 mouse device common for all mice
TCP cubic registered
NET: Registered protocol family 17
VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev 0
Warning: unable to open an initial console.
Freeing init memory: 1200K
input: AT Raw Set 2 keyboard as /devices/fpga:06/serio0/input/input0
input: ImExPS/2 Generic Explorer Mouse as /devices/fpga:07/serio1/input/input1

and it hangs with this

Any suggestions please

thanks
mike
 
Old 09-29-2011, 09:55 AM   #4
zk1234
4MLinux Maintainer
 
Registered: Oct 2010
Location: Poland
Distribution: 4MLinux, Slackware
Posts: 1,254

Rep: Reputation: 220Reputation: 220Reputation: 220
Hello,

I think it is a good idea to compare your rootfs.cpio.gz with a working example:
http://sourceforge.net/projects/linu...e.iso/download (ca 4.5 MB)

I assume that you have Midnight Commander and cdrtools (or cdrkit) installed.

1. Open 4MLinux-3.0-core.iso with Midnight Commander.
2. Copy initrd.gz to any suitable place.
3. Unpack initrd.gz.
4. Rename initrd to initrd.cpio.
5. Inspect the contents of initrd.cpio with Midnigtht Commander.

You will be able to compare 4MLinux initrd.cpio with your rootfs.cpio to find out if something is missing.

Good luck :-)

PS.
Your critical problem is: "Warning: unable to open an initial console."

Last edited by zk1234; 09-29-2011 at 10:02 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Creating initramfs as inbuilt to the kernel and as permanent rootfs ramalingampc2008 Linux - Software 5 11-17-2010 11:42 PM
after updating tot he new kernel 2.6.30 my machine boots into ramfs$ Phunkedelik Arch 1 06-30-2009 02:19 PM
Is Linux2.6 having inbuilt kernel program for USB and VGA? asprakash Linux - Hardware 2 05-19-2006 01:29 PM
The problem is mount ramfs in linux kernel 2.4.8 GLF2000 Linux - Hardware 6 03-02-2006 11:33 PM
How to list modules inbuilt with kernel zulfilee Linux - Software 2 02-17-2006 11:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 04:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration