I have been working on producing a method to update the kernel \drivers within the Altiris DS PXE image. Here is my how to for compiling a new kernel and integrating it into bootwiz.
Update: I have recently had problems with the latest HP DC 8200 elite desktops that are using the new Intel Q67 express chip sets. from what I have found you need to be using a quite modern kernel 2.6.38/39 ish. I personally have had success with the 2.6.39 kernel. This was not spported in the linux boot that was relaesed for DS SP 5.
If you only want to compile new drivers for your PXE image you still need to compile a kernel to the same version in use in your PXE image. You can find this in the Boot Disk Creator tool.
How to build a kernel
First of all I built a virtual machine on my desktop using VMware server. I then installed Debian 5 on it using the net install ISO to make a minimal install. I didn’t set it up with any roles i.e. desktop.
Once booted install SSH. Logging on as root and enter:
apt-get install ssh
After this point you can access the VM with putty and copy files to and from the VM with Winscp. You could install a samba server of ftp but I am not going to cover this here.
Now we need to install all the software needed to allow us to compile kernel sources. This is done using the following command:
apt-get install gcc-4.3 make wget bzip2 build-essential
These tools are as follows:
- gcc-4.3 the GNU C Compiler
- make the tool that runs the compile script
- wget a tool to download files from http servers
- bzip2 a compression tool
- build-essentials tools and libraries used to compile
Once this is complete you have a system that is setup to compile kernels and driver modules.
We now need to get some files from the Altiris system.
First we need the config file from the Altiris Linux boot environment. The config file holds all the settings that were used to build the kernel that is used in the current build and is a good starting place for a new kernel.
To get it we need to send a job down to a machine to boot the Linux environment and run the following script:
cp /proc/config.gz /mnt/ds
gzip -d /mnt/ds/config.gz
This will copy the config file from the boot environment and put it into the root of your deployment share.
Now we also need the rootfs file. This file is like a virtual disk that holds the file system for the Linux been environment we may need to add some files to this or delete as needed. This file is located at \bootwiz\platforms\linux\x86\base\rootfs.
Now you have these files copy them over to the VM using Winscp and place them in the /root directory.
Now we need to get hold of the source code for the kernel that we want to use. If you just want to make new driver modules you need the same version as is used in your existing build (currently 220.127.116.11).
you can download the kernel from here you need a kernel that follows the name linux-2.6.**.*.tar.bz2 it should be about 40mb + in size. I have had good results with 18.104.22.168. Once you have selected the kernel you need right click on it and copy the link location. Then go to your putty and enter the following commands:
wget http://url to file
Instead of having to type “http://url to file” you can right click and the copied location will be pasted in saving your figures. Press enter and your kernel will be downloaded.
Once finished you need to extract the kernel from the archive as bellow:
tar -jxf linux-2.6.**.*.tar.bz2
This will extract the source to a folder of the same name.
To make life easier I would delete the archive now but its up to you.
Now we need to move the kernel source to a folder called linux this is for compatibility with making new drivers.
mv linux-2.6.**.*/ linux/
Now we copy the config file into the kernel source folder and make it hidden (this is how the compiler likes it).
cp /root/config /usr/src/linux/.config
Dont forget the ‘.’ in .config.
OK, you now have the same conditions that the Altiris developers had before they made there kernel. But we want more in our kernel so its time to make some changes.
Now you need to go to the bottom of the menu and select load config, it should already be filled with .config so select ok.
Now you can go through the menu making the changes you require. you probably want to add support for a new chip set or SATA controller so have a look in the drivers section for what you require.
When finished exit out and save your config.
Now you can compile your kernel enter the following:
That’s it, watch the screen go flying by for a while and eventually it will finish. If it ends with lines with “ERROR:” in them something has gone wrong. But hopefully this wont happen.
Your new kernel will be waiting for you in the folder /usr/src/linux/arch/x86/boot/ the kernel file is the one called bzImage.
Copy this out to a safe place and rename to “linux” all lower case.
Now we need to mount the rootfs file to make some changes.
mount -o loop /root/rootfs /mnt/rootfs
You are now inside the rootfs file. We now need to update the modules for the kernel:
rm -r 22.214.171.124? (or what ever folder is there)
cp -r /lib/modules/2.6.**.* /mnt/rootfs/lib/modules/2.6.**.*
You will probably also want to update your pci detection list. to do this enter:
cp /usr/share/misc/pci.ids /mnt/rootfs/usr/share/pci.ids
cp /usr/share/misc/pci.ids /mnt/rootfs/usr/local/share/pci.ids
You can make more changes if needed. When finished unmount the rootfs:
now copy your /root/rootfs file out to some ware safe.
That’s it a new kernel is compiled.
To use this kernel and rootfs over write the linux and rootfs files in \bootwiz\platforms\linux\x86\base\? with the ones you have just made.
Then make a new Linux PXE option or edit an existing one to force a rebuild. Using the regenerate images doesn’t work at least in 6.9 sp2 of the DS.
Now boot your kernel and see how it goes.
If you want to see your kernel boot and get a bit more debug info from it you can remove the quiet commend from the pxeconfig file located in \bootwiz\platforms\linux\x86\misc\ you also need to rebuild the image after this as above.
How to build a driver module
Now you have built a kernel you can build driver modules for that kernel. (important) when you have found your driver source files copy them and extract them to a folder I use /usr/scr/drivers/
then cd in to the driver directory you might find another folder in that named src if so cd into there as well. you should now be in a folder with files with extensions of .c and .h. enter the following commands:
make -C /usr/src/linux SUBDIRS=$(pwd) modules
This command compiles the driver against the kernel created above.
You will now have a .ko file that was not there before this is your driver and it needs to be copied to your bootwiz folder to the following directory string.
You will need to make all those folder if they are not already there. Then recreate your PXE image as before.
Update: Since writing this how to I have found the following article that might also help