LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
LinkBack Search this Thread
Old 08-07-2009, 04:48 PM   #1
huyhoang3673
LQ Newbie
 
Registered: Aug 2009
Location: San Jose
Distribution: RedHat & Ubuntu
Posts: 13

Rep: Reputation: 0
Question Problem booting barebone Linux kernel vmlinux with initramfs


*** Could someone please help me with this issue or point me to the right forum for this question? ***

I have stuck with this issues for the past few days and I hope someone can shed some lights on my problem. I’m trying to load x86 Linux kernel onto an x86-based router. Unlike regular PC, the BIOS is merged with a home-grown bootloader called Rommon which will take the place of GRUB to boot Linux. The router doesn’t have any hard drive, so I’m using initramfs as our root file system.
I checked out the latest kernel code from linux.org version 2.6.31 and compiled to vmlinux image. Separately, I create my own initramfs and prepare the initramfs.cpio file. To bundle both of them, I do “make menuconfig” and include the path to my initramfs.cpio (/ws/initramfs.cpio) to Initramfs source file.

General Setup --->[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
() Initramfs source file(s)

As for the boot command, I used “root=/dev/ram rw console=ttyS0,9600” but I keep getting this error message:

serial8250: ttyS1 at I/O 0x2f8 (irq = 0) is a 16550A
Platform driver 'serial8250' needs updating - please use dev_pm_ops
brd: module loaded
loop: module loaded
nbd: registered device at major 43
Uniform Multi-Platform E-IDE driver
ide-gd driver 1.18
i8042.c: No controller found.
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
TCP cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
Using IPI No-Shortcut mode
ramdisk_ecxecute_command = /init
Freeing unused kernel memory: 2112k freed
Warning: unable to open an initial console.
Failed to execute /init
Kernel panic - not syncing: No init found. Try passing init= option to kernel.

Pid: 1, comm: swapper Not tainted 2.6.31-rc2 #24
Call Trace:
[<c12849a0>] ? kernel_init+0x0/0xb0
[<c102b662>] ? panic+0x42/0xf0
[<c12849a0>] ? kernel_init+0x0/0xb0
Clocksource tsc unstable (delta = 550368123 ns)
[<c10012ad>] ? init_post+0xad/0x120
[<c1284a31>] ? kernel_init+0x91/0xb0
[<c100395f>] ? kernel_thread_helper+0x7/0x18

Changing the boot parameter to “root=/dev/ram rw init=/sbin/init console=ttyS0,9600” also didn’t work. The init script is at the top level of my rootfs. I'm not sure why it couldn't find it to execute. Does anyone know what I did wrong and how to fix it? Any suggestion is greatly appreciated.

Last edited by huyhoang3673; 08-10-2009 at 01:38 AM. Reason: No response in 48 hours
 
Old 08-10-2009, 04:09 PM   #2
huyhoang3673
LQ Newbie
 
Registered: Aug 2009
Location: San Jose
Distribution: RedHat & Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 0
Can someone please help me with this issue or point me to another forum that can help me resolve this issue? It's been 3 days and I got no reply for this issue. There must be many Linux guru out there who can help me with this.
 
Old 08-10-2009, 05:14 PM   #3
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: currently under revision
Posts: 1,187

Rep: Reputation: 106Reputation: 106
Just some suggestions:
Maybe looking at/posting on the Hardware/Embedded forum?
Busybox seems to do what you want.. perhaps you could just use that.
 
Old 08-10-2009, 06:57 PM   #4
huyhoang3673
LQ Newbie
 
Registered: Aug 2009
Location: San Jose
Distribution: RedHat & Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 0
Yes, I have Busybox in the /bin directory of my rootfs. This /bin directory along with other directories /proc /dev /etc ... are packaged into initramfs.cpio and bundled with vmlinux image.
How can I move my question to other forums that you suggested? The rules said I can't double post the question. the admin has to move it for me but who is the admin?

Thanks,
 
Old 08-10-2009, 07:43 PM   #5
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,136

Rep: Reputation: 106Reputation: 106
You can click on the "Report" button and ask that your post be moved, but there's no guarantee that someone will read your post there that hasn't read it already, here. It's worth trying, though.

Is this some version of OpenWRT? You might want to check the forums at https://forum.openwrt.org/, as they will be more focused on this type of system.
 
Old 08-11-2009, 11:02 AM   #6
huyhoang3673
LQ Newbie
 
Registered: Aug 2009
Location: San Jose
Distribution: RedHat & Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks Quakeboy2 for your instruction to move a post. My system is not OpenWRT. This is our next generation router, not come out on the market yet.
 
Old 08-12-2009, 04:32 PM   #7
raxip
LQ Newbie
 
Registered: Dec 2008
Posts: 2

Rep: Reputation: 0
I had the same problem. My solutions were as follows:
  1. Put bash in the /bin directory. Since I didn't have a static binary version of it floating around, I simply copied the binary as well as the associated libraries to /lib. Don't forget to run:
    Quote:
    ldconfig -r /path/to/rootfs -c /etc/ld.so.cache
    If you want networking, you'll need to install more libraries (as described in the man page). NOTE: I'm sure you can use ash (instead of bash), I just wanted to get it working. Now that is, I can spend the time getting it working with ash.
  2. Make a symlink for the bin directories that busybox wants to install into:
    Quote:
    ln -sf /bin /path/to/rootfs/usr/bin
    ln -sf /sbin /path/to/rootfs/usr/sbin
  3. Make a symlink from busybox to mount:
    Quote:
    ln -sf /bin/busybox /path/to/rootfs/bin/mount
  4. Start your /init so the general flow is the following:
    Quote:
    #!/bin/bash
    mount -t proc /proc /proc
    mount -t sysfs /sys /sys
    /bin/busybox --install -s
    rm -f /linuxrc # created by busybox
    # do whatever here
    exec /bin/bash
  5. Make sure all copied libraries are executable
  6. Make sure all scripts/binaries needed are executable
  7. And finally, to test your setup, chroot into the environment and test your init script. If you receive any errors, then start up won't work as well.
    Quote:
    chroot /path/to/rootfs

Last edited by raxip; 08-13-2009 at 03:37 PM. Reason: Fixed ldconfig command and added additional steps.
 
Old 08-17-2009, 04:41 PM   #8
huyhoang3673
LQ Newbie
 
Registered: Aug 2009
Location: San Jose
Distribution: RedHat & Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 0
I followed your instruction but I got error at the last step. Here is what I have:
root_fs
|
bin/ dev/ etc/ init* lib/ proc/ root/ sbin@ sys/ tmp/

For bin/ I have all the command symbolically linked to busybox
huyhoang@ngd-build1> ls bin
[@ date@ ftpget@ linux64@ nohup@ sendmail@ time@
[[@ dc@ ftpput@ linuxrc@ nslookup@ seq@ timeout@
addgroup@ dd@ fuser@ ln@ od@ setarch@ top@
adduser@ deallocvt@ getopt@ loadfont@ openvt@ setconsole@ touch@
adjtimex@ delgroup@ getty@ loadkmap@ passwd@ setfont@ tr@
ar@ deluser@ grep@ logger@ patch@ setkeycodes@ traceroute@
arp@ depmod@ gunzip@ login@ pgrep@ setlogcons@ true@
...
huyhoang@ngd-build1> ls etc
fstab* group* hosts* init.d/ inittab* ld.so.cache mdev.conf* nsswitch.conf* passwd* profile*

huyhoang@ngd-build1> ls lib
ld-linux.so.2* libcom_err.so.2* libdl.so.2* libext2fs.so.2* libtermcap.so.2*
libblkid.so.1* libc.so.6* libe2p.so.2* libnss_files.so.2* libuuid.so.1*

All other directories are empty.
Here is the content of my init script:

#!/bin/bash

#Mount things needed by this script
mount -t proc proc /proc
mount -t sysfs sysfs /sys

#Disable kernel messages from popping onto the screen
echo 0 > /proc/sys/kernel/printk

#Clear the screen
clear

#Create all the symlinks to /bin/busybox
busybox --install -s

#Create device nodes
mknod /dev/null c 1 3
mknod /dev/tty c 5 0
mdev -s
exec /bin/bash

But I got error when I run the "chroot" command:
[root@ngd-build1]# chroot root_fs
chroot: cannot run command `/bin/bash': Permission denied

What did I do wrong? What do you expect after running "chroot". How do you bundle this rootfs into Linux kernel? Or what do you have to specify so that when Linux boot up, it uses the rootfs that you created?

Thanks,
 
Old 09-05-2009, 01:35 PM   #9
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: washington U.S.
Distribution: Damn Small Linux, KateOs, M$ Ickdows Vista, My own OS
Posts: 2,094

Rep: Reputation: 104Reputation: 104
do you have enough ram
i cant imagine a router ahving a whole lot of ram
and the ram has to be both the filesystem and ram
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel Booting Slow - initramfs - Ubuntu 7.04 Kernel 2.6.20 bench Linux - Kernel 3 09-11-2007 05:14 AM
Kernel Booting Slow - initramfs - Ubuntu 7.04 bench Linux - Laptop and Netbook 4 07-26-2007 02:40 PM
install new kernel problem with initramfs-tools arsham Linux - General 1 10-04-2006 02:53 PM
quik booting 2.6 kernel and initramfs risu Linux - Kernel 0 09-16-2006 05:00 PM
hard booting vmlinux techrolla Linux - General 0 08-29-2004 01:39 PM


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

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration