WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Boot TC from GRUB2 floppy image - issues  (Read 2313 times)

Offline flyingfishfinger

  • Jr. Member
  • **
  • Posts: 74
Boot TC from GRUB2 floppy image - issues
« on: April 01, 2019, 06:42:38 PM »
Hi,
I'm trying to boot TC from a custom-sized floppy image. So far I've managed to install GRUB2 to this image and can boot to my grub.cfg file (QEMU / Virtualbox etc), but I'm  having trouble getting it to actually load anything else.

I've extracted the vmlinuz and core.gz from the ISO image and put them in the root (among other places I've tried), but the best I can get is "Cannot read the Linux header". It's a lot better than "file not found", but obviously I'd like a working boot.

Granted that I don't know a whole lot about how all this stuff works, I assumed I should at least be able to get a shell booted from this.

Does anyone have any pointers / tips / suggestion about this?

Cheers,
R

Offline core-user

  • Full Member
  • ***
  • Posts: 192
  • Linux since 1999
Re: Boot TC from GRUB2 floppy image - issues
« Reply #1 on: April 02, 2019, 05:12:11 AM »
Might be easier to use syslinux/extlinux(?).
AMD, ARM, & Intel.

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Boot TC from GRUB2 floppy image - issues
« Reply #2 on: April 02, 2019, 06:10:10 AM »
Hello flyingfishfinger

I don't want to contradict core-user but I think it comes down to which ever boot manager you are familiar with.   I prefer Grub2 as it's the most capable for my needs, not every boot scenario is covered by either boot manager.

I'd offer to help with grub2 but other than boot TC it's not clear what your particular scenario is.   At a minimum please showy your current grub config file here and some specifics regarding the file systems where vmlinuz and core.gz are located.

Offline flyingfishfinger

  • Jr. Member
  • **
  • Posts: 74
Re: Boot TC from GRUB2 floppy image - issues
« Reply #3 on: April 02, 2019, 02:14:03 PM »
Hi,
Let me be a bit more specific, sorry for the lack of details.

I am attempting to create a bootable floppy image as a payload for coreboot /SeaBIOS. To that end, I need (1) a custom-sized floppy image to hold TinyCore and (2) a way to make it bootable.

It doesn't REALLY matter what bootloader I use, but since I started with GRUB2 based floppy images I stuck with those for the time being. I used this script / guide here:

https://magiksys.blogspot.com/2013/03/create-vfat-grub2-boot-floppy.html

and I'm testing it on qemu with the "-fda" switch. Grub was installed in the image using a VM with an old version of Ubuntu that includes Grub 1.98 (which the guide was written for, so I figure I should follow it since Grub2 keywords take different options depending on the versions).

The image is formatted as FAT(16) and Grub reports the drive as (fd0).

Interestingly, even though there is a mountable FAT partition in this image, Grub does not see it. If I "ls (fd0)", the return value is :

"Device fd0: Filesystem type fat, UUID [something]"


