K. Venken
2019-11-19 20:32:08 UTC
I was trying to modify the initrd to add my own script, but the modified
version gives a kernel panic.
The Slackware version used is current (actually from 20190917). I burned
it on a DVD and succesfully installed from the DVD. I setup dnsmasq with
tftpboot to which I copied the files from DVD. Without modification, I
can boot another system over the network and run the installer. Trying
to add some files in initrd fails however.
This is what I did:
Copy the existing initrd from DVD or whatever directory the current
version is mirrored (call it $DISTRO):
# cd /tmp
# cp $DISTRO/isolinux/initrd.img .
Now I noticed that since 14.2, the compression has changed to xz:
# file initrd.img
initrd.img: XZ compressed data
Decompressing can only be done after fixing the subscript:
# mv initrd.img initrd.xz
# xz -kd initrd.xz
The new file initrd is as expected a cpio archive:
# file initrd
initrd: ASCII cpio archive (SVR4 with no CRC)
Which can be extracted in a subdirectory:
# mkdir initrd.tmp
# cd initrd.tmp
# cpio -id <../initrd
160839 blocks
At this point I can browse the files and in ./scripts. There is a file
network.sh where I wanted to add my own file. I skipped this for now.
The next steps are to pack the initrd again. This goes like:
# find . | cpio -o --format=newc >../initrd.2
160839 blocks
This looks OK, checking the filesize gives the same size:
# cd ..
# ls -l -d initrd*
-rw-r--r-- 1 root root 82349568 Nov 19 20:56 initrd
-rw-r--r-- 1 root root 82349568 Nov 19 21:06 initrd.2
drwxr-xr-x 20 root root 4096 Nov 19 21:02 initrd.tmp
-rw-r--r-- 1 root root 38147436 Nov 19 20:56 initrd.xz
Next, compress:
# xz -kz initrd.2
At this point it gets suspicious, the filesizes differ:
# ls -l -d initrd*
-rw-r--r-- 1 root root 82349568 Nov 19 20:56 initrd
-rw-r--r-- 1 root root 82349568 Nov 19 21:06 initrd.2
-rw-r--r-- 1 root root 38902212 Nov 19 21:06 initrd.2.xz
drwxr-xr-x 20 root root 4096 Nov 19 21:02 initrd.tmp
-rw-r--r-- 1 root root 38147436 Nov 19 20:56 initrd.xz
Using this initrd.2.xz as initrd.img, I get the boot prompt, kernel
loads and then aborts with a kernel panic.
Actually, I verified with Midnight Commander that I can enter the new
initrd.img just like the other one, suggesting that the file is OK.
So I am wondering if the "boot-stuff" has specific requirements for
compression? I tried xz with --format=raw but this changes nothing.
What's more. I used the same kind of setup with 14.2 and there it was
OK, but 14.2 uses gz compression in stead of xz.
version gives a kernel panic.
The Slackware version used is current (actually from 20190917). I burned
it on a DVD and succesfully installed from the DVD. I setup dnsmasq with
tftpboot to which I copied the files from DVD. Without modification, I
can boot another system over the network and run the installer. Trying
to add some files in initrd fails however.
This is what I did:
Copy the existing initrd from DVD or whatever directory the current
version is mirrored (call it $DISTRO):
# cd /tmp
# cp $DISTRO/isolinux/initrd.img .
Now I noticed that since 14.2, the compression has changed to xz:
# file initrd.img
initrd.img: XZ compressed data
Decompressing can only be done after fixing the subscript:
# mv initrd.img initrd.xz
# xz -kd initrd.xz
The new file initrd is as expected a cpio archive:
# file initrd
initrd: ASCII cpio archive (SVR4 with no CRC)
Which can be extracted in a subdirectory:
# mkdir initrd.tmp
# cd initrd.tmp
# cpio -id <../initrd
160839 blocks
At this point I can browse the files and in ./scripts. There is a file
network.sh where I wanted to add my own file. I skipped this for now.
The next steps are to pack the initrd again. This goes like:
# find . | cpio -o --format=newc >../initrd.2
160839 blocks
This looks OK, checking the filesize gives the same size:
# cd ..
# ls -l -d initrd*
-rw-r--r-- 1 root root 82349568 Nov 19 20:56 initrd
-rw-r--r-- 1 root root 82349568 Nov 19 21:06 initrd.2
drwxr-xr-x 20 root root 4096 Nov 19 21:02 initrd.tmp
-rw-r--r-- 1 root root 38147436 Nov 19 20:56 initrd.xz
Next, compress:
# xz -kz initrd.2
At this point it gets suspicious, the filesizes differ:
# ls -l -d initrd*
-rw-r--r-- 1 root root 82349568 Nov 19 20:56 initrd
-rw-r--r-- 1 root root 82349568 Nov 19 21:06 initrd.2
-rw-r--r-- 1 root root 38902212 Nov 19 21:06 initrd.2.xz
drwxr-xr-x 20 root root 4096 Nov 19 21:02 initrd.tmp
-rw-r--r-- 1 root root 38147436 Nov 19 20:56 initrd.xz
Using this initrd.2.xz as initrd.img, I get the boot prompt, kernel
loads and then aborts with a kernel panic.
Actually, I verified with Midnight Commander that I can enter the new
initrd.img just like the other one, suggesting that the file is OK.
So I am wondering if the "boot-stuff" has specific requirements for
compression? I tried xz with --format=raw but this changes nothing.
What's more. I used the same kind of setup with 14.2 and there it was
OK, but 14.2 uses gz compression in stead of xz.