Skip to contentSkip to conversation

Various x86 bootloaders and board support

PATCH New Thomas Petazzoni 2 participants 11 messages Feb 19, 2014

lore
Share & tools
lore
#0 lore raw

v3 cover Various x86 bootloaders and board support

Hello,

This is the v3 of the patch series that adds Grub 2 and Gummiboot bootloaders, as well as defconfig for two popular x86 development boards.

Changes v2 -> v3:

* Install gnu-efi only in the staging directory, and not in the target, since it contains only libraries to be linked into standalone EFI applications, not Linux userspace applications. Suggested by Yann E. Morin.

Changes v1 -> v2:

* Dropped all patches that have been merged.

* Confirmed that grub2 can be built with a pure target 64 bits compiler, for both the 64 bits Grub2 and the 32 bits Grub2. This answers Peter's question at
http://lists.busybox.net/pipermail/buildroot/2013-December/083682.html.

* Integrated the changes made by Christophe Vu Brugier on gummiboot and gnu-efi.

* Added dependency on wchar and largefile for gummiboot, since gummiboot selects util-linux.

* Adjust the two boards defconfig to lock down the kernel headers version to 3.8, since the kernel being built is derived from 3.8.

Thomas

Thomas Petazzoni (5):
grub2: add new package
gnu-efi: new package
gummiboot: new package
board: add support for the MinnowBoard
board: add support for the Fri2 board

 board/fri2/grub.cfg                                |   6 +
 board/fri2/linux-3.8.config                        | 336 +++++++++++++++++++++
 board/fri2/post-build.sh                           |   2 +
 board/fri2/readme.txt                              |  40 +++
 board/minnowboard/grub.cfg                         |   6 +
 board/minnowboard/linux-3.8.config                 | 172 +++++++++++
 board/minnowboard/post-build.sh                    |   2 +
 board/minnowboard/readme.txt                       |  40 +++
 boot/Config.in                                     |   2 +
 boot/grub2/Config.in                               | 120 ++++++++
 boot/grub2/grub.cfg                                |   6 +
 boot/grub2/grub2-remove-gets.patch                 |  21 ++
 boot/grub2/grub2.mk                                |  88 ++++++
 boot/gummiboot/Config.in                           |  28 ++
 boot/gummiboot/buildroot.conf                      |   4 +
 boot/gummiboot/gummiboot.mk                        |  42 +++
 boot/gummiboot/loader.conf                         |   2 +
 configs/fri2_defconfig                             |  23 ++
 configs/minnowboard_defconfig                      |  23 ++
 package/Config.in                                  |   1 +
 package/gnu-efi/Config.in                          |   9 +
 .../gnu-efi/gnu-efi-01-use-override-cflags.patch   |  53 ++++
 .../gnu-efi-02-parallel-make-archives.patch        |  48 +++
 package/gnu-efi/gnu-efi-03-parallel-make.patch     |  22 ++
 package/gnu-efi/gnu-efi.mk                         |  38 +++
 25 files changed, 1134 insertions(+)
 create mode 100644 board/fri2/grub.cfg
 create mode 100644 board/fri2/linux-3.8.config
 create mode 100755 board/fri2/post-build.sh
 create mode 100644 board/fri2/readme.txt
 create mode 100644 board/minnowboard/grub.cfg
 create mode 100644 board/minnowboard/linux-3.8.config
 create mode 100755 board/minnowboard/post-build.sh
 create mode 100644 board/minnowboard/readme.txt
 create mode 100644 boot/grub2/Config.in
 create mode 100644 boot/grub2/grub.cfg
 create mode 100644 boot/grub2/grub2-remove-gets.patch
 create mode 100644 boot/grub2/grub2.mk
 create mode 100644 boot/gummiboot/Config.in
 create mode 100644 boot/gummiboot/buildroot.conf
 create mode 100644 boot/gummiboot/gummiboot.mk
 create mode 100644 boot/gummiboot/loader.conf
 create mode 100644 configs/fri2_defconfig
 create mode 100644 configs/minnowboard_defconfig
 create mode 100644 package/gnu-efi/Config.in
 create mode 100644 package/gnu-efi/gnu-efi-01-use-override-cflags.patch
 create mode 100644 package/gnu-efi/gnu-efi-02-parallel-make-archives.patch
 create mode 100644 package/gnu-efi/gnu-efi-03-parallel-make.patch
 create mode 100644 package/gnu-efi/gnu-efi.mk
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH v3 1/5 grub2: add new package

