puppylinux-woof-CE / woof-CE

woof - the Puppy builder
GNU General Public License v2.0
396 stars 281 forks source link

Using the same menu for syslinux (isolinux) uefi and non-uefi isos #1250

Closed wdlkmpx closed 6 years ago

wdlkmpx commented 6 years ago

woof-code/support/uefi_cd.sh creates a nice isolinux menu which also has the option to specify a boot param with the following syntax:

vmlinuz pfix=... pkeys=... psubdir=... etc...

I didn't know this.

However the help msgs say you should type 'puppy args'. someone might want to write about that boot menu and how to use it.

It doesn't use gif images, only png images. And netpbm is optional, only one tool is used.. if available. I really don't care about branding, but it has to be done.

It requires vesamenu.c32, which is part of syslinux

For uefi builds, efi.img is required and params passed to mkisofs are different, otherwise it's just a non-uefi syslinux iso.

However -this is important, a side effect- for puppyinstaller and some other apps... this will require some tweaks, and perhaps the help*.msg files should not be in a subdirectory, for backwards compatibility, but vesamenu may break external scripts, i guess it doesn't matter...

And a specific syslinux version must be enforced, vesamenu might be problematic, see http://www.slax.org/blog/24357-vesamenu-c32-boot-problem.html

So, what i'll do is remove the old isolinux stuff and place the 'new' stuff where it belongs...

any thoughts?

woodenshoe-wi commented 6 years ago

New versions of vesamenu.c32 probably need libcom32.c32 libutil.c32 and libgpl.c32

If it still doesn't work try adding ldlinux.c32 menu.c32 and ldlinux.sys

That is the full set of files that I have in my computer's boot directory and I do use vesamenu.

I didn't know that isolinux.bin was in woof-arch, I thought it was grabbed from whatever version of syslinux was included in the build.

The way the boot loader files are multiplying, it might be nice if they could be kept in a "boot" directory, but the kernel, initrd and puppy sfs files should probably be kept in the root of the ISO because they are the files people grab when they are doing a manual installation.

The syntax for the isolinux boot prompt is to type the label name (which is puppy) followed by the additional boot parameters. If vesamenu uses a different syntax maybe it needs it's own help file?

wdlkmpx commented 6 years ago

I simply typed vmlinuz and it worked, the label was 'stretch' and 'puppy' didn't work... uefi iso. I didn't know you have to type the label name..

The isolinux.bin in woof-arch is not used unless 3builddistro cannot find isolinux.bin in rootfs-complete. hmmm there are too many c32 files.... i like the simplicity of grub4dos, only 1 file and supports a wide range of stuff, like a mini operating system

One can edit all menu items and boot with the edited text, no need to type a whole line. But it doesn't work with uefi... there are tons of machines that work without uefi boot.. that may change in 5-10 years..

woodenshoe-wi commented 6 years ago

I think syslinux 4.07 might be the last version that works as a single file. Starting with version 5 stuff was translated from assembly to C and the bugs that prevented isolinux from displaying the splash screen were introduced. The EFI support was introduced in version 6 if I remember correctly, and by that time everything was modular so it could be shared between the BIOS and EFI boot loaders.

I don't think the splash screen that isolinux displays is compatible with the EFI boot loader, so if the plan is to have one consistent boot menu with BIOS or EFI boot, it is probably necessary to use vesamenu. Or gfxboot, 😀 that brings "complicated" to a whole new level... but gfxboot does support internationalization and alternate keyboard layouts. If you have any interest in gfxboot, the documentation on how to get syslinux to load gfxboot that I found online was out of date, but I can share the menu config file that worked in my tests.

Even though grub4dos might be the best option for booting FAT formatted USB sticks, does it work on CDs/DVDs?

I think it is best to have as many options as practical, some picky hardware might work with one boot loader but not another.

wdlkmpx commented 6 years ago

Yeah it would be interesting to see your configs. Grub4dos works with everything but uefi..

I think the current puppy syslinux stuff is meant for version 4.x

slackware still uses 4.07 https://packages.slackware.com/?r=slackware-current&p=syslinux-4.07-i586-2.txz .. there's no syslinux-6 pkg

There seems to be a problem with the syslinux-6 pet pkg.. ldlinux.c32: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped vesamenu.c32: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped

..in the i686 pet pkg.. some files in /usr/share/syslinux are 64-bit

I guess that's why it doesn't work

I downloaded syslinux from the ubuntu bionic repo:

isolinux: /usr/lib/ISOLINUX syslinux-common: /usr/lib/syslinux/modules/bios

A woofce syslinux-6 UEFI ISO will boot if the following files are not missing:

