How do I compile drivers for Linux automation in Ghost Solution Suite?
GSS 3.x
Compiling drivers for Linux and adding them to your Linux Automation image
This article explains how to compile drivers for Linux automation and add them to your Linux image. Compiling drivers for Linux automation can be a daunting task, but once your environment is setup and you've done it a few times it becomes quite easy.
To complete this procedure, you will need access to a computer running Linux (most any distro will work; these steps were written using Centos 6.5). You will also need to access a Ghost Solution Suite server. It is presumed you have a basic understanding of Linux and Ghost Solution Suite. Ghost Solution Suite 3.x , along with Linux kernel version 3.18.22/, were used in the creation of this document.
Note: The Linux pre-boot environment shipping with Ghost Solution Suite uses kernel 3.18.22 . Compile drivers against this kernel version and source.
Preparing Your Linux Computer
NOTE: If using Centos or Redhat an account with sudo or root access is required.
First, you will need to setup your Linux computer to compile drivers for Linux automation. This involves installing the correct compiler, downloading the kernel source code, adding the configuration information from your Linux automation image, and compiling the source code. You should only have to do this part once; after you have everything setup you can skip to the Compiling Drivers section.
Copy the config from the eXpress share or the linux pre boot.
mount -t cifs //<GSS server ip>/eXpress /mnt -o username=<admin account>,password=<PASSWORD> (NOTE:change everything in <> to your environment)
cp /mnt/BootWiz/platforms/Linux/x86_64/Build/config.x86_64 /usr/src/kernel-3.18.22/.config
"cp /proc/config.gz /mnt/ds"
gzip -d config.gz
". You should now have a file named confg. Rename it to .config (notice the period in front of config) with the command "mv config .config
". If you do an ls, you'll notice that the config file has disappeared. In Linux, files with a period (.) prefix are hidden files, so they won't show up when you do an ls. If you really want to make sure it is there use "ls -a", and it will show up.
Compiling the Driver
Now everything should be set up and ready to go; from here on out you can skip the preparation steps and just compile drivers any time you like.
Note: The compilation process may fail with errors. If you are sure you did everything correctly then it is possible the driver source code is not compatible with the kernel version you are using. In this case you will have to find a different version of the driver source code. It is not uncommon for a variable declaration or function call that the driver expects the kernel to provide to be missing in later kernel releases. Linux kernels are released very frequently and anything is fair game for changing each time. For a particular driver that was needed once, 20 different versions were gone through before the one was found that worked. Even when a driver compiles that doesn't mean it will load properly, it may still complain about missing variables/function calls when it is loaded. That is the joy of working in Linux—you just have to keep trying. The advantage is someone else has probably had your same problem, and you can find how to fix it using the Internet.
Note: If the compilation succeeds, but has warnings this may not be a problem, try loading the driver to see how it goes.
Adding Drivers to the Linux Automation Image
To use the drivers, you need to copy them to the correct location on your Deployment Solution server and then regenerate your image. To do so do the following:
If you don't want to add the driver to your image or want to load it using a script you can load it with the following commands:
Important: The drivers you just compiled will only work with the kernel version they were compiled with. If you upgrade your Linux automation kernel, you will have to re-setup your Linux computer and recompile the drivers.
The following steps can be used for LinPE based on frm2 (6.9.11004+) file that was delivered with GSS 3.3 RU8 or newer release:
With new frm we recommend to build drivers directly on LinPe environment
Boot from LinPE (x86 or x64 correspondingly)
It will be more convenient to set up an SSH server and work over SSH. This step may be skipped
#install ssh
apt update
apt -y install ssh
#specify password
echo 'root:<your password>'
sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
service ssh restart
#show IP address of your LinPe
ip a
Now you can connect to your LinPe over SSH
ssh root@<LinPe IP>
Prepare build environment
apt update
apt y --reinstall install gcc wget make binutils linux-headers-$(uname -r)
#Now you are ready to build your drivers. You can build mentioned brcm driver with following commands ( this is only example your drivers will vary )
#Download and build
mkdir /build && cd /build
wget https://dl.dell.com/FOLDER06347117M/1/Bcom_LAN_216.0.333.12_NX_Linux_Source_216.0.333.12.tar.gz
tar xvfz Bcom_LAN_216.0.333.12_NX_Linux_Source_216.0.333.12.tar.gz
tar xvfz Bcom_LAN_216.0.333.12_NX_Linux_Source_216.0.333.12/tg3-3.139a.tar.gz
cd tg3-3.139a
make
#verify compiled driver
cp tg3.ko /lib/modules/$(uname -r)/
modprobe -v tg3
lsmod