---
 boot/Config.in                     |   1 +
 boot/grub2/Config.in               | 120 +++++++++++++++++++++++++++++++++++++
 boot/grub2/grub.cfg                |   6 ++
 boot/grub2/grub2-remove-gets.patch |  21 +++++++
 boot/grub2/grub2.mk                |  88 +++++++++++++++++++++++++++
 5 files changed, 236 insertions(+)
 create mode 100644 boot/grub2/Config.in
 create mode 100644 boot/grub2/grub.cfg
 create mode 100644 boot/grub2/grub2-remove-gets.patch
 create mode 100644 boot/grub2/grub2.mk
boot/Config.in +1 -0
index d23c761..c410d12 100644
@@ -6,6 +6,7 @@ source "boot/at91dataflashboot/Config.in"
 source "boot/barebox/Config.in"
 source "boot/boot-wrapper-aarch64/Config.in"
 source "boot/grub/Config.in"
+source "boot/grub2/Config.in"
 source "boot/lpc32xxcdl/Config.in"
 source "boot/mxs-bootlets/Config.in"
 source "boot/syslinux/Config.in"
boot/grub2/Config.in new file +120 -0

120 lines not on this page · raw message

boot/grub2/grub.cfg new file +6 -0
new file mode 100644
index 0000000..9ea5281
@@ -0,0 +1,6 @@
+set default="0"
+set timeout="5"
+
+menuentry "Buildroot" {
+	linux /bzImage root=/dev/sda1 console=tty1
+}
boot/grub2/grub2-remove-gets.patch new file +21 -0
new file mode 100644
index 0000000..0da71b3
@@ -0,0 +1,21 @@
+ISO C11 removes the specification of gets() from the C language, eglibc 2.16+ removed it
+
+Signed-off-by: Khem Raj <[email protected]>
+Signed-off-by: Thomas Petazzoni <[email protected]>
+
+Upstream-Status: Pending
+Index: grub-1.99/grub-core/gnulib/stdio.in.h
+===================================================================
+--- grub-1.99.orig/grub-core/gnulib/stdio.in.h	2010-12-01 06:45:43.000000000 -0800
++++ grub-1.99/grub-core/gnulib/stdio.in.h	2012-07-04 12:25:02.057099107 -0700
+@@ -140,8 +140,10 @@
+ /* It is very rare that the developer ever has full control of stdin,
+    so any use of gets warrants an unconditional warning.  Assume it is
+    always declared, since it is required by C89.  */
++#if defined gets
+ #undef gets
+ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
++#endif
+ 
+ #if @GNULIB_FOPEN@
+ # if @REPLACE_FOPEN@
boot/grub2/grub2.mk new file +88 -0

88 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#3 lore raw

PATCH v3 2/5 gnu-efi: new package

In reply to Thomas Petazzoni
---
 package/Config.in                                  |  1 +
 package/gnu-efi/Config.in                          |  9 ++++
 .../gnu-efi/gnu-efi-01-use-override-cflags.patch   | 53 ++++++++++++++++++++++
 .../gnu-efi-02-parallel-make-archives.patch        | 48 ++++++++++++++++++++
 package/gnu-efi/gnu-efi-03-parallel-make.patch     | 22 +++++++++
 package/gnu-efi/gnu-efi.mk                         | 38 ++++++++++++++++
 6 files changed, 171 insertions(+)
 create mode 100644 package/gnu-efi/Config.in
 create mode 100644 package/gnu-efi/gnu-efi-01-use-override-cflags.patch
 create mode 100644 package/gnu-efi/gnu-efi-02-parallel-make-archives.patch
 create mode 100644 package/gnu-efi/gnu-efi-03-parallel-make.patch
 create mode 100644 package/gnu-efi/gnu-efi.mk
