Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Making a Gentoo LiveCD - problems with initrd/initramfs
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
bob doe
Apprentice
Apprentice


Joined: 11 Jun 2007
Posts: 207

PostPosted: Mon Apr 07, 2008 12:45 pm    Post subject: Making a Gentoo LiveCD - problems with initrd/initramfs Reply with quote

Hello,

I've been more or less following the Gentoo-wiki on building a LiveCD from scratch available here. The problem with that wiki is that its confusing to go through, and seems to be half-assed because of all the comments put in. It also uses Genkernel. I've been using Gentoo for nearly three years now, and when I first started, I was told Genkernel was the devil, so I never touched it with a 10 foot pole.

This wiki doesnt offer a non-genkernel alternative which is kinda lame, so Im left trying to figure things out on my own. My problem is, my ISO image wont boot. At first I was getting kernel panics because it couldnt mount a file system. Likely the cause of this because I dont have an initrd/initramfs (are these terms the same thing?)

The wiki says to create an initrd by running 'genkernel initrd'. This fails for me as the kernel on my host Gentoo and the kernel Im building the LiveCD with are not the same. And the chroot environment uses the kernel and modules from the host.

I tried to build my own initrd using the contents of /lib/modules/ (650mb) in the chroot but this gives me an initrd of about 250mb. Compare this to other LiveCDs which are max 10mb I've seen. The new initrd I built also hangs my ISO booting at some CPU check.

So alas, my question is. Can anyone clear up this initrd thing for me? What am I supposed to put in it?

Thanks,
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Mon Apr 07, 2008 3:38 pm    Post subject: Reply with quote

Well first of all, be careful with /lib/modules because there might be old modules left over from other kernel versions.

Also, you've got a couple options for getting the kernel/modules built on your host system... I believe you can use INSTALL_MOD_PATH to tell the kernel a different place to put the modules (it uses lib/modules within whatever you specify). Make sure to back up your .config file.

The other option (that might play nicer with genkernel) is making a chroot stage 3 install (just uncompress a stage 3 image somewhere and chroot into it), and install kernel sources in there, and build your livecd kernel/initrd with that. This is probably the way I would do it.

And yeah, initrd / initramfs are the same thing (initrd = init ramdisk)
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 918
Location: Switzerland

PostPosted: Mon Apr 07, 2008 3:53 pm    Post subject: Reply with quote

Hi

When you are building the kernel for the livecd in the chroot with genkernels help, then it will build the initramfs for you. Just get sure you mounted proc in the chroot!
Something like "genkernel --no-clean --menuconfig all" will do all things needed... the file will then be in /boot/initramfs-genkernel-something.

Over the grub's boot parameters, genkernel get advised to use the CD aus root and will search for it!

As far as i know, initrd isn't exactly the same as initramfs... but its initramfs nowadays with newer kernels. (http://en.wikipedia.org/wiki/Initrd)

There was (sometime ago) an entry in that wiki-page for building a linuxrc-script and the initrd around it from scratch... Maybe you can find it in the history? But genkernel does basically the same thing (and alot more) without hassling! :wink:
Back to top
View user's profile Send private message
bob doe
Apprentice
Apprentice


Joined: 11 Jun 2007
Posts: 207

PostPosted: Tue Apr 08, 2008 2:15 am    Post subject: Reply with quote

I found an old post dating back to 2004 which seems to be the origin to the wiki I posted above. In it, it describes how to create and initramfs without genkernel. I did that and now I get this kernel panic while booting the livecd:

Code:
[   99.767424] Unpacking initramfs...<0>Kernel panic - not syncing: bad gzip magic numbers


And unfortunately, I cant seem to get any information about it. Any ideas?

bradN, what is the difference between /lib/modules and /usr/lib ?
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Tue Apr 08, 2008 6:39 am    Post subject: Reply with quote

