GentooX hangs while booting kernel with Mech hack (solved)

Talk about anything related to Gentoox or Gentoo.
Post Reply
docus
Newbie
Posts: 1
Joined: Sun Nov 28, 2004 9:14 am

GentooX hangs while booting kernel with Mech hack (solved)

Post by docus »

For quite some time I was able to run GentooX using Mech installer hack.
The deployment process of gentoo was as simple as copying rootfs, swapfs from stardust.iso to E:\ ; and linuxboot.cfg, vmlinuz & initrd.gz to C:\Linux where Mech installer had put rudimentary linux distro. It works great with Home edition 3.0c.

This however no longer work with any newer distro. Moreover, when I upgraded 3.0c with magic tool I found out that the newly generated kernel also had the same problem. Xbox simply hangs during kernel load process (just after first signs of linux boot appear on screen).

I spend some time in order to figure out what is causing it, and I want to share these findings on the forum as it may be useful for others.

The problem was clearly with kernel file as replacing vmlinuz with the file from 3.0c was fixing the boot process. First I thought that the problem is related to sources but I ruled this out.

The problem is actually with newer versions of gcc/glib that generate a little bit different object files. It looks like the default.xbe from Mech installer and xebian distro (21760 bytes long) is sensitive to length of bootstrap object files in vmlinuz image. The culprit are misc.o and head.o files. With new compiler they have slightly different sizes and content than files from 3.0c. When I replace them with files generated with 3.0c compiler and regenerate new kernel with new compiler I can again boot with latest new kernel built with a new compiler.

Here are the files that has been working fine for me and has been taken from 3.0c stardust.iso:/rootfs/usr/src/linux

The files that do work:
-rw-r--r-- 1 root root 1236 Oct 22 2003 /usr/src/linux-2.4.22-openmosix/arch/i386/boot/compressed/head.o
-rw-r--r-- 1 root root 17528 Oct 22 2003 /usr/src/linux-2.4.22-openmosix/arch/i386/boot/compressed/misc.o

The files generated by new compiler that don't work:
-rw-r--r-- 1 root root 1352 Nov 28 02:00 /usr/src/linux-2.4.22-openmosix/arch/i386/boot/compressed/head.o
-rw-r--r-- 1 root root 17516 Nov 28 02:00 /usr/src/linux-2.4.22-openmosix/arch/i386/boot/compressed/misc.o


Below is the script that I used to fix the problem and regenerate bzImage:

ORG_KERNEL=/mnt/GentooX.30c/linux-2.4.22-openmosix
NEW_KERNEL=/usr/src/linux
FILE_PATH=arch/i386/boot/compressed

#Override files
cp -f $ORG_KERNEL/$FILE_PATH/head.o $NEW_KERNEL/$FILE_PATH/
cp -f $ORG_KERNEL/$FILE_PATH/misc.o $NEW_KERNEL/$FILE_PATH/

#Regenerate bzImage with new head.o and misc.o
cd $NEW_KERNEL/arch/i386/boot/compressed
ld -m elf_i386 -Ttext 0x100000 -e startup_32 -o bvmlinux head.o misc.o piggy.o
cd $NEW_KERNEL/arch/i386/boot
objcopy -O binary -R .note -R .comment -S compressed/bvmlinux compressed/bvmlinux.out
tools/build -b bbootsect bsetup compressed/bvmlinux.out CURRENT > bzImage

Docus
Post Reply