package/Config.in +1 -0
index cb2d31b..a7a93f0 100644
@@ -584,6 +584,7 @@ endmenu
 menu "Hardware handling"
 source "package/ccid/Config.in"
 source "package/dtc/Config.in"
+source "package/gnu-efi/Config.in"
 source "package/lcdapi/Config.in"
 source "package/libaio/Config.in"
 source "package/libatasmart/Config.in"
package/gnu-efi/Config.in new file +9 -0
new file mode 100644
index 0000000..982102f
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_GNU_EFI
+	bool "gnu-efi"
+	depends on BR2_i386 || BR2_x86_64
+	help
+	  Develop EFI applications for IA-64 (IPF), IA-32 (x86), and
+	  x86_64 platforms using the GNU toolchain and the EFI
+	  development environment.
+
+	  http://gnu-efi.sourceforge.net/
package/gnu-efi/gnu-efi-01-use-override-cflags.patch new file +53 -0

53 lines not on this page · raw message

package/gnu-efi/gnu-efi-02-parallel-make-archives.patch new file +48 -0

48 lines not on this page · raw message

package/gnu-efi/gnu-efi-03-parallel-make.patch new file +22 -0
new file mode 100644
index 0000000..27c94e8
@@ -0,0 +1,22 @@
+Fix parallel make failure
+
+Upstream-Status: Submitted [Maintainer directly]
+
+Add a missing dependency which resulted in a race leading to failure
+on larger values of -j.
+
+Signed-off-by: Darren Hart <[email protected]>
+
+Index: gnu-efi-3.0/Makefile
+===================================================================
+--- gnu-efi-3.0.orig/Makefile
++++ gnu-efi-3.0/Makefile
+@@ -42,6 +42,8 @@ include $(SRCDIR)/Make.defaults
+ 
+ SUBDIRS = lib gnuefi inc apps
+ 
++gnuefi: lib
++
+ all:	check_gcc $(SUBDIRS)
+ 
+ $(SUBDIRS):
package/gnu-efi/gnu-efi.mk new file +38 -0
new file mode 100644
index 0000000..93c7b2c
@@ -0,0 +1,38 @@
+################################################################################
+#
+# gnu-efi
+#
+################################################################################
+
+GNU_EFI_VERSION = 3.0u
+GNU_EFI_SOURCE = gnu-efi_$(GNU_EFI_VERSION).orig.tar.gz
+GNU_EFI_SITE = http://downloads.sourceforge.net/project/gnu-efi/
+GNU_EFI_INSTALL_STAGING = YES
+GNU_EFI_LICENSE = GPLv2+ (gnuefi), BSD (efilib)
+GNU_EFI_LICENSE_FILES = debian/copyright
+
+# gnu-efi is a set of library and header files used to build
+# standalone EFI applications such as bootloaders. There is no point
+# in installing these libraries to the target.
+GNU_EFI_INSTALL_TARGET = NO
+
+ifeq ($(BR2_i386),y)
+GNU_EFI_PLATFORM=ia32
+else ifeq ($(BR2_x86_64),y)
+GNU_EFI_PLATFORM=x86_64
+endif
+
+define GNU_EFI_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		$(TARGET_CONFIGURE_OPTS) \
+		ARCH=$(GNU_EFI_PLATFORM)
+endef
+
+define GNU_EFI_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		$(TARGET_CONFIGURE_OPTS) \
+		INSTALLROOT=$(STAGING_DIR) \
+		PREFIX=/usr ARCH=$(GNU_EFI_PLATFORM) install
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.8.3.2
#5 lore raw

