WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to make a legacy bios/uefi dual boot usb stick with syslinux  (Read 4299 times)

Offline polikuo

  • Sr. Member
  • ****
  • Posts: 366
This tutorial will teach you how to boot tiny core from a usb stick on legacy bios and uefi machines.

Note that It is suggested to use corepure64 as most efi/uefi are 64-bit.

For GRUB2 lovers, see:
http://forum.tinycorelinux.net/index.php/topic,19364.0.html

To create a GPT USB stick, you'll need gdisk.
Code: [Select]
tce-load -wil gdisk
To create a hybrid USB stick, you'll need a EFI System Partition.
The code below format the USB into 3 partitions.
1. M$ data with ntfs (a "share" partition)
2. ESP
3. ext4 TC installation

create partitions with gdisk
Code: [Select]
sudo gdisk /dev/sdb
# main menu
o        # create a new empty GUID partition table (GPT)
n        # add a new partition
# number, size, type = 0700
n        # add a new partition
# number, size, type = ef00
n        # add a new partition
# number, size, type = 8300
# now we'll create a hybrid MBR for legacy BIOS
x        # extra functionality (experts only)
# expert menu
r        # recovery and transformation options
h        # make hybrid MBR
1 2 3    # assign partitions to MBR
# Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N):
n        # we're using syslinux
# follow gdisk instruction to set up MBR hex code and bootable flags
07       # M$
n        # not bootable
EF       # ESP
y        # personally I prefer putting all the files together
83       # Linux filesystem
n        # if you pick the 3rd partition as the bootable partition, use extlinux to install the boot loader
x        # go back to expert menu
# expert menu
a        # set attributes
2        # your legacy bootable partition
2        # boot flag attribute code
w        # write table to disk and exit
formatting
Code: [Select]
tce-load -wil dosfstools
mkfs.vfat /dev/sdb1
mkfs.vfat /dev/sdb2
mkfs.ext4 /dev/sdb3
sudo rebuildfstab
setup syslinux
Code: [Select]
tce-load -wil syslinux mtools glibc_gconv
syslinux -i /dev/sdb2
# Note that extlinux uses path instead of device:
# extlinux -i /mnt/sdXY/path/to/your/boot/directory
mkdir -p /mnt/sdb2/EFI/BOOT
cp /usr/local/share/syslinux/efi*/syslinux.efi /mnt/sdb2/EFI/BOOT/BOOTX64.EFI
# default path for 64-bit syslinux UEFI firmware
# use "BOOTIA32.EFI" for 32-bit UEFI
sudo dd if=/usr/local/share/syslinux/gptmbr.bin of=/dev/sdb bs=440 count=1
cp /usr/local/share/syslinux/efi*/ldlinux.e64 /mnt/sdb2/EFI/BOOT
cp /usr/local/share/syslinux/efi*/libutil.c32 /mnt/sdb2/EFI/BOOT
cp /usr/local/share/syslinux/efi*/libcom32.c32 /mnt/sdb2/EFI/BOOT
cp /usr/local/share/syslinux/efi*/vesamenu.c32 /mnt/sdb2/EFI/BOOT
cp /usr/local/share/syslinux/libutil.c32 /mnt/sdb2
cp /usr/local/share/syslinux/libcom32.c32 /mnt/sdb2
cp /usr/local/share/syslinux/vesamenu.c32 /mnt/sdb2
cp core.gz vmlinuz /mnt/sdb2/
syslinux.cfg example:
Quote
UI vesamenu.c32
DEFAULT tc

LABEL tc
MENU LABEL Tiny Core
KERNEL /vmlinuz
INITRD /core.gz
APPEND ...
Place the syslinux.cfg file to /mnt/sdb2 AND /mnt/sdb2/EFI/BOOT

ALL done !  :D
Reboot and test.

    [EDIT]: Added missing  cp  comand and changed  sdc  references to  sdb  as requested.  Rich
« Last Edit: January 08, 2019, 05:42:47 AM by Rich »

