WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Boot with both legacy and UEFI  (Read 17012 times)

Offline Rabie

  • Sr. Member
  • ****
  • Posts: 272
Boot with both legacy and UEFI
« on: January 25, 2022, 03:05:47 PM »
Hi There,

is there a way to make TinyCore boots from a boot media with both legacy and UEFI if the PC doesn't support legacy boot?

i am using TinyCore x64 with the bootloader extlinux.

Thank you

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Boot with both legacy and UEFI
« Reply #1 on: January 25, 2022, 05:05:06 PM »
Hi Rabie
I kind of sounds like you answered your own question.

Regardless of what you do to the boot media, how could you expect to boot it legacy mode if the hardware
does not support legacy mode?

Offline Rabie

  • Sr. Member
  • ****
  • Posts: 272
Re: Boot with both legacy and UEFI
« Reply #2 on: January 26, 2022, 01:58:41 AM »
Hi Rich,

i may have asked the question wrong.

Quote
how could you expect to boot it legacy mode if the hardware
does not support legacy mode?

it has to boot with UEFI if the PC doesn't support legacy! Not with legacy if its not supported  ;D


Offline mocore

  • Hero Member
  • *****
  • Posts: 641
  • ~.~
Re: Boot with both legacy and UEFI
« Reply #3 on: January 27, 2022, 08:04:52 AM »

it has to boot with UEFI if the PC doesn't support legacy! Not with legacy if its not supported  ;D

AFAIK usually this choice of which to prioritise  is handled by the system bios.

wrt how to setup a hdd/usb ect  see

http://forum.tinycorelinux.net/index.php?topic=20939.0 - How to make a legacy bios/uefi dual boot usb stick with syslinux

http://forum.tinycorelinux.net/index.php/topic,19364.0.html -  Howto make a legacy bios/uefi dual boot usb stick with grub2 


Offline Rabie

  • Sr. Member
  • ****
  • Posts: 272
Re: Boot with both legacy and UEFI
« Reply #4 on: January 27, 2022, 09:35:46 AM »
hi mocore,

Quote
http://forum.tinycorelinux.net/index.php?topic=20939.0 - How to make a legacy bios/uefi dual boot usb stick with syslinux

yes i already found this topic but i couldn't really follow the instructions.

is Syslinux the same as extlinux ?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Boot with both legacy and UEFI
« Reply #5 on: January 27, 2022, 10:10:19 AM »
Hi Rabie
... is Syslinux the same as extlinux ?
Syslinux and extlinux are both found in the  syslinux.tcz  extension.

From the  .info  file:
Quote
----- Snip -----
                bootloaders for MS-DOS FAT filesystems (SYSLINUX),
                network booting (PXELINUX),
                bootable "El Torito" CD-ROMs (ISOLINUX), and
                Linux ext2/ext3/ext4 or btrfs filesystems (EXTLINUX).
 ----- Snip -----
Found here:
http://tinycorelinux.net/12.x/x86/tcz/syslinux.tcz.info

Offline Rabie

  • Sr. Member
  • ****
  • Posts: 272
Re: Boot with both legacy and UEFI
« Reply #6 on: January 27, 2022, 03:04:59 PM »
Hi Rich,

Quote
Syslinux and extlinux are both found in the  syslinux.tcz  extension.

i see.

I have installed TinyCore on a USB media and can boot with it but only with legacy.

It would be nice, if you told me step by step how do i make the same USB media boot on a UEFI system.

You already helped me so much before.

Thnx

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Boot with both legacy and UEFI
« Reply #7 on: January 27, 2022, 08:46:16 PM »
Hi Rabie
I've only had to deal with  UEFI  once, and this was the writeup I followed:
http://forum.tinycorelinux.net/index.php/topic,22848.msg143377.html#msg143377

Offline polikuo

  • Hero Member
  • *****
  • Posts: 723
Re: Boot with both legacy and UEFI
« Reply #8 on: January 27, 2022, 09:27:06 PM »
is Syslinux the same as extlinux ?
They are the same family, just different design for different file system.
If your boot media is FAT(32) use syslinux
If it is EXT2(,3,4) use extlinux

It would be nice, if you told me step by step how do i make the same USB media boot on a UEFI system.
Which part do you have trouble with ?

Offline Rabie

  • Sr. Member
  • ****
  • Posts: 272