PATCH v3 3/5 gummiboot: new package

In reply to Thomas Petazzoni
---
 boot/Config.in                |  1 +
 boot/gummiboot/Config.in      | 28 ++++++++++++++++++++++++++++
 boot/gummiboot/buildroot.conf |  4 ++++
 boot/gummiboot/gummiboot.mk   | 42 ++++++++++++++++++++++++++++++++++++++++++
 boot/gummiboot/loader.conf    |  2 ++
 5 files changed, 77 insertions(+)
 create mode 100644 boot/gummiboot/Config.in
 create mode 100644 boot/gummiboot/buildroot.conf
 create mode 100644 boot/gummiboot/gummiboot.mk
 create mode 100644 boot/gummiboot/loader.conf
boot/Config.in +1 -0
index c410d12..54760b9 100644
@@ -7,6 +7,7 @@ source "boot/barebox/Config.in"
 source "boot/boot-wrapper-aarch64/Config.in"
 source "boot/grub/Config.in"
 source "boot/grub2/Config.in"
+source "boot/gummiboot/Config.in"
 source "boot/lpc32xxcdl/Config.in"
 source "boot/mxs-bootlets/Config.in"
 source "boot/syslinux/Config.in"
boot/gummiboot/Config.in new file +28 -0
new file mode 100644
index 0000000..8d70680
@@ -0,0 +1,28 @@
+config BR2_TARGET_GUMMIBOOT
+	bool "gummiboot"
+	depends on BR2_i386 || BR2_x86_64
+	select BR2_PACKAGE_GNU_EFI
+	select BR2_PACKAGE_UTIL_LINUX
+	select BR2_PACKAGE_UTIL_LINUX_LIBBLKID
+	depends on BR2_LARGEFILE # util-linux
+	depends on BR2_USE_WCHAR # util-linux
+	help
+	  gummiboot is a simple UEFI boot manager which executes
+	  configured EFI images. The default entry is selected by a
+	  configured pattern (glob) or an on-screen menu.
+
+	  gummiboot operates on the EFI System Partition (ESP)
+	  only. Configuration file fragments, kernels, initrds, other
+	  EFI images need to reside on the ESP. Linux kernels need to
+	  be built with CONFIG_EFI_STUB to be able to be directly
+	  executed as an EFI image.
+
+	  See the Grub2 help text for details on preparing an EFI
+	  capable disk image using Gummiboot: the instructions are
+	  exactly the same, except that the Gummiboot configuration
+	  files will be located in /loader/ inside the EFI partition.
+
+	  http://freedesktop.org/wiki/Software/gummiboot/
+
+comment "gummiboot needs a toolchain w/ largefile, wchar"
+	depends on !(BR2_LARGEFILE && BR2_USE_WCHAR)
boot/gummiboot/buildroot.conf new file +4 -0
new file mode 100644
index 0000000..8a6f02e
@@ -0,0 +1,4 @@
+title	Buildroot
+version	1
+linux	/bzImage
+options	console=ttyS0 root=/dev/sda2
boot/gummiboot/gummiboot.mk new file +42 -0

42 lines not on this page · raw message

boot/gummiboot/loader.conf new file +2 -0
new file mode 100644
index 0000000..93b77b8
@@ -0,0 +1,2 @@
+timeout 3
+default buildroot
Signature · 1 line
1.8.3.2
#7 lore raw

PATCH v3 4/5 board: add support for the MinnowBoard

In reply to Thomas Petazzoni
---
 board/minnowboard/grub.cfg         |   6 ++
 board/minnowboard/linux-3.8.config | 172 +++++++++++++++++++++++++++++++++++++
 board/minnowboard/post-build.sh    |   2 +
 board/minnowboard/readme.txt       |  40 +++++++++
 configs/minnowboard_defconfig      |  23 +++++
 5 files changed, 243 insertions(+)
 create mode 100644 board/minnowboard/grub.cfg
 create mode 100644 board/minnowboard/linux-3.8.config
 create mode 100755 board/minnowboard/post-build.sh
 create mode 100644 board/minnowboard/readme.txt
 create mode 100644 configs/minnowboard_defconfig
