Coreboot to boot USB

39 respostas [Última entrada]
elodie
Desconectado
Joined: 02/01/2014

I searched high and low and found a few ways to put GRUB2 on the USB, that coreboot can have GRUB2 as a payload, but not GRUB1 and so on.

My Gluglug X60 comes with coreboot that boots amazingly fast. I am almost instantly presented with a GURB2 menu. And I am lost here. I badly want to boot a USB stick. No option would work, but anything that has to do with USB leads to a faint high pitched noise. Sticks and carrots? I learned my lesson. Can somebody help me boot one stick any regular proprietary BIOS from the last decade can boot. Nothing about specifying a vmlinuz path.

BugRep
Desconectado
Joined: 04/05/2012

You may want to use SeaBIOS as a payload to have support for USB devices.

elodie
Desconectado
Joined: 02/01/2014

Sure. One of the many options says 'Boot SeaBIOS (requires serial ouput, baud 115200) (for booting USB drives)'
Only it's one of those useless options. After a dark screen it defaults to normal boot. And a strange rather faint high pitch sounds that remains until I shut the system down.

Weird, because Mr. Rowe, in one of the messages prior to the purchase wrote to me that coreboot can boot USB without the need of SeaBIOS.

fchmmr
Desconectado
Joined: 05/14/2013

You can boot USB in GRUB2 but you have to directly boot the kernel/ramdisk. Some example entries are in the menu.
There is a newer version of GRUB available that can parse the SYSLINUX menu (isolinux.cfg) of most ISO's and automatically create GRUB menu entries.

I plan on issuing an updated coreboot image in the near future, with this parses included and some menuentries that use it. This should make booting ISO's easier.
Currently there are some pre-defined menuentries for common FSDG distros (Trisquel, Parabola, gNewSense).

fchmmr
Desconectado
Joined: 05/14/2013
elodie
Desconectado
Joined: 02/01/2014

Most probably it is a stupid thing, but can't it chain somehow? Let the drive do the job. I have no idea how the magic of the proprietary BIOS works.

fchmmr
Desconectado
Joined: 05/14/2013

chainloader will not work as this requires a bios* (this is why it is necessary to boot a kernel and ramdisk directly).
*the gluglug x60 uses GRUB2 payload instead of SeaBIOS.

elodie
Desconectado
Joined: 02/01/2014

I just tried the SeaBIOS with the Gluglug X60 docked. Serial means not access to a serial port, but a second computer to read the Serial output and give a particular input based on that output?

fchmmr
Desconectado
Joined: 05/14/2013

To view serial output, connect the null modem cable to the dock and connect the other end via the USB serial adapter, to your other machine.
On that other machine, there are several ways to monitor serial output. The way I use is:
sudo screen /dev/ttyUSB0 115200

