WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: a rant/discussion about grub bootloaders - MBR and EFI  (Read 9081 times)

aus9

  • Guest
a rant/discussion about grub bootloaders - MBR and EFI
« on: May 28, 2020, 11:05:45 PM »
Hi

I do not wish to pollute some excellent posts
"Howto make a legacy bios/uefi dual boot usb stick with grub2 " by Juanito
http://forum.tinycorelinux.net/index.php/topic,19364.0.html

coreplayer2 observation on how difficult it is to turn off UEFI (and related matters)
http://forum.tinycorelinux.net/index.php?action=post;quote=143186;topic=22848.15;last_msg=146885

coreplayer2 instruction to make EFI bootable USB
http://forum.tinycorelinux.net/index.php?action=post;quote=143377;topic=22848.30;last_msg=146885

out-of-date wiki grub legacy to grub2 (some parts by me)
http://wiki.tinycorelinux.net/doku.php?id=wiki:grub2_from_grub1

an observation that the wiki is incomplete. Some forum posts might be better off being a sticky?

and I saw some recent posts on another bootloader, grub4dos
And that got me thinking....dangerous I know  ;D

While wiki is not edittable...
We may need a grub2 into MBR (bios has no UEFI firmware) as  post by Juanito's post uses efi

We may need a post on grub2 without using UUID. Altho UUID does eliminate issues for removable drives, this does not impact on laptop users....so IMHO keep it simple (stupid)

I am tempted, in the unofficial remaster area....to provide a download image for usb stick of a recent
TC product that might be able to be flashed by a windows 10 user?

Hopefully some nice posters like "you know who" and no pressure....anyone else who cares, might like to add further suggestions or dismiss mine as they see fit.



« Last Edit: October 27, 2022, 11:16:10 PM by Rich »

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: a rant/discussion about grub bootloaders - MBR and EFI
« Reply #1 on: June 26, 2020, 10:19:51 PM »
I've often thought about a remaster for the new kids on the block with modern uefi-only hardware in their households.

How to introduce them to the joys of a very small simple linux, that they can blow away and re-create, and slowly get into the joy of the shell and dd'ing a new stick from that, severing the ties from using another machine over time?

Thought process:

1) Modern kids don't care about iso9660 and burning a read-only stick.  If they want, they get all secure with stuff like that later.

2) Burn TC64 with an ext4 partition, and and efi partition as a distributable iso.  Sure go ahead and use Etcher, Rufus or whatever that will dd to the card anyway. Don't need to make it huge because:

3) Like piCore, after installation one simply expands the ext4 partition.  However, this means that you'll want the efi partition as the first one, and the ext4 as the secondary.

4) Put the iso image inside the image again - this way, young minds can explore the wonders of "dd" instead of using a 3rd party burner on Windows once they get the system booted.

5) Optionally create an old-school ncurses interface to do a dd to the included iso in case they want to burn another, yet are still confused or scared of the cli initially.

It doesn't have to be a full Tinycore either, but just simple core to act as an installer for some, or a total environment for those that dig just the cli.

But I know what you are saying.  There are those like myself who are unix end-users, and not necessarily interested in being admistrators for hardware - although with TC you tend to go into the gray-zone where you pick up these skills at time moves on. :)

KISS: Make it boot uefi-only, put the iso inside the iso, add tools or not to separate the initial bond relying on 3rd party windows burners, since for many, they have no idea on how/where to start, or what information is fresh or stale.

Right - so let's do this tonight shall we?  The devs have given us the tools.  It's up to us.

That's a UNIX book! - cool  -- Garth

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: a rant/discussion about grub bootloaders - MBR and EFI
« Reply #2 on: June 27, 2020, 07:12:46 AM »
Hi, PDP-8!

You're right - nobody wants to read books, even "Into the Core", just a wonderful one. And, again, as the proposed image will be written to the stick, instead of burning CD (or how this sparkling toy is named, I can be mistaken, when they were 2, they took this things from the stack in the father's room corner and throw them into the air, like a frisbee, ooeee!!! ), means there are no reasons to make it read-only. So it must be some image intended for USB-sticks only, right?

Probably, MBR and GPT choices of partition table must be made.

Containing 2 partitions:

1. EFI with grub. Everywhere about 100Mb is recommended, but grub occupies only less than 8M, I don't know, what are the reasons to make it bigger? it's FAT

2. Minimum of distribution files - vmlinuz64,rootfs64.gz,modules64.gz - less than 16M for TC11.1, ext4 without journal

Not less than 24M is the total.

If 1st time loaded with "base" bootcode, /etc/sysconfig/tcedir is pointing to the RAM /tmp/tce and no partitions are mounted. So during first boot fdisk and mkfs can be called (using /opt/bootlocal.sh) to utilize the remaining media space for the 3rd partition, which will contain tce directory for the consequent boots, without the "base".