board/minnowboard/grub.cfg new file +6 -0
new file mode 100644
index 0000000..33a0f4a
@@ -0,0 +1,6 @@
+set default="0"
+set timeout="5"
+
+menuentry "Buildroot" {
+	linux /bzImage root=/dev/mmcblk0p2 rootwait console=ttyPCH0,115200
+}
board/minnowboard/linux-3.8.config new file +172 -0

172 lines not on this page · raw message

board/minnowboard/post-build.sh new file +2 -0
new file mode 100755
index 0000000..e3f4a92
@@ -0,0 +1,2 @@
+#!/bin/sh
+cp board/minnowboard/grub.cfg ${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg
board/minnowboard/readme.txt new file +40 -0
new file mode 100644
index 0000000..b62b677
@@ -0,0 +1,40 @@
+Prepare the SD card for the Minnow Board
+========================================
+
+ 1. Partition the SD card with a GPT partition table
+
+    sudo cgdisk /dev/mmcblk0
+
+    Create two partitions:
+
+     a) First partition of a few dozens of megabytes, which will be
+        used to store the bootloader and the kernel image. Type must
+        be EF00 (EFI partition).
+
+     b) Second partition of any size, which will be used to store the
+        root filesystem. Type must be 8300 (Linux filesystem)
+
+ 2. Prepare the boot partition
+
+    We will format it, mount it, copy the EFI data generated by
+    Buildroot, and the kernel image.
+
+    sudo mkfs.vfat -F 32 -n boot /dev/mmcblk0p1
+    sudo mount /dev/mmcblk0p1 /mnt
+    sudo cp -a output/images/efi-part/* /mnt/
+    sudo cp output/images/bzImage /mnt/
+    sudo umount /mnt
+
+ 3. Prepare the root partition
+
+    We will format it, mount it, and extract the root filesystem.
+
+    sudo mkfs.ext3 -L root /dev/mmcblk0p2
+    sudo mount /dev/mmcblk0p2 /mnt
+    sudo tar -C /mnt -xf output/images/rootfs.tar
+    sudo umount /mnt
+
+ 4. Enjoy
+
+Additional informations about this board can be found at
+http://www.minnowboard.org/.
configs/minnowboard_defconfig new file +23 -0
new file mode 100644
index 0000000..5fdfd43
@@ -0,0 +1,23 @@
+# Architecture
+BR2_x86_64=y
+BR2_x86_atom=y
+
+# Misc
+BR2_TARGET_GENERIC_GETTY_PORT="ttyPCH0"
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/minnowboard/post-build.sh"
+
+# Lock to 3.8 headers
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="3.8"
+
+# Linux kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="git://git.yoctoproject.org/linux-yocto-3.8"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="ba1587b9b62c801d161897303aa6d22809485f9b"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/minnowboard/linux-3.8.config"
+
+# Bootloader
+BR2_TARGET_GRUB2=y
+BR2_TARGET_GRUB2_I386_EFI=y
Signature · 1 line
1.8.3.2
#9 lore raw

PATCH v3 5/5 board: add support for the Fri2 board

In reply to Thomas Petazzoni
---
 board/fri2/grub.cfg         |   6 +
 board/fri2/linux-3.8.config | 336 ++++++++++++++++++++++++++++++++++++++++++++
 board/fri2/post-build.sh    |   2 +
 board/fri2/readme.txt       |  40 ++++++
 configs/fri2_defconfig      |  23 +++
 5 files changed, 407 insertions(+)
 create mode 100644 board/fri2/grub.cfg
 create mode 100644 board/fri2/linux-3.8.config
 create mode 100755 board/fri2/post-build.sh
 create mode 100644 board/fri2/readme.txt
 create mode 100644 configs/fri2_defconfig
board/fri2/grub.cfg new file +6 -0
new file mode 100644
index 0000000..f762714
@@ -0,0 +1,6 @@
+set default="0"
+set timeout="5"
+
+menuentry "Buildroot" {
+	linux /bzImage root=/dev/mmcblk0p2 rootwait console=ttyPCH1,115200
+}
board/fri2/linux-3.8.config new file +336 -0

336 lines not on this page · raw message

board/fri2/post-build.sh new file +2 -0
new file mode 100755
index 0000000..02b103a
@@ -0,0 +1,2 @@
+#!/bin/sh
+cp board/fri2/grub.cfg ${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg
board/fri2/readme.txt new file +40 -0
new file mode 100644
index 0000000..9174081
@@ -0,0 +1,40 @@
+Prepare the SD card for the FRI2 Board
+======================================
+
+ 1. Partition the SD card with a GPT partition table
+
+    sudo cgdisk /dev/mmcblk0
+
+    Create two partitions:
+
+     a) First partition of a few dozens of megabytes, which will be
+        used to store the bootloader and the kernel image. Type must
+        be EF00 (EFI partition).
+
+     b) Second partition of any size, which will be used to store the
+        root filesystem. Type must be 8300 (Linux filesystem)
+
+ 2. Prepare the boot partition
+
+    We will format it, mount it, copy the EFI data generated by
+    Buildroot, and the kernel image.
+
+    sudo mkfs.vfat -F 32 -n boot /dev/mmcblk0p1
+    sudo mount /dev/mmcblk0p1 /mnt
+    sudo cp -a output/images/efi-part/* /mnt/
+    sudo cp output/images/bzImage /mnt/
+    sudo umount /mnt
+
+ 3. Prepare the root partition
+
+    We will format it, mount it, and extract the root filesystem.
+
+    sudo mkfs.ext3 -L root /dev/mmcblk0p2
+    sudo mount /dev/mmcblk0p2 /mnt
+    sudo tar -C /mnt -xf output/images/rootfs.tar
+    sudo umount /mnt
+
+ 4. Enjoy
+
+Additional informations about this board can be found at
+http://us.kontron.com/products/systems+and+platforms/m2m/m2m+smart+services+developer+kit.html.
configs/fri2_defconfig new file +23 -0
new file mode 100644
index 0000000..a7e22c7
@@ -0,0 +1,23 @@
+# Architecture
+BR2_x86_64=y
+BR2_x86_atom=y
+
+# Misc
+BR2_TARGET_GENERIC_GETTY_PORT="ttyPCH1"
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/fri2/post-build.sh"
+
+# Lock to 3.8 headers
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="3.8"
+
+# Linux kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="git://git.yoctoproject.org/linux-yocto-3.8"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="f20047520a57322f05d95a18a5fbd082fb15cb87"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/fri2/linux-3.8.config"
+
+# Bootloader
+BR2_TARGET_GRUB2=y
+BR2_TARGET_GRUB2_I386_EFI=y
Signature · 1 line
1.8.3.2
#10 lore raw

PATCH v3 5/5 board: add support for the Fri2 board

Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

---
 board/fri2/grub.cfg         |   6 +
 board/fri2/linux-3.8.config | 336 ++++++++++++++++++++++++++++++++++++++++++++
 board/fri2/post-build.sh    |   2 +
 board/fri2/readme.txt       |  40 ++++++
 configs/fri2_defconfig      |  23 +++

Like we discussed on IRC, it isn't really clear to me if this should be called fri2 or kontron_m2m (or similar).

Perhaps linking to
https://www.yoctoproject.org/product/fish-river-island-2-board would also be helpful.

Any opinions?

Signature · 1 line
Bye, Peter Korsgaard