Note: This article has been replaced by a newer document at
https://forums.fogproject.org/topic/7727/building-usb-booting-fos-image This newer document doesn't have the details developed in this tutorial. I'm leaving this document in place for historical purposes only. You should follow the instructions in the referenced tutorial to produce a functional FOS boot usb.
I’m documenting this process to help with the target device debugging process (but mainly to see if I could do it). Lately we’ve had many leading edge devices fail to pxe boot into the FOG kernel (at the time of writing this the Surface Pro 4 is being tough to debug. The surface pro 4 boots into the ipxe menu, but as soon as you pick an action it appears to hang). By booting the fog client directly into the debug kernel we can help determine if the issue is ipxe related or fog kernel related.
I have an idea how I can rewrite this for the windows folks, for now this is the linux based instructions
Method #1 (linux path / BIOS boot)
The process steps are not complicated, you will need to acquire these things before you begin
- A 2GB (min) flash drive
- A Linux based computer with internet access (In this case I’ll use a ubuntu laptop)
Steps to create the bootable usb drive drive
- Insert the usb flash drive into your linux computer
- We need to identify which device is the flash drive.
- Open a command shell
- We will use the lsblk command to display the block devices.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 298.1G 0 disk
├─sda1 8:1 0 294.3G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 3.8G 0 part [SWAP]
sdb 8:16 1 15G 0 disk
└─sdb1 8:17 1 15G 0 part /media/jondoe/myflash
From this we can see the flash drive (in my case its a 16GB flash drive) is mounted as /dev/sdb. We must remember this path since we will execute several destructive commands next. You MUST be sure you correctly identify the flash drive. The next step is to delete all partitions on this flash drive. If you get it wrong something important may be lost forever
5) We’ll use fdisk to delete all partitions on the flash drive. In most cases there will be just a single partition on the flash drive. The lsblk command shows us this too. Key in the following command.
fdisk /dev/sdb
6) Key in d
(if fdisk prompts for a partition number enter 1)
7) Key in n
to create a new partition p
for primary 1
for first partition and then enter
twice
Key in p
to print the current partition table. You should get a printout similar to this
Command (m for help): p
Disk /dev/sdb: 16.1 GB, 16131293184 bytes
255 heads, 63 sectors/track, 1961 cylinders, total 31506432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007f93b
Device Boot Start End Blocks Id System
/dev/sdb1 63 31506431 15753184+ 83 Linux
Note its important that the partition ID be 83 Linux. This was selected as the default value when I created this partition.
9) If everything looks good press w
to write the partition table. If fdisk does not exit to the command shell key in q
to quit.
For the rest of this post I’m going to switch to say /dev/sdX to represent the flash drive. I don’t want someone to just blindly copy and paste the commands and wipe out something really important.
10) At this point we have a flash drive that has a linux partition on it. Now we need to format the drive. Key in the following:
sudo mkfs /dev/sdX1
11) Now lets mount it so we can install grub.
sudo mount /dev/sdX1 /mnt
12) Next we’ll tell grub to install its boot loader onto the flash drive. Key the following command in to setup the grub environment on the flash drive:
sudo grub-install --force --no-floppy --boot-directory=/mnt/boot /dev/sdX
13) Next we’ll need to install the FOG boot files on the flash drive. Change into the boot directory that was created by the grub-install command.
cd /mnt/boot
14) Next download the following files from the fog project web site. We’ll use the wget command for this.
sudo wget https://fogproject.org/inits/init.xz
sudo wget https://fogproject.org/inits/init_32.xz
sudo wget https://fogproject.org/kernels/bzImage
sudo wget https://fogproject.org/kernels/bzImage32
15) When all of the image files have been downloaded, we need to tell grub how to use them. For this we need to create the grub configuration file. (note: I’m old school and use the vi editor, you could use any text editor you wish here.)
sudo vi /mnt/boot/grub/grub.cfg
16) Paste in the following section into the grub.cfg file.
set timeout=10
set default=0
menuentry "FOG 32-bit Debug Kernel" {
linux /boot/bzImage32 loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes
initrd /boot/init_32.xz
}
menuentry "FOG 64-bit Debug Kernel" {
linux /boot/bzImage loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes
initrd /boot/init.xz
}
The above text will create two menu items in the grub boot menu. The fist will be the 32 bit FOG client operating environment, the second will be the 64 bit FOG client. The default client is the 32 bit version. You have 10 seconds to select the 64 bit version. I selected the 32 bit version as default because the 32 bit will boot on both IA32 an amd64 processors.
17) Now that everything is in place we need to move out of the USB drive and unmount it.
cd /
18) Then issue the unmount command
sudo umount /mnt
19) Remove the usb drive from the setup computer and insert it into the target computer
20) Power on the target computer and press F10 or F12 (depending on the manufacture) to bring up the boot menu and select the USB drive.
21) The grub menu should show up right away.
22) Select either the 32 bit or 64 bit boot images and press enter.
Note: If you select the 32 bit image, there will be an unsettling pause with a flashing cursor in the upper left corner of the screen, after about 8 seconds you will see the kernel boot. If you pick the 64 bit image, you will see text spew across the screen right away then boot the kernel. The only thing I can think is that the 32 bit image blanks the screen while the inits are loading and the 64 bit version does not.