The drive root has two directories:
-boot/grub/ (where the grub.cfg lives along with all the other Grub-related files)
-tce/boot/ (where I've put core.gz and vmlinuz from the TC image).

Grub successfully boots to my cfg file:

Code: [Select]
menuentry "Tiny Core Linux" {
set root="(fd0)"
linux /tce/boot/vmlinuz
initrd /tce/boot/core.gz
}

However, selecting this menu option fails and drops me into a Grub shell.

I'm open to moving to other bootloaders, but if possible I'd like to learn how to make this work with my current setup.

Cheers,
R

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Boot TC from GRUB2 floppy image - issues
« Reply #4 on: April 02, 2019, 09:42:23 PM »
Hello flyingfishfinger

OK first up, I;m not sure how much help I'll be able to provide due to using a floppy image and mixing various versions of GRUB2 and depreciated GRUB 1.98,  whereas booting a floppy image might be better to use Legacy Grub with it's copy of memdisk.    Having said that referring to the manual I believe GRUB2 has that capability although I have no experience of that.

There are many differences between grub 1.98 and v2, so that's not a good start, but... 

Grub2 should install to
/boot/grub/
(If not then reinstall grub-install --boot-directory=/boot/ /dev/fd0 )
config file to /boot/grub/grub.cfg

Linux install to
/boot/vmlinuz
/boot/core.gz



If you can drop into the GRUB console

fs_uuid from the Grub2 command line
ls (fd0)

And to verify the correct modules have been loaded to read the disk/image
lsmod

Or http://tinycorelinux.net/faq.html
use UUID  for real hardware,
blkid -s UUID /dev/fd0

Maybe try LABEL instead

Using (fd0) is a last resort, since it's not specific and GRUB2 might complain about that.

you could try UUID, LABEL or '(fd0,msdos)'  or  '(fd0)'   check syntax


Code: [Select]
insmod part_msdos
insmod fat

set default=0
set timeout=5

menuentry "Tiny Core Linux" {
search --fs-uuid --set=root B854-8FE0 
#search --label --set=root Partition_Label
#set root='fd0' 
linux /boot/vmlinuz noswap loglevel=3
initrd /boot/core.gz
}

Also while at the grub2 console you could try loading the kernel and initrd manually
(I'm not sure if I remember how much of the path is required here, depends if root has been set and where too.. and maybe /boot/* )

Code: [Select]
load vmlinuz   (or load (fd0)/boot/vmlinuz)
load initrd    (or load (fd0)/boot/initrd)
boot


GRUB2 manual here www.gnu.org/software/grub/manual/grub/grub.html

Good luck
« Last Edit: April 02, 2019, 09:58:28 PM by coreplayer2 »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Boot TC from GRUB2 floppy image - issues
« Reply #5 on: April 02, 2019, 11:10:00 PM »
Almost forgot to add, don’t forget to change the Grub.cfg entry of UUID or LABEL to your specific uuid or label  if used

Good luck


Sent from my iPhone using Tapatalk

Offline flyingfishfinger

  • Jr. Member
  • **
  • Posts: 74
Re: Boot TC from GRUB2 floppy image - issues
« Reply #6 on: April 03, 2019, 12:01:06 AM »
Hi-
The reason I didn't use a later version of Grub was that the installation stage changed from "grub-setup" to "grub-install", along with most of the arguments.

I'm giving it another shot right now and I'll report back whether any of your suggestions improve the situation.

First off with the current setup, any "ls" command works and reports all the files that are in the respective directories.

If I try to set "linux /tce/boot/vmlinuz", I get "Error: cannot read the Linux header". Then I tried downloading the kernel and core directly from the TC mirror ("Distribution files") and adding it to the image, I get a "Error: Couldn't read file", even though "ls" shows it just fine.

Be back soon.

R




Offline flyingfishfinger

  • Jr. Member
  • **
  • Posts: 74
Re: Boot TC from GRUB2 floppy image - issues
« Reply #7 on: April 03, 2019, 01:00:04 AM »
It's possible my floppy image is weird. I found reports of similar symptoms where files were stored outside readable ranges; and in my case if I mount the image I can't browse the files (even if they do show up with "ls" on my computer).

I'll try a different image and see if that improves things...

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Boot TC from GRUB2 floppy image - issues
« Reply #8 on: April 03, 2019, 03:48:52 AM »
The files you want to put in are far larger than a floppy supports. Even the extended formats don't go beyond 3mb. It's very likely Qemu has limits like that, even if Coreboot doesn't.
The only barriers that can stop you are the ones you create yourself.

Offline flyingfishfinger

  • Jr. Member
  • **
  • Posts: 74
Re: Boot TC from GRUB2 floppy image - issues
« Reply #9 on: April 03, 2019, 01:38:00 PM »
Good point, that may be true.

Apparently I can build a coreboot image with a custom floppy image and give that to QEMU as a bios, so maybe I should try that instead. It's far more involved for testing though...

R