Merge pull request #458 from andrejro/for-upstream-bootengine-grub

Support for arm64 target ramdisk and arm64 grub modules
This commit is contained in:
Michael Marineau 2015-09-16 10:31:42 -07:00
commit 28a4f807e4
5 changed files with 61 additions and 2 deletions

View File

@ -361,7 +361,11 @@ finish_image() {
# This script must mount the ESP partition differently, so run it after unmount
if [[ "${install_grub}" -eq 1 ]]; then
local target
for target in i386-pc x86_64-efi x86_64-xen; do
local target_list="i386-pc x86_64-efi x86_64-xen"
if [[ ${BOARD} == "arm64-usr" ]]; then
target_list="arm64-efi"
fi
for target in ${target_list}; do
if [[ "${PROD_IMAGE}" -eq 1 && ${FLAGS_enable_verity} -eq ${FLAGS_TRUE} ]]; then
${BUILD_LIBRARY_DIR}/grub_install.sh \
--target="${target}" --disk_image="${disk_img}" --verity

View File

@ -53,7 +53,11 @@ if [ -z "$linux_console" ]; then
terminal_input console serial_com0
terminal_output console serial_com0
elif [ "$grub_platform" = efi ]; then
if [ "$grub_cpu" = arm64 ]; then
set linux_console="console=ttyAMA0,115200n8"
else
set linux_console="console=ttyS0,115200n8 console=tty0"
fi
elif [ "$grub_platform" = xen ]; then
set linux_console="console=hvc0"
fi
@ -66,6 +70,11 @@ else
set suf=""
fi
# Use standard linux command for arm64
if [ "$grub_cpu" = arm64 ]; then
set suf=""
fi
menuentry "CoreOS default" --id=coreos {
gptprio.next -d usr -u usr_uuid
if [ "$usr_uuid" = "7130c94a-213a-4e5a-8e26-6cce9662f132" ]; then

View File

@ -49,6 +49,10 @@ case "${FLAGS_target}" in
x86_64-xen)
CORE_NAME="core.elf"
;;
arm64-efi)
CORE_MODULES+=( serial efi_gop )
CORE_NAME="core-arm64.efi"
;;
*)
die_notrace "Unknown GRUB target ${FLAGS_target}"
;;
@ -192,6 +196,13 @@ case "${FLAGS_target}" in
sudo cp "${BUILD_LIBRARY_DIR}/menu.lst" \
"${ESP_DIR}/boot/grub/menu.lst"
;;
arm64-efi)
info "Installing default arm64 UEFI bootloader."
sudo mkdir -p "${ESP_DIR}/EFI/boot"
#FIXME(andrejro): shim not ported to aarch64
sudo cp "${ESP_DIR}/${GRUB_DIR}/${CORE_NAME}" \
"${ESP_DIR}/EFI/boot/bootaa64.efi"
;;
esac
cleanup

View File

@ -222,6 +222,8 @@ break_dep_loop sys-apps/util-linux udev,systemd sys-apps/systemd cryptsetup
break_dep_loop sys-apps/systemd cryptsetup
info "Merging board packages now"
# The following line is required by chroots present in "update-bootengine"
setup_qemu_static "${BOARD_ROOT}"
sudo -E "${EMERGE_CMD[@]}" "${EMERGE_FLAGS[@]}" \
@system coreos-devel/board-packages

View File

@ -992,3 +992,36 @@ BOAT
echo -e "${V_VIDOFF}"
die "$* failed"
}
# The binfmt_misc support in the kernel is required.
# The aarch64 binaries should be executed through
# "/usr/bin/qemu-aarch64-static"
setup_qemu_static() {
local root_fs_dir="$1"
case "${BOARD}" in
amd64-usr) return 0;;
arm64-usr)
if [[ -f "${root_fs_dir}/sbin/ldconfig" ]]; then
sudo cp /usr/bin/qemu-aarch64 "${root_fs_dir}"/usr/bin/qemu-aarch64-static
else
die "Missing basic layout in target rootfs"
fi
;;
*) die "Unsupported arch" ;;
esac
}
clean_qemu_static() {
local root_fs_dir="$1"
case "${BOARD}" in
amd64-usr) return 0;;
arm64-usr)
if [[ -f "${root_fs_dir}/usr/bin/qemu-aarch64-static" ]]; then
sudo rm "${root_fs_dir}"/usr/bin/qemu-aarch64-static
else
die "File not found"
fi
;;
*) die "Unsupported arch" ;;
esac
}