cd/isolinux.bin cd/isolinux/ldlinux.c32 cd/isolinux/libcom32.c32 cd/isolinux/libutil.c32 cd/isolinux/vesamenu.c32

In other words woofce only supports syslinux 4.

Params passed to mkisofs..

mkisofs -iso-level 4 -D -R -o $OUTPUT -b isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table \ -eltorito-alt-boot -eltorito-platform efi -b efi.img -no-emul-boot "$tmp_isoroot"

woodenshoe-wi commented 6 years ago

The relevant part of syslinux.cfg

DEFAULT boot-menu-test
 PROMPT 0

LABEL boot-menu-test
 KERNEL gfxboot.c32
 APPEND bootlogo

The documentation at https://en.opensuse.org/SDB:Gfxboot suggests using

gfxboot bootlogo

in the config file, and that might be correct for older versions, but I couldn't get it to work with 6.03

The bootlogo file is made by the user space gfxboot programs, I used the version from https://github.com/openSUSE/gfxboot I used the openSUSE theme for testing, I don't know if anyone has made a gfxboot theme for puppy but it looks quite involved...

The command I used to test it with qemu was

gfxboot -v --change-config penguin=100 --test --preview -b syslinux \
        --test-add-files /boot/syslinux/gfxboot.c32 \
                         /boot/syslinux/syslinux.cfg \
                         /boot/syslinux/libcom32.c32 \
                         /boot/bootlogo /boot/syslinux/ldlinux.c32

The extra --test-add-files were needed because I was using 6.03 and the openSUSE scripts might not directly support the newer versions.

It needs a boot-sector file to use with qemu and expects it to be in /usr/lib/boot/master-boot-code I think this is some sort of openSUSE specific file location and I copied /usr/share/syslinux/mbr.bin to /usr/lib/boot/ and renamed it to master-boot-code and it works for me.

gfxboot is also supposed to work with grub1, so the only reason to have to get it working with syslinux 6 is EFI support.

There seems to be a problem with the syslinux-6 pet pkg.. ldlinux.c32: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped vesamenu.c32: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped

To get it to compile I compiled the BIOS and 32bit EFI targets in a 32bit pup and the 64bit EFI target in a 64bit pup and packed up the source code and uploaded it to GitHub. Then the petbuild downloads the source code tarball and compiles the installers for 32bit and 64bit. I thought the installers were the only thing that was compiled differently for 32bit and 64bit but I guess I messed up the first step. I will try again when I have some time.

woodenshoe-wi commented 6 years ago

I thought I had the petbuild working with the new versions of syslinux but just because there are no error messages doesn't mean the petbuild is working properly...

There are now 3 copies of the c32 files, the BIOS versions in the old location and the EFI versions in the efi32 and efi64 subdirectories. The petbuild was grabbing a mixture of them... I switched to using INSTALLROOT=${CWD}/${PKG}-install make installer install instead of manually installing files in the petbuild, so the pets are probably a lot fatter now but should work.

https://gitlab.com/woodenshoe-wi/petbuilds-out/raw/3359450b9d3d076933d2b706271996106621123f/puppylinux/pet_packages-common32/syslinux-6.04-pre1-patched-i686_1.pet

https://gitlab.com/woodenshoe-wi/petbuilds-out/raw/3359450b9d3d076933d2b706271996106621123f/puppylinux/pet_packages-common64/syslinux-6.04-pre1-patched-x86_64_1.pet

If they don't, another approach would be to have two options in 3builddistro. The "classic" boot splash would always use the isolinux.bin from woof-CE and the vesamenu option would use whatever version of syslinux is included in the build and if it was new enough would support EFI.

wdlkmpx commented 6 years ago

Well the UEFI iso does boot in uefi mode. But i see a simple GRUB 2.00 menu. And in legacy bios mode it shows the flashy vesamenu menu.

There is also uefi-usb-installer, this script creates a bootable usb flash drive, or so i think. i haven't tested it, but it also adds the same grub2 menu

This means that vesamenu is actually a replacement to the old isolinux stuff. Changes will also affect remasterpup2, puppyinstaller and some other apps, in other words my neck is very tense

wdlkmpx commented 6 years ago

I also don't know much about the script micko posted on the forum and that gyro edited. Is it the replacement for the uefi-usb-installer? is it original? Is it the only one? is it everything you need?

There are too many variables here including the stuff that phil is yet to merge. What if i move the png images from the efi-grub2 rootfs-package to woof-code/boot or something

woodenshoe-wi commented 6 years ago

Syslinux 6 is supposed to support EFI but if you are getting a GRUB 2 menu then it must be GRUB 2 that is being installed in the ISO.

