gnu-efi Hello World

gnu-efi Hello World

# AARCH64(ARM64)

# クロスコンパイラ環境を整える

  • Docker fileを作る
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
FROM ubuntu:18.04

RUN apt-get update && \
    apt-get upgrade -y && \
    DEBIAN_FRONTEND=noninteractive \
    apt-get install -y \
    qemu-utils \
    qemu-efi-aarch64 \
    qemu-system-arm \
    build-essential \
    uuid-dev \
    git \
    python \
    iasl \
    nasm && \
    DEBIAN_FRONTEND=noninteractive \
    apt-get install -y \
    crossbuild-essential-armhf

WORKDIR /workdir
RUN git clone --recursive https://github.com/naoki9911/xv6_uefi.git
  • docker build -t xv6-uefi . してdocker images

  • mkdir buildでディレクトリを作って

  • docker run --rm -it --name xv6 -v $PWD/build:/tmp/build xv6-uefi bash

  • docker内で

    • cd edk2edk2に移動し
    • make -C BaseTools
    • source edksetup.sh
    • export GCC5_ARM_PREFIX=arm-linux-gnueabihf-
    • build -a ARM -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
    • これでQEMU_EFI.fdを作成

    # gnu-efiをbuild

    • gnu-efiをダウンロード(ver3.0.12) https://sourceforge.net/projects/gnu-efi/files/?source=navbar
    • cd gnu-efi-3.0.12
    • make CROSS_COMPILE=arm-linux-gnueabihf-
    • appsをbuild
    • make CROSS_COMPILE=arm-linux-gnueabihf- apps
    • cp -r arm /tmp/build

# 起動

  • dockerから抜けて
  • cd buildで移動して
  • QEMUで起動
  • qemu-system-arm -m 128 -M virt -bios ./QEMU_EFI.fd -serial stdio -hda fat:rw:arm/apps
  • qemuのshellでfs0:でデバイスに移動して
  • t.efiでHelloWorldが出力
Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy