aboutsummaryrefslogtreecommitdiff
path: root/board/pc/post-image.sh
blob: 3b51409c248720813e51380095f6ea7e92b8632b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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 $?