www.zeroshell.org Forum Index www.zeroshell.org
Linux Distribution for server and embedded devices
 
 SearchSearch  RegisterRegister  UsergroupsUsergroups 
 ProfileProfile  Log inLog in  Log in to check your private messagesPrivate Message 

Replacing kernel module (unsupported ethernet card)

 
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> ZeroShell
View previous topic :: View next topic  
Author Message
aviegas



Joined: 19 Jun 2010
Posts: 17

PostPosted: Tue Jun 22, 2010 10:41 am    Post subject: Replacing kernel module (unsupported ethernet card) Reply with quote

I would like to share my experience rebuilding the ISO and CF/USB/HD Zeroshell images in order to add support for a new ethernet card.

Background: I'm building a router using a SuperMicro X7SPA-HF motherboard. This is a tiny micro-ITX mobo, with an Intel D510 Atom processor (1.6GHz, dual core with Hyperthreading). It also support IPMI 2.0 and iKVM, so one gets full remote console over IP out of the box. It comes with 2 Intel Gigabit adapters, 8 USB ports, 6 SATA and much more. The issue with ZeroShell is that the Intel Gigabit chipset is not supported by the version of the e1000e module in the current ZeroShell kernel.

Solution: After some investigation and forum browsing, the simplest way to tackle the problem is to "replace" the kernel module with one compiled with the latest e1000e sources from Intel.

Acknowledgments: Thanks for Fulvio for the great ZeroShell distro, and to all other that posted their kernel / image rebuilding experiences in this forum.

These as the steps I've used to replace the module:

Requirements:
. ZS kernel source
. Another Linux system, setup for kernel development/build, in 32bit mode and running kernel 2.6.x, referred as the "aux" system here. It can even be a live system running under vmware.
. The updated source for the device driver module (in my case e1000e from Intel).
. The CF/USB/HD ZS image on a USB stick

Step 1) Building the new module:

1) Login to the aux linux and create a working directory.
2) Expand the kernel sources
3) Find the location of the module you need to replaced the source, erase the code there and add the new module source.
4) From a running ZeroShell, extract the current Kernel configuration by running "zcat /proc/config.gz >.config". Since I had no ethernet, I have to place it in the /Database directory and use the USB stick to move it from the ZS system to the aux linux (/Directory is the 3rd parition on the USB stick).
5) On the aux, go to the root of the kernel source, do a "make mrproper" to clean things up copy the kenel config (.config) to this directory. Now simply run "make". Sit down and relax as it will take a while.

2) Step 2: recreating the ISO image

1) Plug the USB stick in the aux system and if it automounts any filesystem, unmount it.
2) Copy all 3 partitions to the hard drive using dd. Assuming the USB stick is mounted at /dev/sdb
dd if=/dev/sdb1 of=boot.img
dd if=/dev/sdb2 of=iso.img
dd if=/dev/sdb3 of=db.img

These 3 files will be used to remake the USB stick later
3) mount the iso.img: mount -o loop iso.img /mnt
4) Copy all files from it to a temp directory with "cp -pr /mnt <yourtempdir>".
5) replace the required module in the newly copied modules directory (look inside the newly created directory).
6) now, rebuild the modules dependencies. First you need to "mimic" the correct location for the modules, so the the 2.6.25.20 directory in modules must be located inside a <temp>/lib/modules/2.6.25.20. Create this temporary location (<temp>/lib/modules) and "mv" the 2.6.25.20 directory there (from the modules directory in the iso copy).
Then run depmod with the -b flag: "depmod -b <temp>". Move the 2.6.25.20 directory back to it's original location in the copy.
7) Now rebuild the ISO image file with mkisofs (or genisoimage)

mkisofs -o newiso.img -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -r -l <dir>

Cool Voila! The new ISO image is ok and should work, if you are using a CD to book ZS.

Note the only problem I have here is that I could not get it to shrink back to the same/approximate size.

Step 3) Place it back on the stick
1) The size of the newiso.img is too big to fit in the same place of the original in the stick. So let's make some room. You will need a 2G or bigger USB Stick for this.

Note: if someone knows how to make the newiso.img smaller, please let me know what am I missing here. I know it has to do with the file slack that is not being removed from the files from the HD to the CD image.

