Skip to contentSkip to conversation

configs/pc_x86_64_{bios, efi}_defconfig: new samples

PATCH New Gustavo Zacarias 2 participants 2 messages Apr 29, 2016 – Jun 3, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configs/pc_x86_64_{bios, efi}_defconfig: new samples

Add two new sample defconfigs oriented towards real PC targets.

It adds two variants for BIOS and EFI boot strategy.

On the build side we enable eudev to autoload relevant kernel modules/support when necessary.

It adds a bunch of drivers and extra filesystem support which is by no means extensive/complete, mostly geared towards the hardware i've got at hand to test with.
This is accomplished by adding on top of the Qemu x86_64 kernel sample config.

Build connman since by using eudev network interfaces get renamed on boot thus complicating any form of automatic and friendly bringup. It also makes Wi-Fi configuration/support easier.

In principle these base defconfigs should work just fine for other storage media != pendrive like sata or ssd disk, however driver support isn't there quite yet, and pendrive is mostly supported by usb storage plus the usual usb host controller drivers.

Tested on old Lenovo laptop (BIOS) and Asus Zenbook (EFI).

---
 board/pc/genimage-bios.cfg       | 24 +++++++++++++++
 board/pc/genimage-efi.cfg        | 31 +++++++++++++++++++
 board/pc/linux-extras.config     | 42 ++++++++++++++++++++++++++
 board/pc/post-image.sh           | 35 ++++++++++++++++++++++
 board/pc/readme.txt              | 35 ++++++++++++++++++++++
 configs/pc_x86_64_bios_defconfig | 62 ++++++++++++++++++++++++++++++++++++++
 configs/pc_x86_64_efi_defconfig  | 65 ++++++++++++++++++++++++++++++++++++++++
 7 files changed, 294 insertions(+)
 create mode 100644 board/pc/genimage-bios.cfg
 create mode 100644 board/pc/genimage-efi.cfg
 create mode 100644 board/pc/linux-extras.config
 create mode 100755 board/pc/post-image.sh
 create mode 100644 board/pc/readme.txt
 create mode 100644 configs/pc_x86_64_bios_defconfig
 create mode 100644 configs/pc_x86_64_efi_defconfig
board/pc/genimage-bios.cfg new file +24 -0
new file mode 100644
index 0000000..c669499
@@ -0,0 +1,24 @@
+image disk.img {
+
+  hdimage {
+  }
+
+  partition boot {
+    in-partition-table = "no"
+    image = "boot.img"
+    offset = 0
+    size = 512
+  }
+
+  partition grub {
+    in-partition-table = "no"
+    image = "grub.img"
+    offset = 512
+  }
+
+  partition root {
+    partition-type = 0x83
+    image = "rootfs.ext2"
+  }
+
+}
board/pc/genimage-efi.cfg new file +31 -0
new file mode 100644
index 0000000..ec96d73
@@ -0,0 +1,31 @@
+image efi-part.vfat {
+  vfat {
+    file startup.nsh {
+      image = "efi-part/startup.nsh"
+    }
+    file EFI {
+      image = "efi-part/EFI"
+    }
+    file bzImage {
+      image = "bzImage"
+    }
+  }
+  size = 16M
+}
+
+image disk.img {
+
+  hdimage {
+  }
+
+  partition boot {
+    partition-type = 0xEF
+    image = "efi-part.vfat"
+  }
+
+  partition root {
+    partition-type = 0x83
+    image = "rootfs.ext2"
+  }
+
+}
board/pc/linux-extras.config new file +42 -0

42 lines not on this page · raw message

board/pc/post-image.sh new file +35 -0
new file mode 100755
index 0000000..3b51409
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# Detect boot strategy, EFI or BIOS
+if [ -f ${BINARIES_DIR}/efi-part/startup.nsh ]; then
+  BOOT_TYPE=efi
+  # grub.cfg needs customization for EFI since the root partition is
+  # number 2, and bzImage is in the EFI partition (1)
+  cat >${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg <<__EOF__
+set default="0"
+set timeout="5"
+
+menuentry "Buildroot" {
+	linux /bzImage root=/dev/sda2 rootwait console=tty1
+}
+__EOF__
+else
+  BOOT_TYPE=bios
+  # Copy grub 1st stage to binaries, required for genimage
+  cp -f ${HOST_DIR}/usr/lib/grub/i386-pc/boot.img ${BINARIES_DIR}
+fi
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage-${BOOT_TYPE}.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                           \
+       --rootpath "${TARGET_DIR}"     \
+       --tmppath "${GENIMAGE_TMP}"    \
+       --inputpath "${BINARIES_DIR}"  \
+       --outputpath "${BINARIES_DIR}" \
+       --config "${GENIMAGE_CFG}"
+
+exit $?
board/pc/readme.txt new file +35 -0
new file mode 100644
index 0000000..970e8a6
@@ -0,0 +1,35 @@
+Bare PC sample config
+=====================
+
+1. Build
+
+  First select the appropiate target you want.
+  For BIOS-based boot strategy:
+
+  $ make pc_x86_64_bios_defconfig
+
+  Or for EFI:
+
+  $ make pc_x86_64_efi_defconfig
+
+  Add any additional packages required and build:
+
+  $ make
+
+2. Write the pendrive
+
+  The build process will create a pendrive image in output/images.
+  Write the image to a pendrive:
+
+  $ dd if=output/images/sdcard.img of=/dev/sdc; sync
+
+  Once it's done insert it into the target PC and boot.
+
+  Remember that if said PC has another boot device you might need to
+  select this alternative for it to boot.
+
+  In the case of EFI boot you might need to disable Secure Boot from
+  the setup as well.
+
+3. Enjoy
+
configs/pc_x86_64_bios_defconfig new file +62 -0

62 lines not on this page · raw message

configs/pc_x86_64_efi_defconfig new file +65 -0

65 lines not on this page · raw message

Signature · 1 line
2.7.3
#1 lore raw

PATCH 1/1 configs/pc_x86_64_{bios, efi}_defconfig: new samples

Hello,

Quoted 1 line · Gustavo Zacarias

+ First select the appropiate target you want.

Minor typo: appropriate.

I've fixed this and did some minor other tweaks in readme.txt, and then applied.

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com