/lib/modules is where the kernel modules are stored, in subfolders by the kernel versions. /lib is for very basic system libraries needed to boot the system. /usr/lib is for system libraries that aren't strictly necessary to get the machine running (things like KDE, X, most extra programs you install put their libraries here). Just to make things more confusing, /usr/lib/modules is where X's drivers used to be stored.

One way of thinking of it, is that /usr has many of the same folders as /, but they're not as essential (this makes it nice to put /usr on a separate partition, because the system can boot initially without it, and then mount it).

Anyway, to your initrd problem... can you post the commands or steps you used to generate it? Especially things relating to how you finally packaged it as a file.
Back to top
View user's profile Send private message
bob doe
Apprentice
Apprentice


Joined: 11 Jun 2007
Posts: 207

PostPosted: Tue Apr 08, 2008 10:45 am    Post subject: Reply with quote

Sure thing. Here's the entire process A to Z:

Quote:
[size=2]cd ~
mkdir -p livecd/source
cd livecd/source
tar jxvpf ../stage2-i686-2007.0.tar.bz2
mkdir newroot
cd usr
tar jxvf ../../portage-latest.tar.bz2
cd ../
mount --bind /proc proc
mount --bind /dev dev
mount --bind /sys sys
mkdir -p usr/portage/distfiles
mount --bind /usr/portage/distfiles usr/portage/distfiles
cp ~/livecd/makeLIVECD_chroot .
cp ~/livecd/package.use ~/livecd/source/etc/portage/package.use
cp ~/livecd/package.unmask ~/livecd/source/etc/portage/package.unmask
cp ~/livecd/make.conf ~/livecd/source/etc/make.conf
cp ~/livecd/linuxrc ~/livecd/source/
cp ~/livecd/makeLIVECD_chroot ~/livecd/source/
cp ~/livecd/menu.lst ~/livecd/source/
chroot . /bin/bash --login
env-update
source /etc/profile
emerge -C perl
emerge -ave system
emerge --skipfirst -av
emerge --skipfirst -av
emerge --skipfirst -av
emerge -av attr acl rsync logger memtest86+ gentoolkit gentoo-sources
emerge -av dmraid livecd-tools localepurge
update-etc
nano /etc/conf.d/clock
nano /etc/conf.d/hostname
nano /etc/fstab
passwd
cd /usr/src/linux
make allmodconfig
make menuconfig
make && make bzImage modules modules_install
cp arch/i386/boot/bzImage /boot/vmlinuz
##############################
#emerge -ave world
#update-etc
make clean
nano /etc/locale.nopurge
localepurge
makewhatis -u
find / -type f -xdev -name ".keep" -print -exec rm {} \;
cat /proc/mounts > /etc/mtab
updatedb ####COMMAND NOT FOUND??????####
emerge -av grub
rm /boot/grub/menu.lst
cp /menu.lst /boot/grub/menu.lst
touch /boot/initrd
dd if=/dev/zero of=/boot/initrd bs=1024k count=8
losetup /dev/loop0 /boot/initrd
mke2fs /dev/loop0
mkdir /mnt/initrd
mount /dev/loop0 /mnt/initrd
cd /mnt/initrd
mkdir etc dev lib bin proc new cdrom
mv /linuxrc /mnt/initrd/linuxrc
touch etc/mtab
touch etc/fstab
cd bin
cp /bin/sh /bin/cat /bin/mount /bin/umount /bin/mkdir .
cp /bin/chroot /bin/tar /sbin/pivot_root .
cd ../lib
cp /lib/ld-linux.so.2 /lib/libc.so.6 /lib/libncurses.so.5 /lib/librt.so.1 .
cp /lib/libblkid.so.1 /lib/libdl.so.2 /lib/libpthread.so.0 /lib/libuuid.so.1 .
cd ../dev
mknod console c 5 1
mknod null c 1 3
mknod hda b 3 0
mknod hdb b 3 64
mknod hdc b 22 0
mknod hdd b 22 64
mknod tty c 4 0
mknod loop0 b 7 0