2) using fdisk on the aux system, create 3 primary partitions on the USB stick with the following sizes: 14MB, 400MB, 600MB. This will give you plenty of space to toy around without risking overwriting the partitions.

3) Now dd pack the 3 images:

dd if=boot.img of=/dev/sdb1
dd if=newiso.img of=/dev/sdb2
dd if=db.imb of=/dev/sdb3

This new stick should boot without a problem. The USB stick can be replaced with a CF card or a HD here.
Back to top
View user's profile Send private message
jasonh100



Joined: 12 Feb 2010
Posts: 22

PostPosted: Mon Sep 13, 2010 12:58 pm    Post subject: Reply with quote

Hey, I am trying to put zeroshell on the same motherboard. Can you send me the files that you created?
Back to top
View user's profile Send private message
jasonh100



Joined: 12 Feb 2010
Posts: 22

PostPosted: Mon Sep 13, 2010 1:41 pm    Post subject: Reply with quote

I have a linux system that meets the requirements of the "aux" system. compiling right now. I have my fingers crossed. Thanks for this guide!
Back to top
View user's profile Send private message
jasonh100



Joined: 12 Feb 2010
Posts: 22

PostPosted: Mon Sep 13, 2010 4:18 pm    Post subject: Reply with quote

Ok, I gave this a shot and got pretty close. When booting ZS it says:

Looking for PCI hardware:

loading .... e1000e

Then later on in the boot when it gets to the parts where it initializes netfileter, qos, and anything else related to network it displays some messages that reference dependencies. The path to the dependency has 2.6.9-1.667 in it which is the kernel version on the system that I compiled everything on. So I'm guessing I messed up on the dependency mod part.

Can anyone provide any tips?

Or if you see this aviegas, can you send me the newiso.img file that you created?

Thanks,
Jason
Back to top
View user's profile Send private message
jasonh100



Joined: 12 Feb 2010
Posts: 22

PostPosted: Mon Sep 13, 2010 4:37 pm    Post subject: Reply with quote

I copied the 2.6.25.20 folder to 2.6.9-1.667 and now everything is working. So I'm good for now. Thanks again for this guide.
Back to top
View user's profile Send private message
eric.f



Joined: 23 Nov 2010
Posts: 1

PostPosted: Tue Nov 23, 2010 3:07 pm    Post subject: Reply with quote

hello

i want to put zeroshell on the same motherboard . Can you share the iso that you created?

thank you.
Back to top
View user's profile Send private message
stepik



Joined: 11 Mar 2011
Posts: 3

PostPosted: Thu Mar 22, 2012 8:08 pm    Post subject: kernel version Reply with quote

its good to specify version of kernel u wanna run depmod for, like:
depmod -b <temp> 2.6.25.20
had to read docu of depmod:))

and while creating image i get an error with something like this:
(...)rr_moved' have the same Rock Ridge name 'rr_moved'.

Then, remove this directory:
rr_moved from your working directory (with copy of iso.img)
Back to top
View user's profile Send private message
linuxophilicsb



Joined: 26 May 2012
Posts: 4

PostPosted: Thu Jun 28, 2012 11:45 am    Post subject: Reply with quote

My suggestion would be to use the "-hide-rr-moved" option of mkisofs instead of removing

rr_moved.

And the best option to use with depmod is "--dry-run" or "-n" . This sends the resulting

modules.dep and the various map files to standard output rather than writing them into

the module directory(FROM MAN PAGE)/. From there you can redirect the output to a file

which you can later on rename to modules.dep in the target modules dir.

Boot up with the required kernel (let it produce the module dependency errors while

booting) on the target machine.

Once you get to the shell run "depmod -n > /lib/modules/$(uname -r)/modules.dep".

Regards.
Back to top
View user's profile Send private message
jultra



Joined: 10 Jul 2014
Posts: 2

PostPosted: Thu Jul 10, 2014 9:10 am    Post subject: Reply with quote

Hi,

I have a supermicro motherboard that has 2 onboard lans that have the same issue. Where can I get ZS kernel source so I can follow your instruction here.

thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> ZeroShell All times are GMT
Page 1 of 1

 
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


Powered by phpBB © 2001, 2005 phpBB Group