Offline hamak

  • WikiUser
  • *
  • Posts: 26
Re: How to make a legacy bios/uefi dual boot usb stick with syslinux
« Reply #1 on: January 07, 2019, 12:57:44 PM »
Have anyone got this to work on a UEFI only system?

Offline hamak

  • WikiUser
  • *
  • Posts: 26
Re: How to make a legacy bios/uefi dual boot usb stick with syslinux
« Reply #2 on: January 09, 2019, 05:30:44 AM »
NOW this tutorial works PERFECT!!!
For other users that have Acer Aspire ES11 ES1-132, just change these lines and it will work for you too:

mkdir -p /mnt/sdb2/EFI/Linux
cp /usr/local/share/syslinux/efi*/syslinux.efi /mnt/sdb2/EFI/Linux/BOOTX64.EFI
cp /usr/local/share/syslinux/efi*/ldlinux.e64 /mnt/sdb2/EFI/Linux
cp /usr/local/share/syslinux/efi*/libutil.c32 /mnt/sdb2/EFI/Linux
cp /usr/local/share/syslinux/efi*/libcom32.c32 /mnt/sdb2/EFI/Linux
cp /usr/local/share/syslinux/efi*/vesamenu.c32 /mnt/sdb2/EFI/Linux

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2841
Re: How to make a legacy bios/uefi dual boot usb stick with syslinux
« Reply #3 on: January 09, 2019, 09:37:17 AM »
hamak,

So, this path "/EFI/Linux/BOOTX64.EFI" is unique to your notebook?

I thought you said earlier that "/EFI/BOOT/BOOTX64.EFI" worked too?

Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 6290
Re: How to make a legacy bios/uefi dual boot usb stick with syslinux
« Reply #4 on: January 09, 2019, 09:45:13 AM »
Hi coreplayer2
hamak,

So, this path "/EFI/Linux/BOOTX64.EFI" is unique to your notebook? ...
It seems his Acer laptop has a list of  "acceptable"  paths hardcoded into it it:
http://forum.tinycorelinux.net/index.php/topic,22410.msg140356.html#msg140356

Quote
I thought you said earlier that "/EFI/BOOT/BOOTX64.EFI" worked too?
That worked on a different machine he tried it on:
http://forum.tinycorelinux.net/index.php/topic,22410.msg140424.html#msg140424

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2841
Re: How to make a legacy bios/uefi dual boot usb stick with syslinux
« Reply #5 on: January 09, 2019, 12:19:00 PM »
It seems his Acer laptop has a list of  "acceptable"  paths hardcoded into it it:
http://forum.tinycorelinux.net/index.php/topic,22410.msg140356.html#msg140356
Hello Rich
This is what's troubling me..  In the OP's questions it's never very clear if the list within this notebook's firmware contains both the Standard
"/EFI/BOOT/BOOTX64.EFI", and manufacturer specific
"/EFI/Linux/BOOTX64.EFI"
pathways?


Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 6290
Re: How to make a legacy bios/uefi dual boot usb stick with syslinux
« Reply #6 on: January 09, 2019, 12:46:11 PM »
Hi coreplayer2
The notebook did not contain  /EFI/BOOT/  which was why I suggested he try polikuos tutorial using  /EFI/Linux/  instead.

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2841
Re: How to make a legacy bios/uefi dual boot usb stick with syslinux
« Reply #7 on: January 09, 2019, 01:58:06 PM »
Hi coreplayer2
The notebook did not contain  /EFI/BOOT/  which was why I suggested he try polikuo's tutorial using  /EFI/Linux/  instead.
Ok but I believe that this troubleshooting step occurred earlier and was not confirmed to have fixed the problem.    It was my understanding that this was the cause;
http://forum.tinycorelinux.net/index.php/topic,22410.msg140439.html#msg140439

After this fix was performed the OP reinstalled to /EFI/Linux/ which worked.   Yet it's not clear that /EFI/BOOT/ wouldn't have worked after the fix was applied.