(if you don't have GNU Screen: sudo apt-get install screen)

The SeaBIOS payload is redundanty, strictly speaking. It will not be included in later updates. (instead, a SYSLINUX parser from the latest GRUB will be included, which makes booting ISO's much easier).

fchmmr
Desconectado
Joined: 05/14/2013

The new updates (see this thread) improve things.
SeaBIOS is no longer included. GRUB can do everything (without those bugs from before) now.

fchmmr
Desconectado
Joined: 05/14/2013

See my reply below regarding the updated coreboot image (plus source code).

Eemeli
Desconectado
Joined: 01/04/2014

It seems booting into USB is buggy currently. In the readme included in the sources I found this sentence: "GRUB2 USB support is buggy/temporamental at the time of writing"

I also get the high-pitched noise when trying to boot using the SeaBios.

elodie
Desconectado
Joined: 02/01/2014

So the only way out is plugging the docking station for those who have it and bare with the noise till they install another system. Not a nice perspective.

fchmmr
Desconectado
Joined: 05/14/2013

Example (USB):
linux (usb0)/vmlinuz idle=halt
initrd (usb0)/initrd.gz
boot
Or CD (on the dock):
linux (ata0)/vmlinuz idle=halt
initrd (ata0)/initrd.gz
boot

idle=halt turns off CPU throttling, which removes the whining noise. This is a workaround for a bug in the way coreboot handles power states. It happens when the CPU is idle (running at a lower speed).

fchmmr
Desconectado
Joined: 05/14/2013

When booting with SeaBIOS, your distro's grub config is used.
In Trisquel, you can add "idle=halt" option to /etc/default/grub on the GRUB_CMDLINE_LINUX_DEFAULT= variable and then run "update-grub" command as root.

Junichiro
Desconectado
Joined: 09/06/2009

I installed debian with success on my gluglug box. Maybe it may help for trisquel:

I copy the hd media files (vmlinuz and initrd.gz) on sda4; and copy the netinstall iso on an USB stick (Only copy it!);
I boot; key c;
linux (ahci0,4)/vmlinuz;
then
initrd (ahci0,4)/initrd.gz;
then
boot
And installation as usual. (for me, it found the iso without doing anything).

elodie
Desconectado
Joined: 02/01/2014

Thank you. It beats the purpose of a Live system. But it looks workable.

fchmmr
Desconectado
Joined: 05/14/2013

You can boot with USB. Not all drives work currently (GRUB2 USB mass storage support is incomplete). This is a common issue that will hopefully be addressed in the near future.

The ones I have and recommend: Kingston DT101 G2 (8GB).
There are others but this is what I have. (they work flawlessly in GRUB).

fchmmr
Desconectado
Joined: 05/14/2013

Adding to note: working on a new update which should solve these issues.
(on the weekend of Saturday, February 15th)

fchmmr
Desconectado
Joined: 05/14/2013

To put one's money where one's mouth is:

4th release.
2014 February 21st

Compiled version () (pre-compiled coreboot.rom, flashrom/bucts source code. Documentation.):
- useful if you just want to flash the new version:
- http://gluglug.org.uk/X60/release/3/X60_binary.tar.gz

Source code () (coreboot, bucts, flashrom, grub2, memtest86+. Config files. Documentation.):
- useful if you want to study and hack the source code:
- http://gluglug.org.uk/X60/release/3/X60_source.tar.gz

Changes:
- Removed SeaBIOS (redundant)
- New GRUB version (2.02~beta2)
--> Fixes some USB issues
--> Includes ISOLINUX/SYSLINUX parser
- New grub.cfg
--> Removed useless options:
* options for booting sda 2/3/4
* seabios boot option
- Added new menu entries:
--> Parse ISOLINUX config (USB)
--> Parse ISOLINUX config (CD)
--> Added "cat" module for use on GRUB command line.
* "set pager=1" is set in grub.cfg, for less-like functionality

The "Parse" options read ./isolinux/isolinux.cfg on a CD or USB,
and automatically converts it to a grub config and switches to the boot menu of that distro.
This makes booting ISO's *much* easier than before.

Junichiro
Desconectado
Joined: 09/06/2009

I read the readme and the update file but didn't understand how to update coreboot.

fchmmr
Desconectado
Joined: 05/14/2013

The instructions are in FLASH_INSTRUCTION (file):

WARNING!
Updating your firmware has a risk of bricking the machine.
You have been warned, and do so at your own risk.

also see: README
---

this assumes that you already have coreboot running and are updating it.

put coreboot.rom in the flashrom directory
(coreboot.rom is in ./coreboot/build)

a flashrom executable is already compiled for convenience.
so if you don't want to compile, just make sure it has execute permission:
chmod +x ./flashrom

or if you want to compile it again:
make clean
make

---

with coreboot.rom in the flashrom directory, do this:
sudo ./flashrom -p internal -w coreboot.rom
--
or this command, if 3 flash chips are detected (in the case of X60's with the macronix flashchip):
sudo ./flashrom -p internal -w coreboot.rom -c "MX25L1605D/MX25L1608D"

shut down your machine after it says VERIFIED.

Note: you can also use the flashrom version provided by your distro.
Note: look in README for flashrom dependencies.

Junichiro
Desconectado
Joined: 09/06/2009

Yes! I read it. But don't understand what I've to do. Or It doesn't work.

fchmmr
Desconectado
Joined: 05/14/2013

For those who are reading this, this assumes you already have coreboot.
This won't work if you have Lenovo BIOS (there are some extra steps involved).

--

wget http://gluglug.org.uk/X60/release/3/X60_source.tar.gz

Here is what I did:

tar -xf X60_source.tar.gz
cd X60_source/flashrom
or
cd X60_binary/flashrom

Note: I already have flashrom dependencies installed. Get the list in README.

make clean
make
cp ../coreboot/build/coreboot.rom .

Note: if you downloaded X60_binary.tar.gz, do this instead:
cp ../coreboot.rom .

sudo ./flashrom -p internal -w coreboot.rom

If it shows *VERIFIED* written at the end, then it worked.
At this point, shut down the machine (shut it down fully! Do not sleep/reboot).

---

If you didn't see that output above, you will have seen this instead:

$ sudo ./flashrom -p internal -w coreboot.rom
[sudo] password for user:
flashrom v0.9.7-r on Linux 3.12.4-gnu (i686)
flashrom is free software, get the source code at http://www.flashrom.org

Calibrating delay loop... OK.
Found chipset "Intel ICH7M". Enabling flash write... OK.
Found Macronix flash chip "MX25L1605" (2048 kB, SPI) at physical address 0xffe00000.
Found Macronix flash chip "MX25L1605A/MX25L1606E" (2048 kB, SPI) at physical address 0xffe00000.
Found Macronix flash chip "MX25L1605D/MX25L1608D" (2048 kB, SPI) at physical address 0xffe00000.
Multiple flash chip definitions match the detected chip(s): "MX25L1605", "MX25L1605A/MX25L1606E", "MX25L1605D/MX25L1608D"
Please specify which chip definition to use with the -c option.

So I do this instead (on my X60):

sudo ./flashrom -p internal -w coreboot.rom -c "MX25L1605D/MX25L1608D"

And then I see that same successful output as above:

$ sudo ./flashrom -p internal -w coreboot.rom -c "MX25L1605D/MX25L1608D"
flashrom v0.9.7-r on Linux 3.12.4-gnu (i686)
flashrom is free software, get the source code at http://www.flashrom.org

Calibrating delay loop... OK.
Found chipset "Intel ICH7M". Enabling flash write... OK.
Found Macronix flash chip "MX25L1605D/MX25L1608D" (2048 kB, SPI) at physical address 0xffe00000.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.

Junichiro
Desconectado
Joined: 09/06/2009

root@debian-gluglug:/home/junichiro/X60_binary/flashrom# ./flashrom -p internal -w coreboot.rom
./flashrom: error while loading shared libraries: libftdi.so.1: cannot open shared object file: No such file or directory
root@debian-gluglug:/home/junichiro/X60_binary/flashrom#

fchmmr
Desconectado
Joined: 05/14/2013

Your hostname in the past tells me that you use Debian. Although I don't (won't) use this myself, the dependencies should be the same as Trisquel.

You should probably recompile it.

So install these dependencies (as per the readme):
sudo apt-get -y install libpci-dev pciutils zlib1g-dev libftdi-dev

(libftdi is needed, this command will install it. The output says that you don't have it)

And then:
make clean
make

Then try again:
sudo ./flashrom -p internal -w coreboot.rom

If it says "VERIFIED" at the end, then it worked!
At that point, shut down then wait a few secs, and turn it back on.

If it doesn't say VERIFIED, then it would have complained about multiple flash chips. In that case, do this instead:

sudo ./flashrom -p internal -w coreboot.rom -c "MX25L1605D/MX25L1608D"

------------

Note,
you can also install flashrom from the repository.

sudo apt-get install flashrom

Then do instead, like so:
sudo flashrom -p internal -w coreboot.rom

or (if the above doesn't work):
sudo flashrom -p internal -w coreboot.rom -c "MX25L1605D/MX25L1608D"

fchmmr
Desconectado
Joined: 05/14/2013

s/past/paste

Junichiro
Desconectado
Joined: 09/06/2009

Sorry! Was totally stupid (Maybe the flu I've?). Done now. My debian wasn't totally installed since I did a minimal installation; then install xfce etc..

Junichiro
Desconectado
Joined: 09/06/2009

But it doesn't seem to boot better with gdnewhat on USB stick. So my gluglug box will stay with debian that installs and runs perfectly! Thanks to Francis!

fchmmr
Desconectado
Joined: 05/14/2013

See my note below (in this thread) about gdnewhat.

elodie
Desconectado
Joined: 02/01/2014

Installing libftdi1 was enough to run flashrom. I don't recall removing it, but I did remove quite a few packages.

fchmmr
Desconectado
Joined: 05/14/2013

Note, I am also "fchmmr" (same nick as on this forum) on IRC freenode. /query me there if you get stuck.

fchmmr
Desconectado
Joined: 05/14/2013

Parse options tested with Trisquel 6 (gnome3) iso, Parabola iso.

fchmmr
Desconectado
Joined: 05/14/2013

I've tested this on a drive that had the "USB Mass Storage request failed" bug. Now it works perfectly.

I've also tested Trisquel Mini ISO. The "parse" options also boot that (directly from GRUB, without seabios), without having to type any commands.

When selecting "Parse" it switches to a new GRUB menu with all the isolinux.cfg entries converted to GRUB entries.

Next I'll test this on a USB DVD drive.

fchmmr
Desconectado
Joined: 05/14/2013

Tested gdnewhat. Doesn't work but you can now use "cat".

So you can use, eg:

cat (usb0)/isolinux/isolinux.cfg
It might link to another .cfg file. So cat that instead.

Then get the options, and adapt them. For example, I found the menu entry in there with those options on the APPEND line.

Then I found where those vmlinuz and initrd

Then you do (with those options):

linux (usb0)/isolinux/vmlinuz0 root=live:CDLABEL=hatrack20 rootfstype=auto ro rd.live.image quiet rhgb rd.luks=0 rd.md=0 rd.dm=0

initrd (usb0)/isolinux/initrd0.img

boot

You can boot any distro, but not all of them work properly with the parser so in those cases you still hvae to do it manually.

That is how I manually booted the ISO. This is necessary in those cases where the "parse" options don't work properly. (for example, it couldn't boot gdnewhat or gnewsense - but it worked with Trisquel Mini, Trisuel and Parabola)

(usb0) means I'm assuming you used "dd" on the flash drive directly, and not on a partition.

Junichiro
Desconectado
Joined: 09/06/2009

Yes! I did that but I received "invalid magic number".

fchmmr
Desconectado
Joined: 05/14/2013

This is no longer true (or it is less true).
I'm testing some USB drives that used to fail, and they are working perfectly now.

(see notes below about updating)

Sim
Sim
Desconectado
Joined: 09/29/2013

Thanks for your explanation!

There is one issue I don't understand though. If you install a new OS on the gluglug, will the GRUB bootloader remain unchanged? Which paritions can be deleted and which paritions can be chosen for the installation?

fchmmr
Desconectado
Joined: 05/14/2013

It will remain unchanged but now you can easily change the default grub.cfg using "cbfstool" (the config is in CBFS now). I will write a tutorial about this at some point.

cbfstool is included in coreboot source code, until ./util

I have another update planned:

Next update planned:
- enumerate list of all ISO's on the root of a flash drive, generate
menu entries for loopback mounting and booting those directly.
- automatically use "scan" and boot the 1st menu by default*

*an error appears, because the wrong prefix is set. (there are modules that most distro grub configs try to load, which aren't included in the grub payload)
(the idea is to test it by setting the prefix in GRUB to use the modules provided by the distro)

I think you can fix this by setting the right prefix to use the grub
modules on the HDD instead of in the boot flash.
I'll be testing this.

elodie
Desconectado
Joined: 02/01/2014

Problem solved thanks to Mr. Rowe. I'll be back with more details.