View previous topic :: View next topic |
Author |
Message |
eyoung100 Veteran
Joined: 23 Jan 2004 Posts: 1428
|
Posted: Fri Jul 02, 2004 11:37 pm Post subject: Initial RAM Disk HOWTO |
|
|
I initially posted an answer to this question RAMDISK: Can't Find Initial RAM Disk, Starting at 0
I got such a good response that I decided to repost my answer as a HOWTO. After reading it, if readers need help compiling in SCSI etc, I'll expand the HOWTO or rewrite it to include adding of modules etc. Please note the quote from monkey89 is from the post noted above.
Introduction
First of all, the likely reason this post was started was The Gentoo Framebuffer HOWTO. If you haven't gotten it working yet, hop on over and dive in. If you took the plunge read on. After experimenting with monkey's thought process in which he came up with this
monkey89 wrote: |
Code: |
mount /boot
(rm /boot/initrd)
dd if=/dev/zero of=/boot/initrd bs=1M count=4
mke2fs -F -m 0 -b 1024 /boot/initrd
/sbin/splash -s -f /etc/bootsplash/default/config/bootsplash-1024x768 >> /boot/initrd
umount /boot
mkdir /initrd
|
|
Error monkey89 is trying to fix
Code: |
$dmesg
<cut>
RAMDISK driver initialized: 16 RAM disk of 4096K size 1024 blocksize
...(some lines further down)...
RAMDISK: Couldn't find valid RAM disk image starting at 0.
<cut>
|
I came up with another solution. This solution is what most other distributions use if they support framebuffered consoles.
Prerequisites
Code: |
su
Password: (root password)
|
After this say your prayers to one of the father's of Linux, for it is RedHat that first introduce the Initial RAM Disk. After thanking RedHat
Code: |
mkdir /initrd
emerge sync (if needed)
emerge mkinitrd
|
Options
From the man page:
-v verbose output (useful for those who like to see what's going on)
--omit-lvm-modules (you need this if you don't use Logical Volume Management)
--omit-raid-modules (same as above for RAID)
--omit-scsi-modules (same as above for SCSI)
--preload=<module> (explained below)
--with=<module> (explained below)
--built-in=<module> (will build an initrd with module inside)
--fstab=<path to fstab> (in our case thats /etc/fstab, wil autodect the root filesystem type, making commands such as mke2fs in monkey89's code obsolete)
Explaination
Before I go on, let me explain --preload, --built-in and --with
For those interested, read on. The impatient may skip to the configuration section.
Did you ever wonder how some distros can compile a totally modular kernel even to the point of compiling filesystem support as a module. Lets take the ext2 filesystem as an example. From the kernel configs:
Quote: |
To compile this file system support as a module, choose M here: the
module will be called ext2. Be aware however that the file system
of your root partition (the one containing the directory /) cannot
be compiled as a module, and so this could be dangerous. Most
everyone wants to say Y here.
|
Think of an initrd as a storage area for things that need to be done before Linux loads. For those of you familiar with C, C++, or COBOL, etc we call this pre-linking (before compile). If I were to compile ext2 as a module, I could preload it into the RAM Disk with --preload=ext2. If you use SCSI, use --with=ext2. --with gets executed after your SCSI modules are loaded. Mkinitrd was created to establish a method for SCSI users to use Linux. I can also build it in, thus skipping prelinking and post-linking, by using --built-in=ext2. The developers and the command understand the concept of all this linking better than just mke2fs.
Configuration
To continue on with code
Code: |
mount /boot
ls /boot
|
Write down the name of your kernel and initrd if you used genkernel, and continue on.
If you used genkernel find the brown section below.
If you compiled your own kernel find the blue section below..
--BLUE SECTION--
The command below is based on my setup. If you need certain modules don't forget to remove the --omit options discussed in the explaination section.
Code: |
mkinitrd -v --omit-scsi-modules --omit-raid-modules --omit-lvm-modules --fstab=/etc/fstab /boot/initrd-2.6.7-gentoo-r6 2.6.7-gentoo-r7
|
Please note that the first 2.6.7-gentoo-r7 is the initrd and the second is the version your /usr/src/linux symlink points to. Kernel name must be exact!
Continue to the brown section.
--BROWN SECTION--
You're reading this because you used genkernel or completed the blue section.
Since genkernel already created your initrd for you, or since you made your own you must append the splash command to the initrd using the append operator >> as noted in monkey's code snippet above. I will now demonstrate.
Code: |
/sbin/splash -s -f /etc/bootsplash/<theme name>/config/bootsplash-<resolution>.cfg >> <the name of your initrd, the one you wrote down>
|
In my case it was
Code: |
/sbin/splash -s -f /etc/bootsplash/livecd-2004.1/config/bootsplash-1024x768.cfg >> /boot/initrd-2.6.7-gentoo-r7
|
After appending your config to your initrd open your text editor to /etc/conf.d/bootsplash and fill in BOOTSPLASH_THEME="<theme name>" with your chosen theme.
Code: |
nano -w /etc/conf.d/bootsplash/
# /etc/init.d/bootsplash.conf
# The name of the theme that should be used during
# startup/shutdown. You can also set this with
# the kernel parameter 'theme' (e.g. by addying
# 'theme=something' to your kernel parameters in
# the bootloader configuration file). The kernel
# parameter overrides BOOTSPLASH_THEME. If both
# variables are empty, 'default' is assumed.
BOOTSPLASH_THEME="livecd-2004.1"
<cut>
|
For the themes used on the LiveCD's (used above)
Code: |
emerge bootsplash-themes-livecd
|
Please note that the initrd's supplied with the themes emerged above are invalid RAM Disk! If you want your dmesg to appear correct, you must build your own RAM Disk.
You may also pass your theme as a kernel parameter in your bootloaders configuration file. I'll paste mine below. Don't forget to add the initrd line. Genkernel users already have this line.
My grub.conf file:
Code: |
default 0
timeout 30
splashimage=(hd0,0)/grub/splash.xpm.gz
# Initial RAM Disk needed for bootsplash. Please note
# that splash=silent only works in 16bpp. See entry below
title=Gentoo Linux 2.6.7-gentoo-r7 (+16bpp fb, +splash)
root (hd0,0)
kernel /kernel-2.6.7-gentoo-r7 root=/dev/hda3 video=vesafb:ywrap,mtrr vga=791 splash=silent theme=livecd-2004.1
initrd /initrd-2.6.7-gentoo-r7
# Initial RAM Disk not needed, but used to not
# cause "Starting at 0" error. Notice that
# splash isn't passed.
title=Gentoo Linux 2.6.7-gentoo-r7 (+32bpp fb)
root (hd0,0)
kernel /kernel-2.6.7-gentoo-r7 root=/dev/hda3 video=vesafb:ywrap,mtrr vga=792
initrd /initrd-2.6.7-gentoo-r7
# Memory tester
title=Memory Test
root (hd0,0)
kernel /memtest86/memtest.bin
|
In closing the dmesg above becomes:
Code: |
dmesg
<cut>
checking if image is initramfs...it isn't (no cpio magic); looks like an initrd
Freeing initrd memory: 281k freed
(a few lines down)
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: loaded (max 8 devices)
(a few lines down again)
RAMDISK: Compressed image found at block 0
VFS: Mounted root (ext2 filesystem).
# My /boot is ext3 which is an offshoot of ext2
<cut>
|
Wrap-Up
After I had a few people read this post, nick_downing went on to ask. In my edit I reiterate the fact that genkernel isn't as great as it's made out to be. Someday soon, maybe
nick_downing wrote: |
Nice one bruvva.. I SAID.. NICE ONE BRUVVA.. hehe. I thought genkernel was capable of doing the bootsplash stuff? So is it really necessary to run the /sbin/splash command after using genkernel? I haven't been successful (haven't tried 16k color mode tho) so maybe that's why?
|
Code: |
/sbin/splash -s -f /etc/bootsplash/<theme name>/config/bootsplash-<resolution>.cfg >> <the name of your initrd, the one you wrote down>
|
I replied as follows:
This splash command is needed with the append >> command because genkernel isn't that smart. As proof look here
Unfortunantly I believe the framebuffer driver only works up to 16k colors, but it will work in resolution up to 1600x1200.
Code: |
ls /etc/bootsplah/<theme name>/config/
|
will give you all supported resolutions for <theme name>, I'll test more than 791 and then edit this post with the result.
[Edit] I rebooted and the splash binary only understands 16k color. See the table of vga values in the Install Handbook 16bpp row if you would rather use numerical values instead of the hex values floating around in the forums. Now that this has been confirmed I wonder where the bug is (in the vgafb.c) or in the splash binary
If you found this post helpful please let me know and I will repost as a thread on its own. You may contact me on UnderNet in the #gentoo channel. |
|
Back to top |
|
|
EricHsu Bodhisattva
Joined: 03 May 2004 Posts: 591 Location: Aragon Consulting Group, Beijing, China
|
Posted: Mon Aug 02, 2004 3:58 am Post subject: |
|
|
BIG THANKS eyoung100!
It WORKS
Code: | RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
RAMDISK: Compressed image found at block 0
|
And, well, I found a little typo here in the "Explaination" section:
Quote: |
Think of an initrd as a storage area... If you use SCSI, use --with=ext2. --with gets executed after your SCSI modules are loaded.
|
I think it should be --with=scsi? (I'm not familiar with scsi anyway, hehe)
_________________ - http://nkbit.com
- http://twitter.com/xuyihua |
|
Back to top |
|
|
eyoung100 Veteran
Joined: 23 Jan 2004 Posts: 1428
|
|
Back to top |
|
|
EricHsu Bodhisattva
Joined: 03 May 2004 Posts: 591 Location: Aragon Consulting Group, Beijing, China
|
|
Back to top |
|
|
dman777 Veteran
Joined: 10 Jan 2007 Posts: 1004
|
Posted: Tue Feb 01, 2011 6:56 am Post subject: |
|
|
It's been awhile since this was created so let me ask...
Instead of doing the above, is it possible just insert "ramdisk_size=16000"(or whatever size you want) on the grub command line, boot into the system, and mkfs /dev/ram0? |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|