LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware - Installation (https://www.linuxquestions.org/questions/slackware-installation-40/)
-   -   Compiling custom Kernel from install cd (https://www.linuxquestions.org/questions/slackware-installation-40/compiling-custom-kernel-from-install-cd-202957/)

turtlespit 07-09-2004 04:52 AM

Compiling custom Kernel from install cd
 
I have an IBM Thinkpad laptop, that I'm trying to get slackware 10 up and running on. Since I use Windows XP for work, I've attempted to install slackware 10 on an externel USB2.0 connected HDD.

Upon installation cd, the USB HDD was successful connected to /dev/sd1, and I was able to do the installation without any problems.

Of course, booting the newly installed system is a different issue. None of the prebuilt slackware kernels have USB mass storage support compiled in (I thought the zipslack kernel might work, but that failed as well).

I realise I need to build my own kernel, but at the moment, this is the only PC I have access to.

Essentially my questions are:
- Is it possible to compile a custom kernel whilst running from the install cd? (after booting the install cd, I've mounted the install partition to /cdrom/live - since the path's are set there by default - but make config dies very quickly)

OR

- Does anybody know of where I can find a prebuilt kernel with USB mass support compiled in? (I've tried googling without success...)

OR

- Are there any other solutions that I haven't thought of?

Any suggestion greatly appreciated!

cheers,
Michael

Bruce Hill 07-09-2004 05:52 AM

Welcome to LQ!

I installed Slack 10.0 with the bare.i kernel and it gave me usb mass storage
right off the bat. Issue
bash-2.05b$ cat /boot/config-ide-2.4.26 | less
and look through that file.

I have 2 usb gas drives (which are lappy drives) and a flash disk. All were
immediately recognized by Slack.

I think the problem may be that you can't mount the device in that stage
of the bootstrap?

You can compile a kernel on another computer and have it on medium ready
to install when Slack asks you which kernel you want to use during it's installation.
Where you compile it doesn't matter, so long as you've got the file available.

Probably not a lot of help, but I hope it gets you thinking some more...

turtlespit 07-09-2004 06:05 AM

Hi Chinaman,

Thanks for the reply. You're right - bare.i gives me USB mass storage as a module, so I was able to install slackware. My issue is that without USB mass storage compiled into the kernel, I can't boot (kernel panic since it can't find /dev/sda).

Because my laptop is the only system I have available to me, I'm in a catch 22 situtation. I need to boot linux to compile a kernel, but I need to compile a kernel to boot linux...

cheers,
Michael

Bruce Hill 07-09-2004 06:13 AM

You want I should email you my .config file, then you can edit it and burn
it to your CD? I guess that would work, eh? Then you'd be able to load
that kernel in the Slack install when you get to choose.

Edit: You can edit the actual file in Notepad, WordPad, etc.

aikempshall 01-01-2005 04:03 AM

Hi

Got the same issue as turtlespit. Wondering if any progress was made.

I'm probably in a better position as I have a desktop with Slack10 with which I can compile a kernel. Don't know what options to go with.

My external harddrive is an Archos MiniHD USB 2.0.

I work away from home a lot and use Knoppix with a 1 GB USB pen which is becoming full. So If I can't boot directly from the MiniHD I will use it in conjunction with Knoppix.

Best wishes for the New Year.

turtlespit 01-01-2005 12:20 PM

Hi aikempshall,

I haven't worked on this for a while, as I need to reorg the contents of my USB cased hard disk, and set up a partition to reattempt this.

I have obtained the latest version of the Slax live cd (see slax.linux-live.org) with development tools (gcc, etc) so I hope to be able to compile a custom kernel using that.

Happy new year to all.

warm regards,
Turtlespit

gnashley 01-01-2005 01:29 PM

Use the zipslack kernel or boot image.

turtlespit 01-02-2005 06:38 AM

gnasley,

I can't be completely sure, but I think I tried the zipslack kernel and it didn't work.

I will try this again though.

cheers,
Turtlespit

DaHammer 01-03-2005 02:51 AM

2 ways I can think off the top of my head to get this working.

1) Use a custom initrd to load the USB modules for you.

You'd build the initrd, place it in your /boot directory and make lilo aware of it. This same process is used for booting from SCSI hard drives sometimes. The bootloader would load this initrd as / and then execute whatever is needed to get your models loaded and then switch / to the USB drive. The problem is that you'll need a working linux installation to build the initrd, unless you can find one somewhere.

2) Download one of Live CDs like Knoppix, DamnSmallLinux, or possibly even one of the many Rescue CDs out there that has a toolchain. I believe there is one that trys to mimic Slackware also, so that one may be the best "fit" for the task. I forget the name though. Use the tools on the LiveCD to set up your paritions, format them and etc. Then mount the disk, download the kernel source to it, set it up and build your custom kernel. You'd just need to manipulate the Slackware installation a bit taking care not to overwrite your kernel and etc. You'd want to rebuild the kernel in Slackware when you got it going, so I'd probably keep it as simple as possible and use a barebones non-modular kernel to get it going.

Also, there is a CD available for Linux From Scratch 6.0 at http://mirrors.angelinacounty.net/lfs-boot-cd/ that is just 354mb. It will have a complete toolchain with everything you'd need. That may be your best bet as far as download size goes.

aikempshall 01-03-2005 04:38 AM

Thanks for the replies.

I'm concentrating on option 1 fro DaHammer. Picked up some clues from various other sources.

Now have an initrd.gz sitting in /boot of /dev/sda1. However I can't get the boot process to pick it up. Looking at README.initrd on the installation disks it says once the initrd.gz is made amend the /etc/lilo.conf and run lilo.

This is where I'm stuck. The only way into /dev/sda1 is by mounting it whilst running slackware on my desktop or using the slackware installation disk 1 or the rescue disk 2.

With the installation disk I ran setup again without reformatting and skipping package loading. Used the simple lilo creation but that overwrote my lilo.conf. Used the expert but couldn't find a way of including the initrd.gz or writing the image to a floppy disk.

Tried to do the lilo manually as suggested in README.initrd but couldn't find a way to write it to a floppy. I'm not a lilo person and use GRUB on my desktop. Tried using a GRUB boot disk that refused to start pointing to (sd0,0).

Any suggestions of how I can get LILO to write to a floppy.


Thanks

gnashley 01-03-2005 12:06 PM

The initrd can't be on sda -that's what you nned the modules for. Put the initrd on a floppy or other hard drive which the kernek can access.

aikempshall 01-03-2005 12:30 PM

I've got a little closer using a CD to boot with ISOLINUX.

Did a mkinitrd -c -k 2.4.26 -m jbd:ext3 -f ext3 -r /dev/sda1

moved

uhci.o.gz usbcore.o.gz usb-storage.o.gz

into the /boot/initrd-tree/lib/modules/2.4.26

Amended load_kernel_modules to

insmod /lib/modules/$(uname -r)/jbd.o.gz
insmod /lib/modules/$(uname -r)/ext3.o.gz
insmod /lib/modules/$(uname -r)/usb-storage.o.gz
insmod /lib/modules/$(uname -r)/uhci.o.gz
insmod /lib/modules/$(uname -r)/usbcore.o.gz

Amended linuxrc to include a few sleeps.

Ran mkinitrd.

Moved the contents of the boot directory including the initrd.gz to a tmp directory called isolinux ran -
mkisofs -o archos.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table isolinux

cdrecord to create the CD

Booted from the CD. Picked up the initrd.gz. Bombed out on each and every file in modules directory saying something like "not an ELF file". At least I now have a mechanism to work with!

Googled it and can't find anything meaningful on it

Thanks

DaHammer 01-03-2005 01:19 PM

You will need to decompress the modules before loading them. And why are you loading an ext3 modules? I'd think that ext3 filesystem support would be built into all of the Slackware kernels. I checked bare.i, if that's the one you are using and both ext3 and debugging support (jbd) are built in.

aikempshall 01-03-2005 02:10 PM

No.

I followed the example from README.initrd.

The initial mkinitrd populated /boot/initrd-tree/lib/modules/2.4.26 with

jbd.o.gz and ext3.o.gz

and created a load_kernel_modules with

insmod /lib/modules/$(uname -r)/jbd.o.gz
insmod /lib/modules/$(uname -r)/ext3.o.gz

I then improvised with uhci.o.gz usbcore.o.gz usb-storage.o.gz following the example of jbd and ext3.

Regards

DaHammer 01-03-2005 02:25 PM

Hehe, I edited my post while you were posting your reply. :D

Anyway, I took a look at the initrd tree that mkinitrd from Slackware creates. There is no mechanism in it to decompress the modules that I see. You must be running "mkinitrd" from a bootdisk, on which modules would be gzipp'ed in order to save space, which is a good idea. But I suspect mkinitrd was never intended to be ran from a bootdisk and just blindly copies the gzipp'ed modules into the tree and adds the the insmod lines for them with the .gz. insmod is not capable of decompressing them first, hince why you get the non-elf error. You'll need to add code to decompress them to the "load_kernel_modules" script before loading them.

Try adding a gzip -d line for them, ie:

gzip -d /lib/modules/$(uname -r)/usb-storage.o.gz
gzip -d /lib/modules/$(uname -r)/uhci.o.gz
gzip -d /lib/modules/$(uname -r)/usbcore.o.gz

Also as mentioned above, I find it odd that the ext3 & jbd modules are present. If they aren't then mkinitrd should error when you run it. Either way, i doubt you need those, even though the example in the initrd.README has them. They should be compiled into the kernel your using.

BTW, the "-m" option to mkinitrd specifies which modules you want.
Code:

Usage: mkinitrd [OPTION]

mkinitrd creates an initial ramdisk used to load kernel modules that
are needed to mount the root filesystem, or other modules that might
be needed before the root filesystem is available.

  -c      Clear the existing initrd tree first
  -f      Filesystem to use for root partition (must be used with -r)
  --help  Display this message
  -k      Kernel version to use
  -m      A colon (:) delimited list of kernel modules to load.
          Additional options may be added to use when loading the
          kernel modules (but in this case the entire list must be
          wrapped with double quotes).
  -o      Output image (default /boot/initrd.gz)
  -r      Root partition device (must be used with -f)
  -s      Initrd source tree (default /boot/initrd-tree/)
  -V      Display version number

A simple example:  Build an initrd for a reiserfs root partition:

  mkinitrd -c -m reiserfs

Another example:  Build an initrd image using Linux 2.6.7 kernel
modules for a system with an ext3 root partition on /dev/hdb3:

  mkinitrd -c -k 2.6.7 -m jbd:ext3 -f ext3 -r /dev/hdb3

If run without options, mkinitrd will rebuild an initrd image using
the contents of the $SOURCE_TREE directory, or, if that directory
does not exist it will be created and populated, and then mkinitrd
will exit.



All times are GMT -5. The time now is 01:56 PM.