PDA

View Full Version : problem building/booting w/custom kernel



Wisler
04-07-2006, 01:09 PM
Hello all,

(I thought I already posted this but I don't see it anywhere ---- apologies if this is a dup.)

I went through several HowTos and read many posts/responses and was eventually successful in creating a custom
Knoppix with a custom kernel. Now I'm trying to reproduce this success and get the "CANNOT UNITE" error. I think this
indicates unionfs and kernel incompatibility but I don't know how to fix it. Perhaps the problem is that I'm building unionfs
outside the chroot environment, but I thought I did this the first time. Also, I'm not sure whether I need cloop.o or just
cloop.ko will be sufficient.

I'll post my whole remastering process below. I would appreciate any pointers on how to fix this problem, as well as how
to streamline the whole process.



# I'm working on my /mnt/sda6 partition which has about 5.5GB,
# and doing pretty much everything as root

#
# Boot Knoppix 4.0.2
# edit /etc/fstab to add ",dev" to the /mnt/sda6 entry
#
mount -rw /dev/sda6 /mnt/sda6
mkdir /mnt/sda6/knx
mkdir -p /mnt/sda6/knx/master/KNOPPIX
mkdir -p /mnt/sda6/knx/source/KNOPPIX
cp -dpR /KNOPPIX/* /mnt/sda6/knx/source/KNOPPIX
cp -ar /cdrom/boot /mnt/sda6/knx/master/boot
cp /cdrom/index.html /mnt/sda6/knx/master/
cd /cdrom && find . -size -10000k -type f -exec cp -p --parents '{}' /mnt/sda6/knx/master/ \;
cd /mnt/sda6/knx/source/KNOPPIX/usr/src
# I get errors I don't understand when I install the same
# kernel that's running, so I install a different kernel
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.13.tar.gz
gunzip linux-2.6.13.tar.gz
tar xf linux-2.6.13.tar
rm -f linux-2.6.13.tar
rm -f linux
ln -s linux-2.6.13 linux
cp /KNOPPIX/usr/src/linux/.config /mnt/sda6/knx/source/KNOPPIX/usr/src/linux
chroot /mnt/sda6/knx/source/KNOPPIX
mount -t proc /proc proc
# I ignore "warning: can't open /etc/fstab: No such file or directory"
echo "nameserver a.b.c.d" >> /etc/resolv.conf
# There's an actual IP addr above
# Now start making some room...
rm -rf /usr/games
rm -rf /usr/share/games
cd /usr/src
# Find out what packages are installed, and how big they are:
dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -n
# Because somebody somewhere said to:
apt-get update
# remove some packages to make room:
apt-get remove --purge -y kernel-image-2.6.12
# Remove some large packages here with a bunch of apt-get remove's
#
# Seems like I might need the following:
apt-get install uuid-dev
apt-get install ctags
apt-get clean
cd /usr/src/modules
wget http://debian-knoppix.alioth.debian.org/sources/cloop_2.02-1.tar.gz
gunzip cloop_2.02-1.tar.gz
tar xf cloop_2.02-1.tar
cd /usr/src/linux/include
ln -s asm-i386 asm
cd /usr/src/linux
# I take all defaults on next step
make oldconfig
make
# Not sure exactly what I'm doing around here
make-kpkg kernel-image
dpkg -i ../kernel-image*deb
make modules
make modules_install
cd /usr/src/modules/cloop-2.02
make KERNEL_DIR=/usr/src/linux
cd /usr/src/modules
wget ftp://ftp.fsl.cs.sunysb.edu/pub/unionfs/unionfs-1.0.14.tar.gz
gunzip unionfs-1.0.14.tar.gz
tar xf unionfs-1.0.14.tar
cd /usr/src/modules/unionfs-1.0.14
make LINUXSRC=/usr/src/linux TOPINC=-I/usr/src/linux/include
cd /usr/src/linux
rm -f /boot/vmlinuz
rm -f /boot/System.map
ln -s /boot/vmlinuz-2.6.13 /boot/vmlinuz
ln -s /boot/System.map-2.6.13 /boot/System.map
umount /proc
exit
# No longer in the chroot environment
cd /mnt/sda6/knx/source/KNOPPIX/usr/src/modules
cd /mnt/sda6/knx/master/boot/isolinux
mkdir miniroot-initrd
mkdir miniroot-initramfs
gunzip minirt.gz
mount -o loop minirt miniroot-initrd
cp -Rp miniroot-initrd/* miniroot-initramfs/
umount ./miniroot-initrd
rmdir ./miniroot-initrd
cd miniroot-initramfs
touch init
chmod +x init
echo '#!/static/ash' >> init
echo '/linuxrc' >> init
echo 'exec /etc/init "$@" </dev/console >/dev/console 2>&1' >> init
cp -f /mnt/sda6/knx/source/KNOPPIX/usr/src/modules/unionfs-1.0.14/unionfs.ko \
modules
cp -f /mnt/sda6/knx/source/KNOPPIX/usr/src/modules/cloop-2.02/cloop.ko \
modules
cd modules
strip unionfs.ko
cd ..
find . | cpio --quiet -o -H newc | gzip -9 > ../minirt.gz
cd ..
rm -rf miniroot-initramfs
rm -f minirt
rm -rf /mnt/sda6/knx/source/KNOPPIX/.rr_moved
sed 's/nomce /nomce noeject noprompt /g' \
/mnt/sda6/knx/master/boot/isolinux/isolinux.cfg > \
/mnt/sda6/knx/master/boot/isolinux/isolinux.new
mv /mnt/sda6/knx/master/boot/isolinux/isolinux.new \
/mnt/sda6/knx/master/boot/isolinux/isolinux.cfg
cp /mnt/sda6/knx/source/KNOPPIX/usr/src/linux/arch/i386/boot/bzImage \
/mnt/sda6/knx/master/boot/isolinux/linux
cd /mnt/sda6/knx/source/KNOPPIX/usr/src/linux/
make clean
mkisofs -R -U -V "KNOPPIX.net filesystem" -publisher "KNOPPIX www.knoppix.net" \ -hide-rr-moved -cache-inodes -no-bak -pad /mnt/sda6/knx/source/KNOPPIX \
| /usr/bin/create_compressed_fs - 65536 > /mnt/sda6/knx/master/KNOPPIX/KNOPPIXcd /mnt/sda6/knx/master
find -type f -not -name md5sums -not -name boot.cat -not -name isolinux.bin \
-exec md5sum '{}' \; > KNOPPIX/md5sums
mkisofs -pad -l -r -J -v -V "KNOPPIX" -no-emul-boot -boot-load-size 4 \
-boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
-hide-rr-moved -o /mnt/sda6/knx/knoppix.iso /mnt/sda6/knx/master
qemu -m 128 -cdrom /mnt/sda6/knx/knoppix.iso -boot d -user-net

tr
04-08-2006, 10:10 AM
I went through several HowTos and read many posts/responses and was eventually successful in creating a custom
Knoppix with a custom kernel. Now I'm trying to reproduce this success and get the "CANNOT UNITE" error. I think this
indicates unionfs and kernel incompatibility but I don't know how to fix it. Perhaps the problem is that I'm building unionfs
outside the chroot environment, but I thought I did this the first time. Also, I'm not sure whether I need cloop.o or just
cloop.ko will be sufficient.


New modules in 2.6 kernel are with .ko ending. I think that in Knoppix 4.0,2 modules were renamed to .o which is not the way to do things. Just copy unionfs.ko and cloop.ko files (no need to change even permissions) to /modules inside your minirt.gz. Then make sure linuxrc had cloop.ko and not cloop.o in line 431 (at least in my linuxrc):


$INSMOD -f /modules/cloop.ko file="$1/$KNOPPIX_DIR/$KNOPPIX_NAME"


The same with unionfs:


$INSMOD /modules/unionfs.ko 2>/dev/null && UNIONFS="yes"


Be sure you really have copied unionfs.ko and cloop.ko of the right kernel version and copied them in minirt.gz /modules directory. There seems to be some modification in Knoppix 5.0 but I'm not having it, so I can't say anything more. But I think in new Knoppix those modules are in new /cdrom/boot/modules directory.

If you can't get your unionfs to work, perhaps you would like to use some of my kernel versions (.deb packages) from http://tapsa.terae.net/linux/knoppix/suomiknoppix/
That new 2.6.16-beyond1 has unionfs module compiled with the kernel - so you need only linux-image and cloop-modules package. Other .deb packages are extra modules and you can use them if you need them.


-tapsa-

Wisler
04-09-2006, 09:29 PM
Be sure you really have copied unionfs.ko and cloop.ko of the right kernel version and copied them in minirt.gz /modules directory.


That was the problem. I thought that I was building unionfs.ko properly, but the fistdev.mk was missing. I added the following and this seems to have done the trick:



echo 'LINUXSRC=/usr/src/linux' >> fistdev.mk
echo 'TOPINC=-I/usr/src/linux/include' >> fistdev.mk
echo 'MODDIR=/lib/modules/2.6.13' >> fistdev.mk


Thanks for the sanity check.