So, the only customizing of the rootfs for such case is adding to the /etc/bootlocal.sh some checks for te existance of the 3rd partition on the drive, and, if not, calling fdisk and modifying "grub.cfg".

Is this what You are talking about?

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: a rant/discussion about grub bootloaders - MBR and EFI
« Reply #3 on: June 27, 2020, 12:59:54 PM »
my input:
1.I think that (for the spirit of TINY/minimal) is better ext2 instead of ext4 (even without journal). Speed of ext4 vs. ext2 does not matter much, mostly tcz are SMALL and read from USB (fast).
2. also EFI partition (basically FAT 32) can be as small as a "minimum" grub2.  grub2 is complex (near as a mini OS) but most of it for USB is not needed.FAT has a minim size; the number of clusters must be between [4085 65525] to format a valid FAT16 partition. So the partition must be greater enough to store 4085 clusters + metadata information such as FAT tables.
 
Code: [Select]
mkfs.vfat -F32 -s 2 /dev/sda1
$ dd if=/dev/zero of=Fat16.bin bs=$((1024*1024)) count=16
16+0 records in
16+0 records out
16777216 bytes (17 MB) copied, 0.0561285 s, 299 MB/s
3. an "install" (no GUI) can be just an interactive shell script. But if the kids come from MS windows, they will not read the TC book first, so they risk (at the beginning) to destroy their windows anyway, it does not matter how many assumptions you made to protect their HDD. If they start with bad feelings, then most of them will not come back to linux very soon, if ever.

FYI: I build the smallest demo ISO, booting with grub2 in UEFI mode, to prove how small a grub2 +ext2 could be. [452 KB]
Code: [Select]
grub-mkimage -v -d x86_64-efi -O x86_64-efi -o BOOTX64.EFI -p (cd0)/boot/grub part_msdos part_gpt fat iso9660
Then add (in \boot\x86_x64-efi) the files:  boot.mod bufio.mod crypto.mod extcmd.mod gettext.mod normal.mod terminal.mod

Know-how:
UEFI can NOT boot from Floppy, UEFI need a ESP-tag Partition. We build a CD/DVD iso with this floppy inside.
1. Build a floppy with bfi.exe [as 160Kb], It will have only two files.
bfi -v -t=0 -l=UEFI -f=myISO-root\UEFI.FLP .\myFDD

2.Then copy UEFI.FLP to myISO-root\
Add a grub2 configuration as myISO-root\boot\grub\grub.conf
Add (in \boot\x86_x64-efi folders):
 boot.mod bufio.mod crypto.mod extcmd.mod gettext.mod normal.mod terminal.mod

3. Build the ISO with:
mkisofs_3.02a7.exe -z -J -sysid MyOS -appid NONE -no-pad -eltorito-alt-boot -b UEFI.FLP -no-emul-boot -o UEFI.iso myISO-root

4.test ISO with VirtualBox, or qemu 4.2.0 (has UEFI)
F:\MyProgs\App64\Qemu42\qemu-system-x86_64.exe -pflash F:\MyProgs\App64\Qemu42\edk2-x86_64-code.fd -cdrom UEFI.iso

PS: F:\5-Tools\new>bfi.exe
Build Floppy Image v1.0, Oct 2002Copyright (c) 2002 Bart Lagerweij. All rights reserved.
This program is free Software; you can redistribute it under the terms of the NU2 License
Creates a FAT12 floppy image from files.
« Last Edit: June 27, 2020, 01:12:33 PM by nick65go »

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: a rant/discussion about grub bootloaders - MBR and EFI
« Reply #4 on: June 27, 2020, 01:27:40 PM »
Hi, nick65go!

As far as I understood PDP-8's proposal, and what i was writing about, there are no iso9660, no attempts to install something on the HD. Simply live TinyCore USB-stck with persistance on it without any need for other storage devices. Simply ready-to-use playground, just "don't touch anything outside and be happy", until You've learn what You are doing really. Plug-and-play, or so.

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: a rant/discussion about grub bootloaders - MBR and EFI
« Reply #5 on: June 27, 2020, 01:43:43 PM »
My remarks were about
- the EFI partition minimim size (formatted as FAT): why 100 MB minim is not a request,
 - and about the minimum grub2 size on USB:why 8 MB is not necessary.
- and about ext2 vs ext4 test which I read on internet: because we care about READ USB speed, (less write on USB)
PS: maybe I provided too much unsolicited/unrelated info, about how I tested my remarks.
PS2: my approach was about TESTING also this USB in virtual machines, or real UEFI laptops, where secure boot should be disabled (if you can). So maybe a suggestion to add some links/documentation on USB when kids boot the USB. Because by default UEFI for win10 machine is a bad player with linux, by default. YMMV.
« Last Edit: June 27, 2020, 01:55:18 PM by nick65go »

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: a rant/discussion about grub bootloaders - MBR and EFI
« Reply #6 on: June 27, 2020, 02:06:58 PM »
Oh, yes! Documentation! I know one great book ... about ... Ti .... . But they don't read books! 8-(