Re: Boot with both legacy and UEFI
« Reply #9 on: January 31, 2022, 08:49:00 AM »
Hi polikuo,

first i have an understanding question.
when i try to make the USB-Stick bootable with both legacy and UEFI, should i follow the instruction on an new attached USB-Stick or on the same boot Stick i use ?

when i try to do your instruction from: http://forum.tinycorelinux.net/index.php/topic,20939.0.html

i get like 9 Partitions
Code: [Select]
sudo gdisk /dev/sdb
sdb   sdb1  sdb2  sdb3  sdb4  sdb5  sdb6  sdb7  sdb8  sdb9

i continue anyway with:
Code: [Select]
sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.4

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************


Warning! Secondary partition table overlaps the last partition by
33 blocks!
You will need to delete this partition or resize it in another utility.



but that seems to be wrong in my case, cause all sdb* Partitions are mounted and in the next step you say:

Quote
formatting

tce-load -wil dosfstools
mkfs.vfat /dev/sdb1
mkfs.vfat /dev/sdb2
mkfs.ext4 /dev/sdb3
sudo rebuildfstab

« Last Edit: January 31, 2022, 08:51:37 AM by Rabie »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Boot with both legacy and UEFI
« Reply #10 on: January 31, 2022, 09:03:53 AM »
Hi Rabie
... when i try to make the USB-Stick bootable with both legacy and UEFI, should i follow the instruction on an new attached USB-Stick or on the same boot Stick i use ? ...
The instructions are for a stick which is not mounted and the contents will be destroyed.


Offline Rabie

  • Sr. Member
  • ****
  • Posts: 272
Re: Boot with both legacy and UEFI
« Reply #11 on: January 31, 2022, 10:22:17 AM »
Quote
Which part do you have trouble with ?
i don't get this part

Quote
# 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

i was asked from gdisk to create entry for GTP:

Code: [Select]
Creating entry for GPT partition #1 (MBR partition #1)
Enter an MBR hex code (default 07):
Set the bootable flag? (Y/N): n

Creating entry for GPT partition #2 (MBR partition #2)
Enter an MBR hex code (default 83):
Set the bootable flag? (Y/N): n

GPT partition #3 does not exist or is too big; skipping.
« Last Edit: January 31, 2022, 10:24:01 AM by Rabie »

Offline polikuo

  • Hero Member
  • *****
  • Posts: 723
Re: Boot with both legacy and UEFI
« Reply #12 on: February 01, 2022, 05:22:39 AM »
Hi Rabie

My tutorial destroys everything on an USB stick

Back in the days, windows only allow a single partition on an USB stick.

If windows finds more, it would read the first partition and pretend that the rest do not exist.

Therefore, I setup a FAT32 partition as the first for file sharing between the systems.

You don't need this if you're not using TC that way.

I put my EFI in the second partition when TC takes the third.

i get like 9 Partitions
Code: [Select]
sudo gdisk /dev/sdb
sdb   sdb1  sdb2  sdb3  sdb4  sdb5  sdb6  sdb7  sdb8  sdb9

i continue anyway with:
Code: [Select]
sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.4

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************


Warning! Secondary partition table overlaps the last partition by
33 blocks!
You will need to delete this partition or resize it in another utility.

This means your disk/USB is not a GPT one.
Converting from MBR to GPT may cause data loss.
It's not a must, but most machine that use UEFI prefer GPT format.

Quote
Which part do you have trouble with ?
i don't get this part
Which part of my tutorial do you have trouble with ?

Offline Rabie

  • Sr. Member
  • ****
  • Posts: 272
Re: Boot with both legacy and UEFI
« Reply #13 on: February 02, 2022, 05:29:34 AM »
Hi polikuo,
so i have done the following Part successfully

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

i have trouble with the following:

Quote
formatting

tce-load -wil dosfstools
mkfs.vfat /dev/sdb1
mkfs.vfat /dev/sdb2
mkfs.ext4 /dev/sdb3
sudo rebuildfstab

in my case is the Device "sdd" but There is no sdd2 and sdd3

Code: [Select]
/dev/sdd*
/dev/sdd   /dev/sdd1

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Boot with both legacy and UEFI
« Reply #14 on: February 02, 2022, 09:34:04 AM »
Hi Rabie
What does this return:
Code: [Select]
fdisk -l /dev/sdd