Vesamenu is part of syslinux, I don't know if it is possible to use a single menu system in puppy. GRUB4DOS uses one syntax, GRUB 2 uses another and syslinux uses a completely unrelated syntax.

GRUB 2 should also support BIOS booting, so it should be possible to make a purely GRUB 2 ISO. I don't remember having much success getting a graphical menu working with GRUB, but if you like working with GRUB better than syslinux it should be easier to make a GRUB theme than a gfxboot theme.

gyrog commented 6 years ago

I've been working on a new Puppy frugal installer/manager, "FrugalPup", now available in the forum. It uses grub2-efi and grub4dos. I looked at using grub2 for both uefi and mbr/legacy booting, but I eventually discarded the idea due to a lack of a simple MBR installer for Windows and Linux, as exists for grub4dos.

wdlkmpx commented 6 years ago

It can be added as another installer. Type 'dotpup' and you'll se the available recognized installers. When you think it's ready and want it to be widely adopted.. it can be a pet pkg (ask peabee), rootfs-package, or another core app in rootfs-skeleton.

gyrog commented 6 years ago

@wdlkmpx, The point of my comment is the last sentence rather than the first.

woodenshoe-wi commented 6 years ago

But that doesn't mean it wouldn't work on an ISO. Puppy would still have grub4dos for installing to the MBR, but the ISO could be pure GRUB 2 so it would use the same menu system whether it was booted in BIOS mode or EFI mode.

gyrog commented 6 years ago

Will the MBR written by grub4dos utilities boot grub2?

wdlkmpx commented 6 years ago

I think the answer is no, but i don't know.

There is a special MBR called 'wee'. A wee.mbr.

It reads a config file embedded in itself, and boots the first valid entry, it can boot grub4dos, and other bootloaders probably

It's part of grubutils. it only compiles with an older gcc (4.x works) https://github.com/chenall/grubutils/tree/master/grubutils/wee

This is the "embedded menu" that can be customized: https://github.com/chenall/grubutils/blob/master/grubutils/wee/preset_menu_used

woodenshoe-wi commented 6 years ago

Maybe, I've used ldgrub2 to start GRUB2 from syslinux. I don't remember if I ever used it with GRUB4DOS or if I ran into problems.

This link might have some info, https://www.mail-archive.com/grub-devel@gnu.org/msg03902.html

I also have configured the windows boot loader to load GRUB2. I don't remember if I was using GRUB4DOS for that, because I'm sure I've used GRUB4DOS for something but I can't remember exactly what.

gyrog commented 6 years ago

Sorry, I thought my question was rhetorical. Usually a particular MBR boots a particular boot loader. i.e. grub4dos MBR boots grldr.

Life's a little easier if there exists a simple utility for installing the appropriate MBR for both windows and Puppy. This is true for grub4dos.

wdlkmpx commented 6 years ago

Hmm it looks like this is not going to happen (very) soon..

The current "uefi" iso is actually all that's needed, it was well designed, boots in eufi and bios mode, with grub2 and isolinux.. really good.

The good thing about syslinux is the hybrid iso stuff, which makes a iso img bootable from a usb drv (or a hdd), when you don't know what to do just dd the iso to a flash drive.

However creating a bootable usb flash drive with syslinux/extlinux and vesamenu.c32 becomes a problem.. apparently we'll need syslinux 6. And syslinux has become too modular and "many" extra files are needed..

micko wrote a uefi flash drive installer that requires grub2 (haven't tested it), and my rewritten bootflash uses wee + gru4bos, so syslinux is out of the picture right now.. good for cd isos, not quite good for everything else.. specially when branding and png images are required..

This commit clearly explains how things work https://github.com/puppylinux-woof-CE/woof-CE/commit/f90b3b708fe0962c6f9f92d01e58575505c101c1

Proper support for sysinux in the final rootfs is a TODO, in fact i think i must edit puppyinstaller to remove syslinux stuff, which will be re-added. It's a messy situation there.

Proper support has to start in 3builddistro and the PKGS_SPECS, consistent support

wdlkmpx commented 6 years ago

In fact, the current uefi iso is good, and it will be improved. syslinux is used to produce an hybrid iso that will boot from a cd/usb drive.

Using physical hardware, I have only tested with a usb drive (dd if=uefi.iso of={drv_drive_device})

In uefi mode, the grub2 efi(boot).img is used, but it in bios mode it's a syslinux boot. Cool..

I read the syslinux uefi stuff is buggy https://wiki.archlinux.org/index.php/syslinux#Limitations_of_UEFI_Syslinux

Apparently it's used but only in full installs (possible alternative for puppyinstaller), when you want uefi stuff in a hybrid iso, it has to be grub2..