Linux netbooting: Difference between revisions

From WirelessAfrica
Jump to navigation Jump to search
No edit summary
No edit summary
Line 38: Line 38:


To get a kernel up and running it needs firstly to boot itself and then run some file system drivers, or even network drivers in the case of NFS, to allow the file systems to mount and let the operating system boot normally. To do this the kernel needs to mount a RAM disk which contains all the drivers necessary for boot up. This RAM disk is called an initrd file or "initial ramdisk file" Below are the steps to firstly create the kernel with the necessary options and secondly the ramdisk file with the required drivers.
To get a kernel up and running it needs firstly to boot itself and then run some file system drivers, or even network drivers in the case of NFS, to allow the file systems to mount and let the operating system boot normally. To do this the kernel needs to mount a RAM disk which contains all the drivers necessary for boot up. This RAM disk is called an initrd file or "initial ramdisk file" Below are the steps to firstly create the kernel with the necessary options and secondly the ramdisk file with the required drivers.
'''I Build the kernel image'''


1) Start the kernel configuration program in /usr/src/<linux kernel version>
1) Start the kernel configuration program in /usr/src/<linux kernel version>
Line 74: Line 76:
  scp bzImage djohnson@meshy.dhcp:~/vmlinuz.david
  scp bzImage djohnson@meshy.dhcp:~/vmlinuz.david


6) Make the kernel module drivers
'''II Build the initial ramdisk file (initrd)'''
 
1) Make the kernel module drivers


  sudo make modules
  sudo make modules


7) Backup your current kernel modules (<current kernel version> is your current kernel e.g. 2.6.10-12
2) Backup your current kernel modules (<current kernel version> is your current kernel e.g. 2.6.10-12


  sudo cp -r /usr/modules/<current kernel version> /usr/modules/<current kernel version>.bak
  sudo cp -r /usr/modules/<current kernel version> /usr/modules/<current kernel version>.bak


8) Install the module drivers (note this will install all the drivers in the directory /lib/modules/<kernel version> If your current kernel version is the same as the kernel source you are building it will overwrite all your current kernel modules but step 7 would have created a backup - after this process however
3) Install the module drivers (note this will install all the drivers in the directory /lib/modules/<kernel version> If your current kernel version is the same as the kernel source you are building it will overwrite all your current kernel modules but step 7 would have created a backup - after this process however you will need to restore your original kernel modules using the backup


  sudo make modules_install
  sudo make modules_install


8) Create the initrd ramdisk image
4) Create the initrd ramdisk image


  sudo mkinitrd -o initrd.img-2.6.12 2.6.12
  sudo mkinitrd -o initrd.img-2.6.12 2.6.12
The mkinitrd script does a few default things here. First it looks at /etc/mkinitrd/mkinitrd.conf to see which modules it must include. In the example above it will look in /lib/modules/2.6.12 to find all the modules to build into the initrd.img-2.6.12 file
5) Copy the initrd file to the server
scp initrd.img-2.6.12 djohnson@meshy.dhcp:~
'''III Setup the server to run the kernel with the initrd file'''
1) Login to the server containing these files

Revision as of 15:21, 25 April 2006

Instructions follow on how to netboot using Ubuntu Linux.

Server Setup

Setup DHCP

/usr/local/etc/dhcp.conf

Setup PXE

Setup Filesystem

Useful information: Building PXE Imager from scratch

1) Use debian debootstrap tool to create basic filesystem.

sudo debootstrap breezy /home/yusuf/ubuntu ftp://ftp.is.co.za/ubuntu/

2) chroot into new filesystem

sudo chroot /home/yusuf/ubuntu/

3) create apt source list

sudo vi /etc/apt/sources.list

4) Add packages

sudo apt-get update
sudo apt-get install ssh olsrd

5) Tar the filesystem

 sudo tar -cvjf ubuntu.tar.gz ./ubuntu/

6) Copy the filesystem to the server and un-tar

 scp ubuntu.tar.gz user@server:

Client Setup

Create Linux Kernel

To get a kernel up and running it needs firstly to boot itself and then run some file system drivers, or even network drivers in the case of NFS, to allow the file systems to mount and let the operating system boot normally. To do this the kernel needs to mount a RAM disk which contains all the drivers necessary for boot up. This RAM disk is called an initrd file or "initial ramdisk file" Below are the steps to firstly create the kernel with the necessary options and secondly the ramdisk file with the required drivers.

I Build the kernel image

1) Start the kernel configuration program in /usr/src/<linux kernel version>

sudo make menuconfig

2) Set the following options on the kernel configuration menus

Processor type and features  --->  
 Processor family: Pentium-Classic
Device Drivers  --->
 Networking support  ---> 
  Networking options  --->
    [*] Packet socket
    [*]IP: kernel level autoconfiguration                             
     [*]     IP: DHCP support
     [*]     IP: BOOTP support
     [*]     IP: RARP support               
File systems  ---> 
 Network File Systems  ---> 
  <*> NFS file system support 
   [*] Root file system on NFS

3) Make the kernel

sudo make

4) Make the kernel image

sudo make bzImage

This will give you your linix kernel image (bzImage) in /usr/src/linux-source-2.6.12/arch/i386/boot/

5) Copy the kernel image to the server

scp bzImage djohnson@meshy.dhcp:~/vmlinuz.david

II Build the initial ramdisk file (initrd)

1) Make the kernel module drivers

sudo make modules

2) Backup your current kernel modules (<current kernel version> is your current kernel e.g. 2.6.10-12

sudo cp -r /usr/modules/<current kernel version> /usr/modules/<current kernel version>.bak

3) Install the module drivers (note this will install all the drivers in the directory /lib/modules/<kernel version> If your current kernel version is the same as the kernel source you are building it will overwrite all your current kernel modules but step 7 would have created a backup - after this process however you will need to restore your original kernel modules using the backup

sudo make modules_install

4) Create the initrd ramdisk image

sudo mkinitrd -o initrd.img-2.6.12 2.6.12

The mkinitrd script does a few default things here. First it looks at /etc/mkinitrd/mkinitrd.conf to see which modules it must include. In the example above it will look in /lib/modules/2.6.12 to find all the modules to build into the initrd.img-2.6.12 file

5) Copy the initrd file to the server

scp initrd.img-2.6.12 djohnson@meshy.dhcp:~

III Setup the server to run the kernel with the initrd file

1) Login to the server containing these files