cd /var
mv cache db /usr/lib/portage
ln -s /usr/lib/portage/cache cache
ln -s /usr/lib/portage/db db
exit
umount proc sys dev usr/portage/distfiles
cp -rfvp source source.bak
rm -rfv source/usr/portage
rm -rfv source/etc/portage
rm -rfv source/usr/share/doc
rm -rfv source/usr/src
cd ..
rm -rfv target
mkdir target
cp -a source/boot target/
mkdir target/files
rm -rfv source/var/tmp/*
rm -rfv source/var/run/*
rm -rfv source/var/lock/*
rm -rfv source/tmp/*
rm -rfv source/etc/mtab
touch source/etc/mtab
cd source/etc/
tar cvpf ../../target/files/etc.tar * .[[:alnum:]]*
cd ../var/
tar cvpf ../../target/files/var.tar * .[[:alnum:]]*
cd ../root/
tar cvpf ../../target/files/root.tar * .[[:alnum:]]*
cd ../../
time mksquashfs source/ target/files/source.img
time mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size \
4 -boot-info-table -iso-level 4 -hide boot.catalog -o ~/livecd.iso target/
Back to top
View user's profile Send private message
bob doe
Apprentice
Apprentice


Joined: 11 Jun 2007
Posts: 207

PostPosted: Tue Apr 08, 2008 4:16 pm    Post subject: Reply with quote

Someone on #gentoo told me to use initramfs rather than initrd and I was able to construct the following commands, I havent tested it yet, but perhaps you can tell me if its worth anything?

Code:

mkdir -p /boot/initramfs/{bin,sbin,etc,proc,sys,newroot}
cd /boot
cp /bin/busybox.static /boot/initramfs/bin/busybox
ln -s busybox /boot/initramfs/bin/sh
touch /boot/initramfs/init
chmod +x /boot/initramfs/init
touch etc/mtab etc/fstab
cd bin
cp /bin/sh /bin/cat /bin/mount /bin/umount /bin/mkdir /bin/chroot /bin/tar /sbin/pivot_root .
cd ../lib
# THIS MAY CHANGE
cp /lib/ld-linux.so.2 /lib/libc.so.6 /lib/libncurses.so.5 /lib/librt.so.1 /lib/libblkid.so.1 /lib/libdl.so.2 /lib/libpthread.so.0 /lib/libuuid.so.1 .
# END
cd ../dev
mknod console c 5 1
mknod null c 1 3
mknod hda b 3 0
mknod hdb b 3 64
mknod hdc b 22 0
mknod hdd b 22 64
mknod tty c 4 0
mknod loop0 b 7 0
nano /boot/initramfs/init
cd /boot/initramfs
find . | cpio -H newc -o > ../initramfs.cpio
cd ..
cat initramfs.cpio | gzip > initramfs.igz


A problem here is I dont create a lib directory.
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 918
Location: Switzerland

PostPosted: Tue Apr 08, 2008 4:39 pm    Post subject: Reply with quote

Why don't you just add "lib" in the first line?

Don't you also need a linuxrc script?
Back to top
View user's profile Send private message
bob doe
Apprentice
Apprentice


Joined: 11 Jun 2007
Posts: 207

PostPosted: Tue Apr 08, 2008 4:47 pm    Post subject: Reply with quote

See thats the thing... I dont know :D Im treading in unknown waters here :(

I'll add the lib folder to that first line.
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Tue Apr 08, 2008 5:28 pm    Post subject: Reply with quote

Ok, one thing you need to be careful of is the size of the initrd/initramfs/whatever. There's a limit set in the kernel config (4MB by default) that you'll need to change (it's found in device drivers > block) to make the first example you posted work. I know that limit applies to initrd, but I'm not sure about cpio initramfs. Also, pay attention to the filesystem used (ext2 in the first example, cpio archive in the 2nd) - so for the first case, you will need to make sure ext2 filesystem support is built into the kernel (not as a module), for cpio, I'm not sure what if any options are needed.

Personally I like using squashfs if the ramdisk doesn't need to be writable, since this offers compression for the initrd even after it's loaded, and reduces memory pressure.

And as an added bonus, here some appropriate reading material, straight from the kernel's Documentation/early-userspace/README:
Code:
The kernel has currently 3 ways to mount the root filesystem:

a) all required device and filesystem drivers compiled into the kernel, no
   initrd.  init/main.c:init() will call prepare_namespace() to mount the
   final root filesystem, based on the root= option and optional init= to run
   some other init binary than listed at the end of init/main.c:init().

b) some device and filesystem drivers built as modules and stored in an
   initrd.  The initrd must contain a binary '/linuxrc' which is supposed to
   load these driver modules.  It is also possible to mount the final root
   filesystem via linuxrc and use the pivot_root syscall.  The initrd is
   mounted and executed via prepare_namespace().

c) using initramfs.  The call to prepare_namespace() must be skipped.
   This means that a binary must do all the work.  Said binary can be stored
   into initramfs either via modifying usr/gen_init_cpio.c or via the new
   initrd format, an cpio archive.  It must be called "/init".  This binary
   is responsible to do all the things prepare_namespace() would do.

   To maintain backwards compatibility, the /init binary will only run if it
   comes via an initramfs cpio archive.  If this is not the case,
   init/main.c:init() will run prepare_namespace() to mount the final root
   and exec one of the predefined init binaries.


I'm not totally clear on what this prepare_namespace business is all about, but it seems that with initrd, you don't have to worry about it, since things operate as if the initrd is the root partition. Then, like it says, you'd mount the real root partition somewhere and do pivot_root, and probably exec the /sbin/init on that eventually.

One nit to pick: "The initrd must contain a binary '/linuxrc'..." - This is wrong... the kernel will happily execute a /sbin/init from the initrd instead. One side project of mine is a windows recovery partition system built using linux+busybox+ntfsclone, and the whole linux part runs entirely from a 3MB initrd except for mounting the image storage partition.
Back to top
View user's profile Send private message
bob doe
Apprentice
Apprentice


Joined: 11 Jun 2007
Posts: 207

PostPosted: Tue Apr 08, 2008 5:43 pm    Post subject: Reply with quote

I had my kernel set to allocate 8192 for the initrd, which is 1024*8

Did my original commands (the red ones) fit the bill though or did I miss something?
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Tue Apr 08, 2008 6:16 pm    Post subject: Reply with quote

bob doe wrote:
I had my kernel set to allocate 8192 for the initrd, which is 1024*8

Did my original commands (the red ones) fit the bill though or did I miss something?


That should be fine then as far as size goes (I might be tempted to bump the size by one more KB just to make sure the kernel doesn't consider equal sizes to not fit).

updatedb is to update the database used by the "locate" command - I don't have this installed either.

One strategy I would suggest: Instead of rm'ing the things you don't want from the source tree, make a file with a list of the things you don't want in the final product, then use the
Code:
-ef <exclude_file>      list of exclude dirs/files.  One per line
option of mksquashfs to keep them out of the squashfs. The reasoning with this is you can keep a functional gentoo there, and update packages, etc, and then strip it down for the liveCD to save space.
Back to top
View user's profile Send private message
bob doe
Apprentice
Apprentice


Joined: 11 Jun 2007
Posts: 207

PostPosted: Wed Apr 09, 2008 12:27 am    Post subject: Reply with quote

Well I created the ext2 initrd and gziped it and got a kernel panic this time saying 'no cpio magic' which is kinda retarded. I guess initramfs is the only thing I can do. Or so I was told in #gentoo.
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Wed Apr 09, 2008 1:42 pm    Post subject: Reply with quote

Don't gzip the initrd. What does your grub.conf look like for this?
Back to top
View user's profile Send private message
bob doe
Apprentice
Apprentice


Joined: 11 Jun 2007
Posts: 207

PostPosted: Wed Apr 09, 2008 10:56 pm    Post subject: Reply with quote

Its actually menu.lst but it looks like this:
Code:
default 0
timeout 30
splashimage=/boot/grub/splash.xpm/gz

title=2004 NO-FB
        kernel /boot/vmlinuz root=/dev/ram0 rw init=/linuxrc cdroot
        initrd /boot/initrd

title=LiveCD NO-FB
        kernel /boot/vmlinuz root=/dev/ram0 real_root=/dev/loop0 looptype=squashfs loop=/livecd.squashfs udev nodevfs cdroot dodrmraid
        initrd /boot/initrd

title=Memtest86+
        kernel /boot/memtest86plus/memtest.bin


Now when I booted with this (the first option) I'd get a kernel panic saying something like : not syncing: bad gzip magic numbers.

I checked Google but it doesnt get many valid hits. Someone on #gentoo suggested I should gzip the initrd file and then change my menu.lst to initrd /boot/initrd.gz

When I did that, I'd get a kernel panic saying something like this : not syncing: bad cpio magic

Since then, I've modified my building to use an initramfs with the following commands, thought for some reason now that I cant figure... even grub wont boot (and I've not modified that part) But the commands I've used for initramfs are as follows:
Code:
mkdir -p /boot/initramfs/{bin,sbin,etc,proc,sys,newroot,lib,dev}
cd /boot
cp /bin/busybox.static /boot/initramfs/bin/busybox
ln -s /boot/initramfs/bin/busybox /boot/initramfs/bin/sh
mv /init /boot/initramfs/init
mv /linuxrc /boot/initramfs/linuxrc
cd /boot/initramfs
touch etc/mtab etc/fstab
cd bin
cp /bin/sh /bin/cat /bin/mount /bin/umount /bin/mkdir /bin/chroot \
/bin/tar /sbin/pivot_root .
cd ../lib
## THIS MAY CHANGE
cp /lib/ld-linux.so.2 /lib/libc.so.6 /lib/libncurses.so.5 /lib/librt.so.1 \
/lib/libblkid.so.1 /lib/libdl.so.2 /lib/libpthread.so.0 /lib/libuuid.so.1 .
## END
cd ../dev
mknod console c 5 1
mknod null c 1 3
mknod hda b 3 0
mknod hdb b 3 64
mknod hdc b 22 0
mknod hdd b 22 64
mknod tty c 4 0
mknod loop0 b 7 0
find . | cpio -H newc -o > ../initramfs.cpio
cd ..
cat initramfs.cpio | gzip > initramfs.igz
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Wed Apr 09, 2008 11:37 pm    Post subject: Reply with quote

Weird... here's a working grub config and script to generate the initrd...

Code:
#/bin/bash
cd initrd
mksquashfs . ../initrd.squashfs -noappend
chmod -x ../initrd.squashfs


Code:
default 0

splashimage /boot/grub/splash.xpm.gz

title  Start System Recovery installer
kernel /boot/bzImage root=/dev/ram0 quiet NCSR_shell
initrd /boot/initrd.squashfs


NCSR_shell is just a parameter for the init script, and quiet isn't necessary, so the only thing I can think of is that you don't have the filesystem support compiled in the kernel (not as a module), or you're missing "[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support" in the kernel.

My initrd boots /sbin/init directly (which is linked to busybox)
Back to top
View user's profile Send private message
bob doe
Apprentice
Apprentice


Joined: 11 Jun 2007
Posts: 207

PostPosted: Fri Apr 11, 2008 12:20 am    Post subject: Reply with quote

Hmm I'll give yours a try now. I had started with the initramfs as above (made a few corrections)

Code:
mkdir -p /boot/initramfs/{bin,sbin,etc,proc,sys,newroot,lib,dev}
cd /boot
cp /bin/busybox.static /boot/initramfs/bin/busybox
ln -s /boot/initramfs/bin/busybox /boot/initramfs/bin/sh
mv /init /boot/initramfs/init
mv /linuxrc /boot/initramfs/linuxrc
cd /boot/initramfs
touch etc/mtab etc/fstab
cd bin
cp /bin/sh /bin/cat /bin/mount /bin/umount /bin/mkdir /bin/chroot /bin/tar /sbin/pivot_root
cd ../lib
# THIS MAY CHANGE
cp /lib/ld-linux.so.2 /lib/libc.so.6 /lib/libncurses.so.5 /lib/librt.so.1 /lib/libblkid.so.1 /lib/libdl.so.2 /lib/libpthread.so.0 /lib/libuuid.so.1 .
# END
cd ../dev
mknod console c 5 1
mknod null c 1 3
mknod hda b 3 0
mknod hdb b 3 64
mknod hdc b 22 0
mknod hdd b 22 64
mknod tty c 4 0
mknod loop0 b 7 0
cd ..
find . | cpio -H newc -o > ../initramfs.cpio
cd ..   
cat initramfs.cpio | gzip > initramfs.igz


In the end I have an initramfs.igz and an initramfs.cpio in my /boot directory. I modified my menu.lst to look like this:
Code:
default 0
timeout 30
splashimage=/boot/grub/splash.xpm.gz

title=2004 NO-FB
        kernel /boot/vmlinuz root=/dev/ram0 rw init=/boot/initramfs/linuxrc cdroot
        initrd /boot/initramfs.igz

#title=LiveCD NO-FB
#        kernel /boot/vmlinuz root=/dev/ram0 real_root=/dev/loop0 looptype=squashfs loop=/livecd.squashfs udev nodevfs cdroot dodrmraid
#        initrd /boot/initramfs.igz

title=Memtest86+
        kernel /boot/memtest86plus/memtest.bin


But when I boot '2004 NO-FB' I get a kernel panic stating:
Quote:
No init found. Try passing the init= option to kernel.


But it is clearly there in the kernel line of menu.lst

Anyways, Im about to start building ISO number 14 heh, I'll give your above a try.
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Fri Apr 11, 2008 2:41 am    Post subject: Reply with quote

I would think init=/linuxrc would make more sense because it's relative to the position inside the initrd, not where the initrd itself is located.
Back to top
View user's profile Send private message
bob doe
Apprentice
Apprentice


Joined: 11 Jun 2007
Posts: 207

PostPosted: Fri Apr 11, 2008 3:16 am    Post subject: Reply with quote

I tried the method you suggested with the initrd and squashfs. The system hangs trying to load the kernel though, right after Grub.

Editing the boot line for the kernel and changing to init=/linuxrc still gives the same kernel panic error. Though I noticed two other failures that I didnt notice before (though likely they occurred before too)
Code:
Failed to execute /init
Failed to execute /linuxrc.  Attempting defaults...

Then the kernel panics.

I'll play around with it and see if I can figure it out, but advice would be nice :)
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Fri Apr 11, 2008 3:58 am    Post subject: Reply with quote

Hmm, I can't think of many other suggestions unless you want to look at the full "recovery partition" project I've got... probably somewhere in the neighborhood of 10MB. BTW, I strongly recommend using qemu to debug boot CDs... it beats burning and rebooting and all of that nonsense. In fact, it will load a kernel and initrd straight without even using grub, etc.
Back to top
View user's profile Send private message
bob doe
Apprentice
Apprentice


Joined: 11 Jun 2007
Posts: 207

PostPosted: Fri Apr 11, 2008 4:02 am    Post subject: Reply with quote

I just toss the ISO onto an SD card, then plug it into the back of my desktop, and fire up VMware. Heh, no way I'd be wasting disks on this!

Just an off-topic question.. the command update-etc. My response is usually always -5 (as in, copy all updated configs). Now in my scripts, they hang until I press -5 [enter]. Is there a way to add that value into the script? I tried 'update-etc -5' but it gave me an invalid option error.
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Fri Apr 11, 2008 4:05 am    Post subject: Reply with quote

echo -5 | etc-update

is probably what you want :)

Also, I can extract the kernel config from the working kernel from this project if you'd like. However, it's very stripped down and intended to be non-modular.
Back to top
View user's profile Send private message
bob doe
Apprentice
Apprentice


Joined: 11 Jun 2007
Posts: 207

PostPosted: Fri Apr 11, 2008 12:28 pm    Post subject: Reply with quote

Sure I can always take a look at it.

Curious would bad file permissions or bad scripting in either of /boot/initramfs/init and /boot/initramfs/linuxrc be the cause of my kernel panic?
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 918
Location: Switzerland

PostPosted: Fri Apr 11, 2008 3:30 pm    Post subject: Reply with quote

Quote:
Curious would bad file permissions or bad scripting in either of /boot/initramfs/init and /boot/initramfs/linuxrc be the cause of my kernel panic?

The Kernel itself should always have enough rights! :wink:
And this:
Quote:
Failed to execute /linuxrc. Attempting defaults...

doesn't look like a scripting mistake (syntax) in the file...

But those files have to be executable! (chmod +x, and a right shibang line, which points to an interpreter avaiable in the init-ramdisk!)

To get shure yourself, i would make a basic test with linuxrc and/or init...

Code:
#!/bin/sh
echo "Yes, this script $0 gets executed!!"
Back to top
View user's profile Send private message
bob doe
Apprentice
Apprentice


Joined: 11 Jun 2007
Posts: 207

PostPosted: Fri Apr 11, 2008 7:34 pm    Post subject: Reply with quote

That test fails.

Here is an output of the /boot directory structure:
Code:
ls -lRh
.:
total 7.2M
-rw-r--r--  1 root root 965K Apr 11 11:30 System.map
-rw-r--r--  1 root root  86K Apr 11 11:30 config
drwxr-xr-x  2 root root 4.0K Apr 11 11:47 grub
drwxr-xr-x 10 root root 4.0K Apr 11 14:39 initramfs
-rw-r--r--  1 root root 2.8M Apr 11 14:47 initramfs.cpio
-rw-r--r--  1 root root 1.3M Apr 11 14:47 initramfs.igz
drwxr-xr-x  2 root root 4.0K Apr 11 10:16 memtest86plus
-rw-r--r--  1 root root 2.1M Apr 11 11:30 vmlinuz

./grub:
total 360K
-rw-r--r-- 1 root root  197 Apr 11 11:47 default
-rw-r--r-- 1 root root 7.9K Apr 11 11:46 e2fs_stage1_5
-rw-r--r-- 1 root root 7.8K Apr 11 11:46 fat_stage1_5
-rw-r--r-- 1 root root 7.0K Apr 11 11:46 ffs_stage1_5
-rw-r--r-- 1 root root 1.8K Apr 11 11:46 grub.conf.sample
-rw-r--r-- 1 root root 7.1K Apr 11 11:46 iso9660_stage1_5
-rw-r--r-- 1 root root 8.5K Apr 11 11:46 jfs_stage1_5
-rw-r--r-- 1 root root  525 Apr 11 14:40 menu.lst
-rw-r--r-- 1 root root 7.2K Apr 11 11:46 minix_stage1_5
-rw-r--r-- 1 root root 9.6K Apr 11 11:46 reiserfs_stage1_5
-rw-r--r-- 1 root root  34K Apr 11 11:46 splash.xpm.gz
-rw-r--r-- 1 root root  512 Apr 11 11:46 stage1
-rw-r--r-- 1 root root 103K Apr 11 11:46 stage2
-rw-r--r-- 1 root root 103K Apr 11 11:46 stage2_eltorito
-rw-r--r-- 1 root root 7.4K Apr 11 11:46 ufs2_stage1_5
-rw-r--r-- 1 root root 6.6K Apr 11 11:46 vstafs_stage1_5
-rw-r--r-- 1 root root 9.2K Apr 11 11:46 xfs_stage1_5

./initramfs:
total 44K
drwxr-xr-x 2 root root 4.0K Apr 11 11:47 bin
drwxr-xr-x 2 root root 4.0K Apr 11 11:47 dev
drwxr-xr-x 2 root root 4.0K Apr 11 11:47 etc
-rwxr-xr-x 1 root root 1.1K Apr 11 07:09 init
drwxr-xr-x 2 root root 4.0K Apr 11 11:47 lib
-rwxr-xr-x 1 root root 1.1K Apr 11 07:09 linuxrc
-rwxr-xr-x 1 root root   68 Apr 11 14:39 linuxrc.test
drwxr-xr-x 2 root root 4.0K Apr 11 11:47 newroot
drwxr-xr-x 2 root root 4.0K Apr 11 11:47 proc
drwxr-xr-x 2 root root 4.0K Apr 11 11:47 sbin
drwxr-xr-x 2 root root 4.0K Apr 11 11:47 sys

./initramfs/bin:
total 1.1M
-rwxr-xr-x 1 root root 658K Apr 11 11:47 busybox
-rwxr-xr-x 1 root root  18K Apr 11 11:47 cat
-rwxr-xr-x 1 root root  14K Apr 11 11:47 chroot
-rwxr-xr-x 1 root root  22K Apr 11 11:47 mkdir
-rwx--x--x 1 root root  51K Apr 11 11:47 mount
-rwxr-xr-x 1 root root 5.3K Apr 11 11:47 pivot_root
lrwxrwxrwx 1 root root   27 Apr 11 11:47 sh -> /boot/initramfs/bin/busybox
-rwxr-xr-x 1 root root 231K Apr 11 11:47 tar
-rwx--x--x 1 root root  34K Apr 11 11:47 umount

./initramfs/dev:
total 0
crw-r--r-- 1 root root  5,  1 Apr 11 11:47 console
brw-r--r-- 1 root root  3,  0 Apr 11 11:47 hda
brw-r--r-- 1 root root  3, 64 Apr 11 11:47 hdb
brw-r--r-- 1 root root 22,  0 Apr 11 11:47 hdc
brw-r--r-- 1 root root 22, 64 Apr 11 11:47 hdd
brw-r--r-- 1 root root  7,  0 Apr 11 11:47 loop0
crw-r--r-- 1 root root  1,  3 Apr 11 11:47 null
crw-r--r-- 1 root root  4,  0 Apr 11 11:47 tty

./initramfs/etc:
total 0
-rw-r--r-- 1 root root 0 Apr 11 11:47 fstab
-rw-r--r-- 1 root root 0 Apr 11 11:47 mtab

./initramfs/lib:
total 1.8M
-rwxr-xr-x 1 root root 107K Apr 11 11:47 ld-linux.so.2
-rwxr-xr-x 1 root root  36K Apr 11 11:47 libblkid.so.1
-rwxr-xr-x 1 root root 1.2M Apr 11 11:47 libc.so.6
-rwxr-xr-x 1 root root 9.4K Apr 11 11:47 libdl.so.2
-rwxr-xr-x 1 root root 264K Apr 11 11:47 libncurses.so.5
-rwxr-xr-x 1 root root 116K Apr 11 11:47 libpthread.so.0
-rwxr-xr-x 1 root root  30K Apr 11 11:47 librt.so.1
-rwxr-xr-x 1 root root  14K Apr 11 11:47 libuuid.so.1

./initramfs/newroot:
total 0

./initramfs/proc:
total 0

./initramfs/sbin:
total 0

./initramfs/sys:
total 0

./memtest86plus:
total 108K
-rw-r--r-- 1 root root 101K Apr 11 10:16 memtest.bin


And actually, its the first time I run that and I just noticed the symlink for sh is broken.... that may be why.

[edit]
I copied /bin/sh to /boot/initramfs/bin/sh and remade the initramfs.cpio and initramfs.igz and repacked the ISO. The kernel loaded fine it seems. Now I just get a bunch of errors with my init file. I'll figure those out. Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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