Only reason I'm curious, is because I have a hard time believing a manufacturer would not include the default UEFI path in it's firmware. 

:) 

Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 6290
Re: How to make a legacy bios/uefi dual boot usb stick with syslinux
« Reply #8 on: January 09, 2019, 05:22:09 PM »
Hi coreplayer2
Hi coreplayer2
The notebook did not contain  /EFI/BOOT/  which was why I suggested he try polikuo's tutorial using  /EFI/Linux/  instead.
Ok but I believe that this troubleshooting step occurred earlier and was not confirmed to have fixed the problem. ...
It eventually got him to a grub prompt after some additional prompting by polikuo and yourself.
Quote
It was my understanding that this was the cause;
http://forum.tinycorelinux.net/index.php/topic,22410.msg140439.html#msg140439
That fixed a syslinux problem.

Quote
Only reason I'm curious, is because I have a hard time believing a manufacturer would not include the default UEFI path in it's firmware.
I think you're not giving manufacturers enough credit for thinking they know what you need better than you do. :D Someone
decided paths for Windows, several Linux flavors, and a generic Linux entry were all that was needed.

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2841
Re: How to make a legacy bios/uefi dual boot usb stick with syslinux
« Reply #9 on: January 10, 2019, 07:13:38 PM »
Hi coreplayer2
Quote
Only reason I'm curious, is because I have a hard time believing a manufacturer would not include the default UEFI path in it's firmware.
I think you're not giving manufacturers enough credit for thinking they know what you need better than you do. :D Someone
decided paths for Windows, several Linux flavors, and a generic Linux entry were all that was needed.
Hello Rich,   Yes that's right,  It extremely frustrating when they know better what we want than we do..    :P   It's for this reason I waste time with constant reboot cycles attempting to select my desired OS boot loader and that's ASUS whose engineers I have a lot of respect.   Yet they forgot to include the only boot option that's important, to me; Load the EFI bootloader menu switchable to default, instead the time limited special key usage.
In this case it appears that ACER neglected to conform with the UEFI spec's. to include the default path for removable drives and generic fallback path ( EFI/BOOT/bootx64.efi ).   Maybe they thought it was enough to support Windows and Ubuntu?  maybe this was neglect, or maybe they thought it was a security risk allowing someone to boot their hardware without knowing the super secret path and handshake... 
:P

I quote from https://www.rodsbooks.com/efi-bootloaders/principles.html  which is easier reading than the UEFI specifications
Quote
One other boot loader directory requires mention: EFI/BOOT. This directory holds a boot loader file, bootx64.efi, which serves as the fallback boot loader if none is specified in the firmware's flash storage. The filename varies depending on the architectureā€”the filename is bootia32.efi on IA-32 (x86) computers and bootaa64.efi on ARM64 computers. The vast majority of EFI-based x86-64 computers use 64-bit EFIs and therefore use a bootx64.efi default boot loader file
...
The fallback boot loader mentioned earlier (EFI/BOOT/bootx64.efi, or variants of that, depending on the architecture) is something of a special case. This filename was originally intended for use only on removable media, so that they could be booted to install an OS. (If not for that fixed filename, a factory-fresh computer wouldn't be able to boot anything!) This filename was quickly adopted as a fallback filename for hard disk installations, as well. This way, if a duplicate of the normal boot loader is installed to the fallback filename, the computer will remain bootable if the NVRAM-based boot manager list is damaged.


ref: http://www.uefi.org/specifications v2.7 (Errata A)
/EFI/BOOT/bootx64.efi is listed as the only path for multiple architectures on removable devices In the latest UEFI spec's chapter "13.3.1.3 Directory Structure"
Quote
For removable media devices there must be only one UEFI-compliant system partition, and that partition must contain an UEFI-defined directory in the root directory. The directory will be named EFI. All OS loaders and applications will be stored in a subdirectory below EFI called BOOT. There must only be one executable EFI image for each supported processor architecture in the BOOT directory.


/EFI/Linux/  is not listed as an approved none conflicting path

Just saying,..
:)