mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: bootloader specification for barebox
Date: Mon, 30 Sep 2013 11:43:04 +0200	[thread overview]
Message-ID: <1380534188-1734-1-git-send-email-s.hauer@pengutronix.de> (raw)

Hi All,

The following implements the bootloader specification for barebox.

See http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ for a
description of the bootloader spec.

Quoting from it:

| Currently there's little cooperation between multiple distributions in
| dual-boot (or triple, ... multi-boot) setups, and we'd like to improve this
| situation by getting everybody to commit to a single boot configuration format
| that is based on drop-in files, and thus is robust, simple, works without
| rewriting configuration files and is free of namespace clashes.
| 
| The Boot Loader Specification defines a scheme how different operating systems
| can cooperatively manage a boot loader configuration directory, that accepts
| drop-in files for boot menu items that are defined in a format that is shared
| between various boot loader implementations, operating systems, and userspace
| programs. The target audience for this specification is:
| 
| * Boot loader developers, to write a boot loader that directly reads its
|   configuration at runtime from these drop-in snippets Distribution and Core
| * OS developers, in order to create these snippets at OS/kernel package
|   installation time
| * UI developers, for implementing a user interface that discovers the available
|   boot options
| * OS Installer developers, for setting up the initial drop-in directory

With this it is for the first time possible for a distribution to install a
kernel for barebox in a completely bootloader or board agnostic way. systemd
based distributions already ship a kernel-install script which can be used
to install a kernel.

With the following series it's possible to discover bootloader spec entries
on a device and to start them. For the user it basically goes down to adding
a device to the boot order, so either call 'boot <devname>' (with devname being
disk0, emmc, sd, or the hardware device, like omap-hsmmc0...) or add this to
global.boot.default.

I already used systemds kernel-install script successfully to install a kernel.
However, embedded users often have the task of making SD cards bootable from
a development host, so barebox has its own tool which is able to work in a
cross environment.

To test this do the following:

- build and start barebox with these patches (obviously)
- create a SD card with a VFAT partition big enough to hold your kernels,
  preferably with a partition type of 0xea
- Add a partition to hold your rootfs, copy your rootfs to it.
- build a kernel.
- Call the barebox kernel-install tool like this, assuming your SD card is
  /dev/sde and the rootfs is on /dev/sde2:

./scripts/kernel-install --add --device=/dev/sde --root=/dev/sde2 \
	--kernel=/path/to/zImage --devicetree=/path/to/dtb \
	--options="console=ttySx,115200" --title="My Linux 3.12-rc3" \
	--kernel-version="3.12-rc3" --add-root-option

- put the SD card into the board, try 'boot -l'. It should then list the
  entry. Start it with boot <devname>. If menu support is enabled try 'boot -m'

With the Fedora FC19 SD images it should be possible to simply call the following
from a running system:

kernel-install add v3.12-rc3 /path/to/zImage

(The official bootloader spec currently has no support for devicetrees, barebox
must provide it should you need one)

This all probably still has some rough edges, but it really already shows the
potential of making generic ARM distribution (and installer) images possible.
Also there's only little configuration of the bootloader needed which hopefully
makes usage of barebox easier.

Sascha

----------------------------------------------------------------
Sascha Hauer (4):
      add function to read single line files
      cdev: store dos partition type in struct cdev
      Implement bootloader spec support for barebox
      add kernel-install tool for bootloader Spec

 commands/boot.c            |  172 +++++-
 common/Kconfig             |   14 +
 common/Makefile            |    2 +
 common/blspec.c            |  516 ++++++++++++++++
 common/partitions.c        |    4 +-
 common/partitions/dos.c    |    7 +-
 common/partitions/parser.h |    1 +
 include/blspec.h           |   92 +++
 include/driver.h           |    1 +
 include/libbb.h            |    2 +
 lib/libbb.c                |   42 ++
 scripts/Makefile           |    2 +
 scripts/kernel-install.c   | 1399 ++++++++++++++++++++++++++++++++++++++++++++
 13 files changed, 2226 insertions(+), 28 deletions(-)
 create mode 100644 common/blspec.c
 create mode 100644 include/blspec.h
 create mode 100644 scripts/kernel-install.c

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2013-09-30  9:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-30  9:43 Sascha Hauer [this message]
2013-09-30  9:43 ` [PATCH 1/4] add function to read single line files Sascha Hauer
2013-09-30  9:43 ` [PATCH 2/4] cdev: store dos partition type in struct cdev Sascha Hauer
2013-09-30  9:43 ` [PATCH 3/4] Implement bootloader spec support for barebox Sascha Hauer
2013-09-30  9:43 ` [PATCH 4/4] add kernel-install tool for bootloader Spec Sascha Hauer
2013-10-14  9:38 ` bootloader specification for barebox Jan Lübbe
2013-10-14  9:43   ` Robert P. J. Day
2013-10-14 10:05     ` Jan Lübbe
2013-10-14 10:07       ` Robert P. J. Day

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1380534188-1734-1-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox