Difference between revisions of "Bering-uClibc 7.x - User Guide - Installing the Disk Image"

From bering-uClibc
Jump to: navigation, search
(accessing your PI)
(accessing your PI)
Line 128: Line 128:
 
You can always add other NICs with a suitable HAT add-on to your PI and use it more like the intended LEAF box router, but remember to restore the <code class="filename">shorewall(s).lrp</code>. The PI's might not be the best routers firewalls, but in these cases and for other networking purposes they become a very robust platform once loaded with LEAF since the code is then executed in rams only and no potentially destructive writes to SD card will ever happen while running.  
 
You can always add other NICs with a suitable HAT add-on to your PI and use it more like the intended LEAF box router, but remember to restore the <code class="filename">shorewall(s).lrp</code>. The PI's might not be the best routers firewalls, but in these cases and for other networking purposes they become a very robust platform once loaded with LEAF since the code is then executed in rams only and no potentially destructive writes to SD card will ever happen while running.  
  
A naked PI Zero can only be access with the serial console, GPIO 14 and 15 and ttl-usb converter, there is no NIC... and the console have to be enabled by adding this file [https://github.com/jeanrocco/LEAF/raw/main/RPI%20Zero/configdb.lrp configdb] to the leaf.cfg list. The PI zero W is an interesting one, as it can be accessed thru WIFI. There is an example of it's use [[Bering-uClibc_7.x_-_User_Guide_-_Advanced_Topics_-_Raspberry_PI_Zero_W_direct_WIFI_logon|here]].
+
A naked PI Zero can only be access with the serial console, GPIO 14 and 15 and ttl-usb converter, there is no NIC... and the console have to be enabled by adding this file [https://github.com/jeanrocco/LEAF/raw/main/RPI%20Zero/configdb.lrp configdb.lrp] to the media files and adding configdb to the leaf.cfg list. The PI zero W is an interesting one, as it can be accessed thru WIFI. There is an example of it's use [[Bering-uClibc_7.x_-_User_Guide_-_Advanced_Topics_-_Raspberry_PI_Zero_W_direct_WIFI_logon|here]].
  
 
===Classical and still working other copy methods===
 
===Classical and still working other copy methods===

Revision as of 00:07, 21 April 2021

Installing the Disk Image
Prev Bering-uClibc 7.x - User Guide Next


Contents

Choosing An Image File to Download

For Bering-uClibc 7.x there are several different disk image files available for download. These offer a choice of tailored variants of the same basic distribution and you should only need to download one of them - the one that best matches your requirements. The different variables are:

  • The Linux kernel optimisations:
    • i486 is the most basic and most widely compatible kernel variant, suitable for Intel 486 CPUs (or better).
    • i686 is a variant which is optimised for Intel Pentium Pro CPUs (or better) and supports multiple CPUs / CPU cores.
    • geode is a variant which is optimised for AMD Geode CPUs such as are used in e.g. the PC Engines ALIX boards.
    • wrap is a variant which is optimised for WRAP boxes based on AMD SC1100 CPU e.g. PC Engines WRAP or Soekris boxes.
    • x86_64 is a variant optimised for 64bit systems.
  • The boot media type:
    • syslinux for flash drive or hard drive devices such as a USB or Compact Flash drive or a standard hard disk.
    • isolinux for CD-ROM devices (optionally in conjunction with a floppy disk for storing configuration changes).
    • pxelinux for PXE network booting.
  • The console type:
    • vga for a standard VGA console.
    • ser for an RS-232 Serial console.
  • The bootable images for USB:
    • x86_64_ser.img
    • x86_64_vga.img
    • i486_ser.img
    • i486_vga.img

If your hardware allows booting from USB, as most modern systems do, we suggest to download and install one of the .img files to a USB key using dd on Linux or the Raspberry PI Imager on Windows and Macs.

If no USB boot is possible, and if in doubt, then start with the first (most standard) option in each case - in other words the combination i486_syslinux_vga.

A special case: the Raspberry Pi(s)

There are also tarballs and bootable .img files available for the family of Raspberry PIs, which are the Zero and 1,2,3, and 4. Installing these is a lot simpler than for other architectures/platforms like Intels or AMDs, ... which usually require preparing the boot media with a boot sector and some form of boot loader like syslinux. All PIs, in their native configuration, will boot from an SD card... if you want to know why, look here. For LEAF, it is then sufficient to simply extract/decompress/unzip the corresponding PIs's tarballs to a FAT32 formatted single partition SD card, nothing else. The bootable .img files should also simply be copied with dd or Raspberry PI Imager to an SD card.

Download Location

Image file(s) should be downloaded from the LEAF files area on SourceForge: http://sourceforge.net/projects/leaf/files/

For the quickest installation, look for the USB image files.

For the most standard Image variant, look for a file named like Bering-uClibc_7.x.x_i486_isolinux_vga.tar.gz (ISO image to boot from CD-ROM) or Bering-uClibc_7.x.x_i486_syslinux_vga.tar.gz (Image to boot from USB-/Flash-/HD-drives).

It is advised to choose the latest available Bering-uClibc_7.x version.

Copying to the Installation Media

Simple copy for USB booting

The USB Images are delivered as .img files which must be copied to a USB key media using 'dd' on Linux or the 'Raspberry Pi Imager' on Windows and Macs. If using a PI .img file follow the same procedure but substitute USB with SD.

These images contain a small system that is guaranty to boot from USB. This system is built with the minimum number of pre-configured packages to make it work as a modem cable firewall. The goal here is to simplify the installation as much as possible mostly for new users but also for seasoned users who might not be fully aware of recent changes. It can then be used to learn how LEAF works and eventually be used to build a more suitable/customized system by adding or removing specifics packages. To help the user even more, a built-in specialized script 'leafinstall' will allow the generation of a modern LEAF installation on popular medias like SD cards or USB keys. (check for hard disks on PCs or SSD on APU2s...)

  • On Linux:
  1. Download the image file, for instance Bering-uClibc_x86_ser.img
  2. insert your USB key and check with 'dmesg' which device it is assigned to; like '/dev/sdb'
    cd ~/Downloads
    dd if=Bering-uClibc_x86_ser.img of=/dev/sdb bs=1M
  • On Windows or Macs
  1. Download the 'Raspberry Pi Imager'
  2. Download the image file, again something like Bering-uClibc_x86_ser.img
  3. Insert you USB key and start 'Raspberry Pi Imager'
    Click CHOOSE OS > Use custom > find /Downloads/Bering-uClibc_x86_ser.img > Open
    Click CHOOSE SD CARD > SanDisk Cruze U Media - 15.6 GB > WRITE

  • Remove the flash media from the PC and proceed to the next Chapter.

Raspberry PIs installation of tarballs images

partition and format your SD card

We assume the PI will use an SD card for LEAF. As we said before the PI becomes very reliable running LEAF so there is no appreciable gain to use a so called "more reliable" USB key.

On an external PC running Linux, insert your SD card, and run:

dmesg 
or
sudo fdisk -l

to see which device it is assigned to (let's assume we get /dev/sdb)...

Start the fdisk utility to partition your SD card.

sudo fdisk /dev/sdb

The safest approach is to delete any existing partition. To delete a partition type "d", to create a new partition type "n", choose "p" for a new primary partition, "1" for the partition number, accept the default values for First and Last Sector. To change the partition system id to W95 FAT32, choose "t" and "b".

You may have a look before writing the changes to your SD with the command "p". It should show something like this:

Device      Boot      Start         End           Blocks      Id         System
/dev/sdb1             2048        524287         261120        b         W95 FAT32

Save your changes with the command "w".

Format the SD card:

sudo mkfs.vfat -r 1024 /dev/sdb1

Mount the SD card:

sudo mount /dev/sdb1 /mnt
cd /mnt

Extract your tarball: extract the contents of your PI(n) downloaded file with a command like the following

sudo tar -xvzf ~/Download/Bering-uClibc/7.0.1/Bering-uClibc_7.0.1_raspberry-rpi3.tar.gz

Note that this assumes the downloaded file is located in your $HOME/Download directory.

Leave the SD card mounted for the next step ...

prepare your Raspberry PI

You could have a look here at how LEAF now allows a secure web browser access on eth1 on platforms that have more than one NIC. The PIs (1,2,3,and 4), on the other hand, all have a single NIC, which will default to eth0, on LEAF. To facilitate and enjoy the same kind of access for your PI, when connected on your local network, you should first temporarily remove the shorewall(s).lrp package from the variable leaf.lrp:

while still in the /mnt directory, from the previous step, edit the leaf.cfg file with

sudo nano leaf.cfg

find the line

LRP="license root nano dhcpcd keyboard shorwall dnsmasq dropbear lighttpd webconf patch"

and remove the shorwall entry ... save and exit nano, run sync and un-mount the SD card.

accessing your PI

Now insert the SD card in your PI, connect it to your local network, and power it up. Count to 100 :-)..., your local network DHCP server should assign an IP address to your PI. You can then access the PI from a web browser running on your external PC at http://dhcp.assigned.addr with admin:admin. To find out use fing on Android or look in /var/lib/misc/dnsmasq.leases if you're already running a LEAF firewall local net.

You can always add other NICs with a suitable HAT add-on to your PI and use it more like the intended LEAF box router, but remember to restore the shorewall(s).lrp. The PI's might not be the best routers firewalls, but in these cases and for other networking purposes they become a very robust platform once loaded with LEAF since the code is then executed in rams only and no potentially destructive writes to SD card will ever happen while running.

A naked PI Zero can only be access with the serial console, GPIO 14 and 15 and ttl-usb converter, there is no NIC... and the console have to be enabled by adding this file configdb.lrp to the media files and adding configdb to the leaf.cfg list. The PI zero W is an interesting one, as it can be accessed thru WIFI. There is an example of it's use here.

Classical and still working other copy methods

This is the way LEAF was installed before we introduced the more modern USB booting. These methods of installation are still working fine and are to be considered the reference if you ever encounter problems. The latest default LEAF configuration allows a web browser access to eth1 at https://192.168.1.254 with user name: admin and password: admin . It's all explained here.

Copying an isolinux Image to CD-ROM

The CD-ROM Images (boot media type isolinux) are delivered as .iso files which must be copied to CD-ROM media using an optical media "burning" program. Alternatively and especially for testing purposes, a Virtual PC solution (such as qemu or Virtualbox) can boot directly from a .iso file.

The structure of the files and directories within the ISO image is as follows:

firmware.tgz
isolinux/
  boot.cat
  isolinux.bin
  isolinux.cfg
  isolinux.dpy
  linux
leaf.cfg
modules.sqfs
readme
*.lrp
*.lwp

Install from CD-ROM to hard disk

Once you have created an ISO image file as shown above, you'll be able to boot from the ISO image. By default the Package hdsupp.lrp will be installed with all programs in place to format your already partitioned hard disk, install a bootloader and copy all files from the ISO image to the hard disk. It also makes the necessary changes to syslinux.cfg and leaf.cfg. The remaining step before reboot is eventually to toogle the bootable flag for your hard disk partition.

We assume in the following steps, that your hard disk is known as /dev/sda and you need only one partition.

Step 1: Partition your hard disk

Start the fdisk utility to partition your hard disk.

fdisk /dev/sda

To create a new partition type "n", choose "p" for a new primary partition, "1" for the partition number, accept the default values for First and Last Sector. To change the partition system id to W95 FAT32, choose "t" and "b".

You may have a look before writing the changes to your hard disk with the command "p". It should show something like this:

Device      Boot      Start         End           Blocks      Id         System
/dev/sda1             2048        524287         261120        b         W95 FAT32

Save your changes with the command "w".

Step 2: Install to hard disk

To run the installation from CD ROM to hard disk, start the LEAF configuration menu with "lrcfg". Choose "i) Install to FAT partition". It will show the available FAT partitions:

Available partitions to install LEAF:
1) /dev/sda1 - 261120 kB W95 FAT32
Select partition:

Type "1" to select your partition /dev/sda1 as installation target.

Syslinux will be installed to /dev/sda1, MBR code on /dev/sda1 will be updated.
Are you shure? (y/N)

Type "y", if you are shure and want to continue.

Format /dev/sda1? (y/N)?

Again type "y", if you are shure and want to continue. Your storage device will now be formatted.

Copy all files to storage? (y/N)?

Usually you will and respond with "y". Wait until you are requested to press any key to return.

Step 3: Toogle the bootable flag for your partition.

Last step is to toggle the bootable flag for the partition /dev/sda1. Again run fdisk.

fdisk /dev/sda

Print your partition table to screen with the command "p". It should look like this:

Device      Boot      Start         End           Blocks      Id         System
/dev/sda1    *        2048        524287         261120        b         W95 FAT32

If the asterisk is missing below the Boot row, type "a" and "1" to make the first partition bootable, and save your changes with the command "w". Otherwise leave the fdisk utility with "q".

Reboot, but be shure, that you have removed the CD from the drive before it the boot process starts.

Copying a syslinux Image to Flash Media via a USB Interface on a Linux PC

The Images suitable for flash media (boot media type syslinux) are delivered as .tar.gz files which must be extracted onto suitably prepared flash media. The generic term "flash media" includes Compact Flash cards and USB "pen" or "thumb" drives.

The structure of the files and directories within the .tar.gz file is as follows:

firmware.tgz
leaf.cfg
modules.sqfs
readme
syslinux/
  syslinux.cfg
  syslinux.dpy
  linux
*.lrp
*.lwp

The following assumes that the flash media has been physically removed from the system which will be running Bering-uClibc 7.x and can be accessed on another Linux system using a USB interface such as a Compact Flash-to-USB adaptor.

Preparing the Flash Media

For a standard Bering-uClibc 7.x installation, the flash media must:

  • Be at least 100MB in size for a full installation.
    • By removing some of the large Packages this can be reduced significantly. 8MB is probably the absolute bare minimum.
  • Have a single disk partition, which is flagged as bootable.
  • Have a FAT32 file system on the boot partition. It is advised to format the disk with "-r 1024" to have enough root directory entries to install the Packages.
mkfs.vfat -r 1024 /dev/sdaX

Next you need to install the [http://syslinux.zytor.com/wiki/index.php/SYSLINUX SYSLINUX onto the boot partition. Open a command prompt and cd to your 'syslinux/linux' folder. Run:

./syslinux -i /dev/sdX1

replacing X with the device node of your media.

Install the MBR code on the flash media:

dd bs=440 count=1 if=/usr/share/syslinux/mbr.bin of=/dev/sdX

once again replace X with the device node of your media. This will write the Syslinux mbr code (mbr.bin) into the master boot record of the drive.

Installing SYSLINUX results in file ldlinux.sys being created in the root of the FAT32 file system. Do not attempt to edit or move this file since that will break the SYSLINUX operation.

For Bering-uClibc 5.x the Linux kernel and the SYSLINUX configuration files have been relocated to the syslinux/ directory of the boot disk. However, file ldlinux.sys should remain in the root directory (although by using the -d directory argument to syslinux this can be moved to a different pre-existing directory on the boot disk, if desired).

If the other requirements (i.e. the single, bootable, FAT32-formatted disk partition) are not met you will also need to use:

  • fdisk or parted to partition the drive.
  • mkfs.vfat to create the FAT32 file system.
Extracting the Image Files

Once the flash media is prepared the contents of the disk Image need to be extracted. Change to the directory where the flash media is mounted and extract the contents of the downloaded file with a command like the following

tar -xvzf ~/Download/Bering-uClibc_7.0.0_i486_syslinux_vga.tar.gz

Note that this assumes the downloaded file is located in your $HOME/Download directory.

Do these extra steps if you are using the *_syslinux_vga.* images

Because all *.c32 files shall match the same syslinux version, and if you don't know which syslinux version was used to generate the distribution c32 files, copy hdt.c32, menu.c32, vesamenu.c32, libcom32.c32 and libutil.c32 files from the SYSLINUX program you used to create ldlinux.sys to ./syslinux directory of your mounted flash media.

For instance, in SYSLINUX 6.03 these files are in syslinux-6.03/bios/com32/hdt/hdt.c32, syslinux-6.03/bios/com32/menu/menu.c32, and syslinux-6.03/bios/com32/menu/vesamenu.c32.

They can also be found in /usr/lib/syslinux/modules/bios on Debian Jessie.

An easy way to find these files is to:

cd ~/Download/syslinux-6.03
find . | grep filename.c32


Note: You don't have to do anything if you are using the *_syslinux_serial.* images since they do not use these *.c32 files, so there will be no version conflicts.


Remove the flash media from the Linux PC and proceed to the next Chapter.

Creating a multi-boot image with syslinux bootloader

Note1: This has only been tested with syslinux version 6.03, therefore LEAF Bering-uClibc 6.1.3 or later is required

Note2: This whole procedure of creating a multiboot setup can be done automagically by running the script "leafinstall" on a working LEAF Bering-uClibc 6.1.3 or later system. This section is left here anyway as a reference.

This section describes how to create a multiboot setup with Syslinux bootloader. That way you can either have two partitions with the same setup to always have a working setup when updating the router with a new version or to have different setups side-by-side.

LEAF multiboot.png

It is assumed that you use an ISO Image (/dev/sr0) to start with, but it will also be possible to install from an USB stick (e.g. /dev/sdb), on the condition that you install the Package hdsupp.lrp, which contains essential utilities like fdisk, syslinux, etc ... The recipe is given for a graphical display, changes needed if the LEAF router only has a serial console read the section 3.3.7 "Syslinux setup for a serial console".

The disk layout will be:

/dev/sda1 - the boot partition, formatted with vfat
/dev/sda2 - the first partition with LEAF formatted with ext4
/dev/sda3 - the second partition with LEAF formatted with ext4

You need to have a syslinux bootloader on all partitions and chainload from /dev/sda1. This is a restriction by Syslinux not being able to load a kernel and initrd from another partition without chainloading.

Create, format the partitions and make /dev/sda1 bootable

We will create a boot partition on /dev/sda with 4MB of size, the two data partitions /dev/sda2 and /dev/sda3 with 200MB each.

To create the partitions run

# fdisk /dev/sda
Command (m for help): n
Select (default p): p
Partition number (1-4, default 1): 1
First sector [...]: ENTER
Last sector (...): +4M

Repeat for /dev/sda2 and /dev/sda3 but change the partition number and choose +200M instead of +4M.

Make the first partition /dev/sda1 bootable

 Command (m for help): a
 Partition number (1-3, default 3): 1

With the command p (print) you can see if everything is as expected. There should be three partitions of type "Linux", where the first is marked bootable with an asterisk.

Save your changes with w.

Format the partitions

The first (boot) partition will be formatted with vfat; the remaining data partitions with ext4. Currently extlinux does not support 64bit ext4, therefor we need to be careful with format command and disable the 64bit feature. To manually disable the "64bit" feature when creating ext4 volumes, use -O ^64bit in the mke2fs (or equivalent) command. That is, an hyphen, immediately followed by an upper-case letter "O", a space character, the caret "^" symbol, followed by "64bit" (no hyphen).

# mkfs.vfat /dev/sda1
# mkfs.ext4 -O ^64bit /dev/sda2
# mkfs.ext4 -O ^64bit /dev/sda3
Mount the data source

Before moving on you may create for your convenience a second mount point to mount the data source (here the ISO image /dev/sr0) until the following tasks are finished.

# mkdir /cdrom
# mount /dev/sr0 /cdrom
Install syslinux to the boot partition install the Master Boot Record mbr and create a boot menu

To install syslinux to /dev/sda1 mount /dev/sda1 to /mnt and create the syslinux directory:

# mount /dev/sda1 /mnt
# mkdir /mnt/syslinux

Unmount /dev/sda1 and install syslinux:

# umount /mnt
# syslinux -i /dev/sda1 -d syslinux

Next we install the Master Boot Record mbr to /dev/sda:

# dd bs=440 count=1 if=/usr/share/syslinux/mbr.bin of=/dev/sda

Finally the boot menu will be created. Again mount /dev/sda1 to /mnt and copy the necessary files from the data source mounted on /dev/cdrom. In case you use a USB stick instead of the ISO image the source will be syslinux instead isolinux

# mount /dev/sda1 /mnt
# cp /cdrom/isolinux/*.c32 /mnt/syslinux
# cp /cdrom/isolinux/leaf.jpg /mnt/syslinux
# cp /cdrom/isolinux/memtest.bin /mnt/syslinux

The boot menu will be in /mnt/syslinux/syslinux.cfg and should look like this:

# Wait for 3 seconds before booting up the default entry.
TIMEOUT 30

DEFAULT sda2

UI vesamenu.c32
MENU RESOLUTION 640 480
MENU BACKGROUND leaf.jpg

MENU HIDDEN

MENU COLOR sel 7;37;40    #ff000000 #20ff8000 all
MENU COLOR border 30;44 #00000000 #00000000 none

MENU COLOR tabmsg 31;40 #ff0000ff #00000000 none
MENU COLOR cmdmark 31;40 #ff0f0f0f #00000000 none
MENU COLOR cmdline 31;40 #ff0f0f0f #00000000 none
MENU COLOR timeout_msg 31;40 #ff0f0f0f #00000000 none
MENU COLOR timeout 31;40 #ff0000ff #00000000 none

#MENU AUTOBOOT Bering-uClibc {VERSION} Automatic boot in # second{,s}...

MENU TABMSGROW 21
MENU CMDLINEROW 21
MENU TIMEOUTROW 28
MENU HIDDENROW -1

MENU BEGIN 
LABEL sda2 
  MENU LABEL Boot LEAF Bering-uClibc from /dev/sda2
  com32 chain.c32
  append hd0 2
  
LABEL sda3
  MENU LABEL Boot LEAF Bering-uClibc from /dev/sda2
  com32 chain.c32
  append hd0 3

LABEL Hardware Test
  MENU LABEL Hardware Test
  MENU CLEAR
  KERNEL hdt.c32

LABEL memtest
 linux memtest.bin
MENU END

The boot menu can be copied from /cdrom/isolinux.cfg renamed to /mnt/syslinux/syslinux.cfg

# cp /cdrom/isolinux/isolinux.cfg /mnt/syslinux/syslinux.cfg

and edited accordingly.

Unmount /dev/sda1.

Install syslinux/extlinux to /dev/sda2 and /dev/sda3

Now it's time to make /dev/sda2 and /dev/sda3 bootable for the chainloading. Therefor the bootloader needs to be installed to the mounted partitions into /syslinux and a configuration file /syslinux/syslinux.cfg needs to be provided.

For /dev/sda2 we run:

# mount -t ext4 /dev/sda2 /mnt
# mkdir /mnt/syslinux
# extlinux -i /mnt/syslinux

Create syslinux.cfg in /mnt/syslinux with the content:

DEFAULT sda2
label sda2
kernel /linux
APPEND initrd=/initrd.lrp rw root=/dev/ram0 LEAFCFG=/dev/sda2:ext4 PKGPATH=/dev/sda2:ext4 reboot=bios usb_wait=3 intel_idle.max_cstate=0 processor.max_cstate=1 VERBOSE=1 quiet

Unmount /mnt.

Repeat this step for /dev/sda3 and replace every occurence of "sda2" with "sda3".

Install LEAF to the partitions

Mount /dev/sda2 to /mnt, copy the files from data source and disable PKGPATH in leaf.cfg.

# mount -t ext4 /dev/sda2 /mnt
# cp /cdrom/* /mnt

The PKGPATH in /mnt/leaf.cfg needs to be commented and changed to

#PKGPATH=[.../dev/sda1:vfat,...]

Important is the # sign to comment the PKGPATH, which is sourced in syslinux.cfg

Unmount /mnt and repeat this step for /dev/sda3.

Unmount /cdrom and reboot. If everything went well, you'll be able to boot from /dev/sda1 and then to either boot /dev/sda2 or /dev/sda3.

Syslinux setup for a serial console

If the LEAF router has no graphical display but serial line access, setting up is similar as described above. The relevant changes are the files necessary to get the output on the serial line. The relevant changes are the files needed for the Syslinux bootloader and the menu.

LEAF multiboot serial.png

Install syslinux to the boot partition install the Master Boot Record mbr and create a boot menu

To install syslinux to /dev/sda1 mount /dev/sda1 to /mnt and create the syslinux directory:

# mount /dev/sda1 /mnt
# mkdir /mnt/syslinux

Unmount /dev/sda1 and install syslinux:

# umount /mnt
# syslinux -i /dev/sda1 -d syslinux

Next we install the Master Boot Record mbr to /dev/sda:

# dd bs=440 count=1 if=/usr/share/syslinux/mbr.bin of=/dev/sda

Finally the boot menu will be created. Again mount /dev/sda1 to /mnt and copy the necessary files from the data source mounted (usually /dev/sdb, we assume it is mounted on /mnt2, which needs to be created first). The source files will be in /mnt2/syslinux.

# mkdir /mnt2
# mount /dev/sdb1 /mnt2
# mount /dev/sda1 /mnt
# cp /mnt2/syslinux/chain.c32 /mnt/syslinux
# cp /mnt2/syslinux/libcom32.c32 /mnt/syslinux
# cp /mnt2/syslinux/libutil.c32 /mnt/syslinux
# cp /mnt2/syslinux/menu.c32 /mnt/syslinux
# cp /mnt2/syslinux/vesamenu.c32 /mnt/syslinux

The boot menu (TIMEOUT set to 20 sec) will be in /mnt/syslinux/syslinux.cfg and should look like this:

SERIAL 0 115200
DEFAULT sda2
TIMEOUT 200

UI vesamenu.c32
MENU BEGIN

MENU TITLE LEAF Bering-uClibc Boot Menu

label sda2
MENU LABEL Boot Default [sda2]
com32 chain.c32
append hd0 2

label sda3
MENU LABEL Boot Backup [sda3]
com32 chain.c32
append hd0 3
MENU END

Unmount /dev/sda1.

Install syslinux/extlinux to /dev/sda2 and /dev/sda3

Now it's time to make /dev/sda2 and /dev/sda3 bootable for the chainloading. Therefor the bootloader needs to be installed to the mounted partitions into /syslinux and a configuration file /syslinux/syslinux.cfg needs to be provided.

For /dev/sda2 we run:

# mount -t ext4 /dev/sda2 /mnt
# mkdir /mnt/syslinux
# extlinux -i /mnt/syslinux

Create syslinux.cfg in /mnt/syslinux with the content:

SERIAL 0 115200
DEFAULT sda2

label sda2
kernel /linux
APPEND initrd=/initrd.lrp rw root=/dev/ram0 LEAFCFG=/dev/sda2:ext4 PKGPATH=/dev/sda2:ext4 console=ttyS0,115200n8 reboot=bios usb_wait=3 intel_idle.max_cstate=0 processor.max_cstate=1 VERBOSE=1 quiet

Unmount /mnt.

Repeat this step for /dev/sda3 and replace every occurence of "sda2" with "sda3".

Copying a pxelinux Image to a Network Boot Server

Note: pxelinux boot support is currently under development and is not yet available in the standard Bering-uClibc 7.x downloads.

Much of the complexity of a pxelinux installation is associated with setup of the DHCP server that delivers the PXE boot filename, the TFTP server that delivers the initial boot image etc. These are not specific to Bering-uClibc 7.x and so are not covered in detail here but some guidelines and pointers to other sources of information can be found in the Network Booting Appendix.

The Images suitable for network booting (boot media type pxelinux) are delivered as .tar.gz files which must be extracted onto suitable file server(s).

The structure of the files and directories within the .tar.gz file is as follows:

tftpboot/
  bering-uclibc/
    5/
      gpxelinux.0
      pxelinux.0
      pxelinux.cfg/
        default
      pxelinux.dpy
fileserver/
  bering-uclibc/
    5/
      pxelinux/
          initrd.lrp
          linux
      firmware.tgz
      leaf.cfg
      modules.tgz
      readme
      *.lrp
      *.lwp
File Server Protocol Selection

Bering-uClibc 7.x supports a number of different file sharing protocol options for network boot and installation (or at least it is planned to). These are:

FTP 
File Transfer Protocol, on TCP port 21
TFTP 
Trivial File Transfer Protocol, on UDP port 69
  • Note that a TFTP server is essential for delivering the initial boot image, (g)pxelinux.0, and its configuration file.
  • The same TFTP server can also be used for delivering the Linux kernel file (linux) and the initial RAM disk file (initrd.lrp).
HTTP 
HyperText Transport Protocol, on TCP port 80
SSH 
Secure SHell, on TCP port 22
  • Note that this is not supported by (g)pxelinux.0 for delivering the Linux kernel file (linux) and the initial RAM disk files (initrd.lrp nd initmod.lrp) and hence cannot be used as the only network boot protocol.

For the purposes of this document it is assumed that TFTP will be used only to deliver (g)pxelinux.0 and pxelinux.cfg/default and that an HTTP server will be used to deliver the remainder of the files.

DHCP Server Configuration

It is assumed that you know how to configure your DHCP server for PXE booting. See the Network Booting Appendix for some Hints and Tips.

In summary, the DHCP server needs to:

  • Issue an IPv4 address to the Bering-uClibc 7.x machine.
  • Specify the "next server" IP address and a PXE "boot filename". Based on the structure within the pxelinux .tar.gz file this "boot filename" probably needs to be specified as: bering-uclibc/5/gpxelinux.0 since it is normally relative to the tftpboot/ level of the directory structure.



Prev Up Next