About exts. Of course there will be no deciding difference between ext2 and ext4 in this context, but ext4 probably will not be worse, than ext2. Ext4 has one feature, missing in ext2, as far as i know - small files data can be located inside their inodes, this saves some space depending on the file sizes distribution.

Sorry, i am not acquainted close with the UEFI secure-boot-permanent machines. So Your approach, using floppy disk images allows to boot from CD the secure-boot-enabled machine? If it is possible, then of course Your approach must be chosen.

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: a rant/discussion about grub bootloaders - MBR and EFI
« Reply #7 on: June 27, 2020, 02:42:01 PM »
- if no documentation is read , maybe just few web-links about this alien USB picked from friend/father's room?
- how many *.dep, *.md5 on USB? so how many KB you gain on your USB using ext4 vs ext2? better squash compression tcz can gain more in this "pseudo" ext# game.
- the bull-sheet "secure-boot" has nothing to do with linux/windows/usb/cdrom. i pointed just that TC is original (not ubuntu/fedora signed kernel/modules) so secure-boot must be disabled. It was not previously mentioned as your concerns for USB.
-if your audience is linux user, you waste your time with this USB. If the persons you want to help are current windows users, then remember that win10 +UEFI is not linux friendly. And if access HDD from USB, because powerful TC tools, win10 can become upset.
So you gave an weapon to a kid and ask him to not kill someone, before he became a pro. Oh, good luck.

My point: tiny/nano/micro? usb size?
 no stuff on USB that is not need for a demo-USB. is not a rescue USB. So define better the project, the audience, the purpose of USB etc.
« Last Edit: June 27, 2020, 02:47:52 PM by nick65go »

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: a rant/discussion about grub bootloaders - MBR and EFI
« Reply #8 on: June 27, 2020, 03:38:12 PM »
Sorry, I don't understand, why USB is wasted time for Linux users. Transfer from Win to Ubuntu is smooth and clean, upon my experience on my friends. Most will be fully satisfied, but those, who will raise the questions, on how all this can work, will be happy for such USB, even GUI-less one. But extensions' collection from TinyCore.iso seems to be optimal for painless step into.

In other words, I vote for the audience, who have experiaence with some shiny desktop Linux, but wants all of the kind, but more, deeper and faster.

Hmm, what about rebuilding busybox without fdisk and mkfs-es? I am not absolutely sure, but grepping /etc/init.d found nothing, and tce-* staff although make no use of this utils. Of course it is the case to try, but seems such TinyCore without fdisk and mkfs have chances to be alive.

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: a rant/discussion about grub bootloaders - MBR and EFI
« Reply #9 on: June 27, 2020, 05:17:16 PM »
Lets state the main thing: I am not against  your project. Basically I am not against any linux project.I expressed my opinion that linux and windows are two different worlds for user brains. Assumption from one world do not apply (in general) to the other one.
I could not convince my partner (for decades years) to use linux, any version. But I converted few friends to use Ubuntu and Tinycore.Maybe I am not a good teacher. I prefer linux, but I am not shy to use any tool to achieve my goals as fast as possible. It is all about cost/results Pareto 20/80. I am focus on efficiency/optimization, no religion fan linux/win. Friend with the evil to cross the bridge. Each for them-self as long as this capitalist chimera will not die soon.


Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: a rant/discussion about grub bootloaders - MBR and EFI
« Reply #10 on: June 28, 2020, 06:20:06 AM »
I'd just say don't lose track of the original target market:

Those coming from Windows, or even a fully fledged Linux desktop who might be attracted to wrenching around with the grub.cfg, kernel options, classic *nix configurations etc, but are stymied by using 3rd party usb etchers, or even DD'ing from Ubuntu, and finding the latest 64-bit tc64 iso unbootable and walking away.

Ie, partitioning and formatting the usb stick properly for uefi / uefi-only is a bridge too far, even if they are willing to read Into-The-Core.  It's that first hump they can't get over.

It was the same situation back in the 80's too with Xenix, Microport, PC/ix, Coherent etc etc where trying to dual-boot an existing dos partition was such a pain that they gave up and went straight back to MS-DOS.  They *could* have been the next Unix wizard, but that first hurdle was just too much of a trip-up and left a bad impression.

I think the project is a great idea, just be sure it's simply not a mere technical exercise if there really isn't any audience for it.
That's a UNIX book! - cool  -- Garth

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: a rant/discussion about grub bootloaders - MBR and EFI
« Reply #11 on: June 28, 2020, 07:48:19 AM »
Hi, PDP-8!

