USB Boot target device into FOG OS Live (FOSL) for debugging
-
Method #3 (linux path / UEFI/BIOS multi-boot)
Warning: I don't have access to a UEFI computer at the time of writing this document. So I can't say for sure if these instructions work correctly for UEFI booting. I know from the drive structure all of the bits are in the right places. But at this time I can't say absolutely it works as intended.
The process steps are not complicated, you will need to acquire these things before you begin
- A 2GB (min) flash drive with msdos partition (if you are using the same flash drive from this thread, just insert it into a windows computer, delete the partition and recreate the partition and format as fat32, we’ll format it again a little bit later in this guide, but its best to have a partition type of msdos/fat32 [required for efi])
- A Linux based computer with internet access
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
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 format the flash drive. If you get it wrong something important may be lost forever
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.
5) Since we identified what device our drive letter is, lets format it to ensure its clean and properly formatted for an efi boot. To format the flash drive key in the following commands
sudo mkfs -t vfat -n GRUB /dev/sdX1
6) Once the formatting has completed we need to mount the flash drive. Key in the following command:
sudo mount /dev/sdX1 /mnt
7) Just to ensure your ubuntu environment has the required grub files (both efi and bios) issue the following command:
sudo apt-get install grub-efi-ia32-bin grub-efi-amd64-bin grub-pc-bin grub2-common
8) Now that the required applications are installed lets get to business. Key in the following command to install the IA32 efi grub files onto the flash drive.
sudo grub-install --removable --no-nvram --no-uefi-secure-boot --efi-directory=/mnt --boot-directory=/mnt/boot --target=i386-efi
9) Key in the following command to install the amd64 efi grub files onto the flash drive.
sudo grub-install --removable --no-nvram --no-uefi-secure-boot --efi-directory=/mnt --boot-directory=/mnt/boot --target=x86_64-efi
10) Key in the following command to install the IA32 BIOS grub files onto the flash drive. NOTE: Don’t forget to correct the /dev/sdX to the proper device name
sudo grub-install --removable --no-floppy --boot-directory=/mnt/boot --target=i386-pc /dev/sdX
11) 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
12) Next download the following files from the fog project web site. We’ll use the wget command for this.Hint: you can copy and paste this entire block into the command shell and it will download the group in order
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
- 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
- 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 and x86_x64 processors.
15) Now that everything is in place we need to move out of the USB drive and unmount it.
cd /
16) Then issue the unmount command
sudo umount /mnt
17) DoneYou should now have a single FOG Debug OS boot drive that boots both in BIOS mode and UEFI mode.
.
.
.
For the copy and pasters among us (like me, here are the instructions in a copy block)lsblk sudo mkfs -t vfat -n GRUB /dev/sdX1 sudo mount /dev/sdX1 /mnt sudo apt-get install grub-efi-ia32-bin grub-efi-amd64-bin grub-pc-bin grub2-common # for rhel based systems "yum install grub2-efi*" should give you the required tools. I can't confirm it at this time. sudo grub-install --removable --no-nvram --no-uefi-secure-boot --efi-directory=/mnt --boot-directory=/mnt/boot --target=i386-efi sudo grub-install --removable --no-nvram --no-uefi-secure-boot --efi-directory=/mnt --boot-directory=/mnt/boot --target=x86_64-efi sudo grub-install --removable --no-floppy --boot-directory=/mnt/boot --target=i386-pc /dev/sdX cd /mnt/boot 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 sudo vi /mnt/boot/grub/grub.cfg #Paste in the following block 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 } # End paste in block cd / sudo umount /mnt
-
blank reponse