View previous topic :: View next topic |
Author |
Message |
f.kater Guru
Joined: 23 May 2002 Posts: 342 Location: Berlin
|
Posted: Thu Feb 05, 2009 9:59 am Post subject: initramfs from gentoo wiki: nothing displayed by echo [ok] |
|
|
Hi,
this is probably a trivial problem:
I followed the guide http://en.gentoo-wiki.com/wiki/Initramfs to create a minimal initramfs. The system starts, however, the 'echo' commands do not display anything on the screen.
This is the /init script (same as on the wiki, just sda1 is changed to sda3):
Code: | #!/bin/busybox sh
# mount proc and sys
mount -t proc none /proc
mount -t sysfs none /sys
# do your magic here
echo ----------------------------------------
echo Hello World. This is my first initramfs.
echo ----------------------------------------
# mount the root filesystem
mount -o ro /dev/sda3 /root
# clean up
umount /proc
umount /sys
# boot the real thing
exec switch_root /root /sbin/init
|
For debugging I inserted another echo, redirected into the file 'test.dat' (works):
Code: | #!/bin/busybox sh
# mount proc and sys
mount -t proc none /proc
mount -t sysfs none /sys
# do your magic here
echo ----------------------------------------
echo Hello World. This is my first initramfs.
echo ----------------------------------------
#
# TEST works (file is written)
#
mount -o rw /dev/sda3 /root
echo "test" > /root/test.dat
umount /root
# mount the root filesystem
mount -o ro /dev/sda3 /root
# clean up
umount /proc
umount /sys
# boot the real thing
exec switch_root /root /sbin/init
|
So, beeing in the real system, I have the file /test.dat. I also see the numerous reiserfs output (from the multiple mount/umount commands). However, no output by 'echo' on the screen.
Meanwhile, I have also tried to use busybox' mdev -s to populate initramfs's dev/ (instead of copying /dev/console, /dev/null, /dev/sda3 from the current system into the initramfs -> dev/, mentioned on the wiki). When I insert 'ls /dev/* > /root/ls-output.dat' in the initramfs, and later examine 'ls-output.dat' I see: All devices where present.
FYI: I am using vanilla-kernel-2.6.28.3
What may be missing here?
Thank You
Last edited by f.kater on Mon Feb 09, 2009 9:32 am; edited 1 time in total |
|
Back to top |
|
|
DONAHUE Watchman
Joined: 09 Dec 2006 Posts: 7651 Location: Goose Creek SC
|
Posted: Thu Feb 05, 2009 11:00 pm Post subject: |
|
|
On your screen, you should see:
Quote: | Hello World. This is my first initramfs. |
You should not see:
because you directed that output to /root/test.dat |
|
Back to top |
|
|
f.kater Guru
Joined: 23 May 2002 Posts: 342 Location: Berlin
|
Posted: Sun Feb 08, 2009 7:35 pm Post subject: |
|
|
DONAHUE wrote: | On your screen, you should see:
Quote: | Hello World. This is my first initramfs. |
You should not see:
because you directed that output to /root/test.dat |
Probably I was not clear enough: I see NOTHING on the screen. No output from 'echo'.
The redirection was a only test to check if I can use echo to write into a file instead.
So, I wonder why there is nothing displayed by 'echo'. |
|
Back to top |
|
|
f.kater Guru
Joined: 23 May 2002 Posts: 342 Location: Berlin
|
Posted: Sun Feb 08, 2009 9:36 pm Post subject: |
|
|
Tried with gentoo-sources-2.6.28-r1.
Still no output by 'echo'.
Either some kernel options are missing or the 'init' example on the gentoo wiki is lacking something... |
|
Back to top |
|
|
165177 Apprentice
Joined: 27 Apr 2007 Posts: 156
|
Posted: Sun Feb 08, 2009 9:39 pm Post subject: |
|
|
Is the text console up at all? More precisely, do the required device nodes /dev/console and /dev/tty1 exist, when "echo" is executed? |
|
Back to top |
|
|
f.kater Guru
Joined: 23 May 2002 Posts: 342 Location: Berlin
|
Posted: Mon Feb 09, 2009 9:31 am Post subject: |
|
|
The issue is solved.
I've learned this:
- If initramfs has just /dev/console + /dev/null copied from the original /dev (like in the gentoo wiki example): This did not work for me. Don't know why.
- If mdev -s is used to populate dev (of initramfs): This creates dev/console + dev/null (tested with ls /dev/* >test.dat), however, this seems to be too late for the 'echo' commands somehow. Altough mdev -s was executed before 'echo'.
- Solution: dev/console and dev/null have to be there in initramfs/dev/ statically copied, and additionally, mdev -s should be used for the rest.
Sorry for bothering... |
|
Back to top |
|
|
|