or even DD'ing from Ubuntu, and finding the latest 64-bit tc64 iso unbootable and walking away.

Hmm, I must say, that current TinyCorePure64.iso includes grub2 EFI boot partition, isolinux boot set for BIOS boxes, full set of the time-prooved Tiny desktop programs and the boot menu, allowing to choose GUI/CLI. So  if someone's box is unable to load such media, it means that it is secure-boot-positive, and we have no medicine to cure this disease.

@nick65go - You can look at TinyCorePure64.iso, grub2 EFI size is 4M with font and graphics stuff.
« Last Edit: June 28, 2020, 08:00:57 AM by jazzbiker »

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: a rant/discussion about grub bootloaders - MBR and EFI
« Reply #12 on: June 28, 2020, 09:04:10 AM »
@jazzbiker: Thanks, but I have already look into every tc*.iso beginning from year 2009. All my grub1/grub2/extlinux versions to boot from real/virtual from dvd/hdd/usb etc are less than 500 KB ;)
I do not care about fonts and graphics stuff for a tool (grub) which purpose is to be flexible and to teleport me (passing through kernel, xorg) straight into my application (browser, media player etc).
Optimizing a boot-loader for my needs, makes it not so useful for lager audience. Plus I am not committed to maintenance (before my retirement). My contribution was about low-fruits (ideas) how to not add bloated stuff if it is seldom used.
ex: kernel has the modules for partition types, grub just need to load the kernel.
How many USERS use xfs/ext4/etc with TinyCore, and why? if just fast-light read a SDD/USB and RAM is (relative) cheap?How much RAM do you think a UEFI laptop has today/yesterday? My 5 years old laptop (400 GBP) has 8 GB RAM. Today 16GB RAM is default for a (600-800 euros) laptop with 4-8 years life. I could run all from memory, not touching a 500GB-1TB HDD...
PS: do you think that a stranger will ever convince me (without torture, blackmail) to run his USB in my laptop? maybe i will give it a try in a virtual machine.


@PDP-8: you are right. first step is difficult. then someone can "fly" alone with any linux flavor. he just need to not crash/die at the beginning.
« Last Edit: June 28, 2020, 09:14:31 AM by nick65go »

Offline xor

  • Hero Member
  • *****
  • Posts: 1268
Re: a rant/discussion about grub bootloaders - MBR and EFI
« Reply #13 on: June 28, 2020, 09:37:05 AM »
one step after; monopolization effort of big companies
https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface#Criticism

@jazzbiker: Thanks, but I have already look into every tc*.iso beginning from year 2009. All my grub1/grub2/extlinux versions to boot from real/virtual from dvd/hdd/usb etc are less than 500 KB ;)
I do not care about fonts and graphics stuff for a tool (grub) which purpose is to be flexible and to teleport me (passing through kernel, xorg) straight into my application (browser, media player etc).
Optimizing a boot-loader for my needs, makes it not so useful for lager audience. Plus I am not committed to maintenance (before my retirement). My contribution was about low-fruits (ideas) how to not add bloated stuff if it is seldom used.
ex: kernel has the modules for partition types, grub just need to load the kernel.
How many USERS use xfs/ext4/etc with TinyCore, and why? if just fast-light read a SDD/USB and RAM is (relative) cheap?How much RAM do you think a UEFI laptop has today/yesterday? My 5 years old laptop (400 GBP) has 8 GB RAM. Today 16GB RAM is default for a (600-800 euros) laptop with 4-8 years life. I could run all from memory, not touching a 500GB-1TB HDD...
PS: do you think that a stranger will ever convince me (without torture, blackmail) to run his USB in my laptop? maybe i will give it a try in a virtual machine.


@PDP-8: you are right. first step is difficult. then someone can "fly" alone with any linux flavor. he just need to not crash/die at the beginning.

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: a rant/discussion about grub bootloaders - MBR and EFI
« Reply #14 on: June 28, 2020, 11:15:31 AM »
@nick65go
Sorry, I didn't have any intentions to disturb You with the suspicions, that You do not know the sizes of grub2 stuff files. Be sure, I will never mention this sizes again.

Let me express one thought, i hope it will not abuse anybody. The times You, guys, are remembering, the wonders and wizards existed on the OS level. But those times are gone away, and, probably will not return as the literal replica. Nowadays, the wonders and the wizards lives not on the application, but even on the network level. Correct me, please, if I am wrong as usual. And what TinyCore can propose as a killer-feature which no other OS can provide, performed on this level, to burn the eyes of potential future wizard? Long ago OS was the bleeding edge, now it is infrastructure. So what can be done, using TinyCore, which nobody can do, in our years of 8G minimum RAM, USB3 and 5G? Hope, You know the answer.