configs/pc: refactor to use genimage and grub.cfg
authorErico Nunes <nunes.erico@gmail.com>
Sun, 22 Oct 2017 13:54:24 +0000 (15:54 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 22 Oct 2017 14:27:53 +0000 (16:27 +0200)
This simplifies the pc configs and respective post image scripts to use
the shared genimage script and separate grub config files.
Separate grub files are cleaner to maintain and easier to copy and
modify, for example to support booting the pc defconfigs in qemu.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
board/pc/grub-bios.cfg [new file with mode: 0644]
board/pc/grub-efi.cfg [new file with mode: 0755]
board/pc/post-image.sh
configs/pc_x86_64_bios_defconfig
configs/pc_x86_64_efi_defconfig

diff --git a/board/pc/grub-bios.cfg b/board/pc/grub-bios.cfg
new file mode 100644 (file)
index 0000000..bd3e3f0
--- /dev/null
@@ -0,0 +1,6 @@
+set default="0"
+set timeout="5"
+
+menuentry "Buildroot" {
+       linux /boot/bzImage root=/dev/sda1 rootwait console=tty1
+}
diff --git a/board/pc/grub-efi.cfg b/board/pc/grub-efi.cfg
new file mode 100755 (executable)
index 0000000..222301a
--- /dev/null
@@ -0,0 +1,6 @@
+set default="0"
+set timeout="5"
+
+menuentry "Buildroot" {
+       linux /bzImage root=/dev/sda2 rootwait console=tty1
+}
index c88ecb1dc24f5dfe174ad670c4fd169f330430a7..bdd0847ec5b14b397fa61344197ab524acf81671 100755 (executable)
@@ -1,35 +1,14 @@
 #!/bin/sh
 
+BOARD_DIR="$(dirname $0)"
+
 # 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__
+  cp -f ${BOARD_DIR}/grub-efi.cfg ${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg
 else
-  BOOT_TYPE=bios
+  cp -f ${BOARD_DIR}/grub-bios.cfg ${TARGET_DIR}/boot/grub/grub.cfg
   # Copy grub 1st stage to binaries, required for genimage
   cp -f ${HOST_DIR}/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 $?
index ddbd776154a3212af253c703ab6ab3e6df553029..47787bc11880da2d42601de9d83ef7826e9b71a6 100644 (file)
@@ -19,7 +19,8 @@ BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
 BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
 # BR2_TARGET_ROOTFS_TAR is not set
-BR2_ROOTFS_POST_IMAGE_SCRIPT="board/pc/post-image.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/pc/post-image.sh support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/pc/genimage-bios.cfg"
 
 # Linux headers same as kernel, a 4.13 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_13=y
index 94385252b9940475df8c42e9f7f7772f7f93c249..67ba5bcf5b9ed647e817d5abd0d275eac9962411 100644 (file)
@@ -22,7 +22,8 @@ BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
 BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
 # BR2_TARGET_ROOTFS_TAR is not set
-BR2_ROOTFS_POST_IMAGE_SCRIPT="board/pc/post-image.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/pc/post-image.sh support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/pc/genimage-efi.cfg"
 
 # Linux headers same as kernel, a 4.13 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_13=y