{"id":15694123,"url":"https://github.com/rgl/raspberrypi-uefi-edk2-vagrant","last_synced_at":"2026-04-01T18:23:51.202Z","repository":{"id":46042079,"uuid":"251133732","full_name":"rgl/raspberrypi-uefi-edk2-vagrant","owner":"rgl","description":"Raspberry Pi 4 UEFI EDK2 build environment inside a vagrant box","archived":false,"fork":false,"pushed_at":"2021-11-18T07:32:49.000Z","size":71,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-23T18:03:07.174Z","etag":null,"topics":["edk","ipxe","raspberry-pi","raspberry-pi-4","uefi","uefi-boot"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rgl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-29T21:01:40.000Z","updated_at":"2025-05-15T02:45:33.000Z","dependencies_parsed_at":"2022-09-02T17:01:18.378Z","dependency_job_id":null,"html_url":"https://github.com/rgl/raspberrypi-uefi-edk2-vagrant","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rgl/raspberrypi-uefi-edk2-vagrant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fraspberrypi-uefi-edk2-vagrant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fraspberrypi-uefi-edk2-vagrant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fraspberrypi-uefi-edk2-vagrant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fraspberrypi-uefi-edk2-vagrant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rgl","download_url":"https://codeload.github.com/rgl/raspberrypi-uefi-edk2-vagrant/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fraspberrypi-uefi-edk2-vagrant/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31018542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-27T03:51:26.850Z","status":"ssl_error","status_checked_at":"2026-03-27T03:51:09.693Z","response_time":164,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["edk","ipxe","raspberry-pi","raspberry-pi-4","uefi","uefi-boot"],"created_at":"2024-10-03T18:52:47.763Z","updated_at":"2026-03-27T04:01:53.135Z","avatar_url":"https://github.com/rgl.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\n\nThis is a [Vagrant](https://www.vagrantup.com/) Environment for a setting up\nthe [Raspberry Pi 4 UEFI EDK2](https://github.com/pftf/RPi4) environment.\n\n## Usage\n\nInstall the [base Ubuntu 20.04 box](https://github.com/rgl/ubuntu-vagrant).\n\nStart the environment:\n\n```bash\ntime vagrant up --no-destroy-on-error\n```\n\nThen [flash the sd-card](#sd-card-flashing).\n\nThen copy the generated files to the sd-card overriding the existing ones:\n\n```bash\ntarget=/media/$USER/RPI4-UEFI\ninstall tmp/RPI_EFI.fd $target\ninstall tmp/Shell.efi $target\ninstall tmp/UiApp.efi $target\ninstall -d $target/efi/boot\ninstall tmp/ipxe.efi $target/efi/boot/bootaa64.efi\n```\n\nAfter it boots, you want to execute `startup.nsh` to configure the Pi.\n\nYou can do it either from the UEFI or iPXE shell.\n\nFrom the UEFI shell:\n\n```\nfs0:\nstartup.sh\nexit\n```\n\nFrom the iPXE shell:\n\n```\nchain --autofree file:///Shell.efi -nostartup\nfs1:\nstartup.sh\nexit\nexit\n```\n\n## Switching sub-modules repositories/branches\n\nYou can switch to a different sub-module repository/branch. For example,\nto switch the `edk2-platforms` submodule do:\n\n```bash\ngit submodule foreach --recursive 'git branch -v'\ngit submodule foreach --recursive 'git status'\ngit config --file=.gitmodules submodule.edk2-platforms.url https://github.com/samerhaj/edk2-platforms.git\ngit config --file=.gitmodules submodule.edk2-platforms.branch ASIX_USB_Networking\ngit submodule sync edk2-platforms\ngit submodule update --init --recursive --remote edk2-platforms\ngit submodule foreach --recursive 'git branch -v'   # you should check if it has the expected commit id.\ngit submodule foreach --recursive 'git status'      # it should say: nothing to commit, working tree clean.\n```\n\nClean and build:\n\n```bash\nrm -rf Build\n# NB after a successful build Build/RPi4/RELEASE_GCC5/FV/RPI_EFI.fd is\n#    automatically copied to the host as /vagrant/tmp/RPI_EFI.fd.\ntime ./rpi4-uefi-build-release.sh\n```\n\n## iPXE\n\nBuild `ipxe.efi` (with the [rpi.ipxe](rpi.ipxe) embedded script):\n\n```bash\nvagrant ssh\n\n# NB after a successful build ~/ipxe/src/bin-arm64-efi/ipxe.efi is\n#    copied to the host as /vagrant/tmp/ipxe.efi.\ntime bash /vagrant/build-ipxe.sh\n\n# return to the host shell.\nexit\n```\n\nThere are two ways to use iPXE:\n\n1. Use it as the default UEFI boot application.\n2. Configure UEFI to load it from an HTTP endpoint.\n\nTo use it as the default UEFI boot application, the file has to be\ninstalled at `efi/boot/bootaa64.efi`:\n\n```bash\ninstall -d /media/$USER/RPI4-UEFI/efi/boot\ninstall tmp/ipxe.efi /media/$USER/RPI4-UEFI/efi/boot/bootaa64.efi\n```\n\nTo configure UEFI to load it from an HTTP endpoint, you need to\nstart an HTTP 1.1 server to serve `ipxe.efi`:\n\n```bash\nwget -O- https://github.com/caddyserver/caddy/releases/download/v2.4.1/caddy_2.4.1_linux_amd64.tar.gz | tar xzf - caddy\n./caddy file-server --root tmp --listen :8000 --browse --access-log\n```\n\n**NB** We cannot simply use `python3 -m http.server 8000 -d tmp` because the\nEDK2 HTTP client [assumes its talking to a HTTP/1.1 web server](https://bugzilla.tianocore.org/show_bug.cgi?id=2720),\nbut by default, the python server is configured in HTTP 1.0 mode.\n\nThen power on the Raspberry Pi.\n\nAfter it shows the UEFI boot prompt, press `ESC` to enter the EDK2 Setup,\nthen:\n\n1. Select `Device Manager` and press `ENTER`.\n2. Select `Network Device List` and press `ENTER`.\n3. Select your network interface, e.g., `MAC:DC:A6:32:27:F5:46`, and\n   press `ENTER`.\n4. Select `HTTP Boot Configuration` and press `ENTER`.\n5. Select `Boot URI` and press `ENTER`, then input the `ipxe.efi` url made\n   available by the http server, e.g., `http://192.168.1.1:8000/ipxe.efi`,\n   and press `ENTER`.\n6. Press `F10` to save the changes.\n7. Keep pressing `ESC` until you reach the main setup menu.\n8. Select `Boot Manager`.\n9. Select the entry created in 5 and press `ENTER`.\n\nThe Pi should download and start the `ipxe.efi` application.\n\n## EDK2 Notes\n\n* The build is described by the `edk2-platforms/Platform/RaspberryPi/RPi4/RPi4.dsc` file.\n* A component/module is only built when the `.dsc` file references the `.inf` file, e.g.:\n  the `.dsc` has something alike:\n    ```ini\n    [Components.common]\n        # ...\n        Drivers/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88179/Ax88179.inf\n    ```\n* A component/module is only included in the firmware image when the\n  `edk2-platforms/Platform/RaspberryPi/RPi4/RPi4.fdf` file references the `.inf` file,\n  e.g.: the `.fdf` file has something alike:\n    ```ini\n    [FV.FvMain]\n        # ...\n        INF Drivers/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88179/Ax88179.inf\n    ```\n\n## Serial Console\n\nRaspberry Pi 4B has two serial ports:\n\n* PL011 UART (aka UART0/ttyAMA0)\n* mini UART (aka UART1/ttyS0)\n\nThe `config.txt` file configures which of them is assigned to the\nserial console GPIO pins 14 (TX) and 15 (RX).\n\nThe default configuration of the Raspberry Pi 4 UEFI EDK2 firmware\nconfigures the serial console to use PL011 UART with:\n\n```conf\nenable_uart=1\nuart_2ndstage=1\ndtoverlay=miniuart-bt\n```\n\nFor more information see:\n\n* [Raspberry Pi Serial Console / UART](https://www.raspberrypi.org/documentation/configuration/uart.md)\n* [miniuart-bt documentation](https://github.com/raspberrypi/firmware/blob/dd8cbec5a6d27090e5eb080e13d83c35fdd759f7/boot/overlays/README#L1691-L1702)\n\nTo access the serial console from your PC you normally use a\nUSB-to-SERIAL cable (3.3v). For example, the [adafruit cable](https://www.adafruit.com/product/954),\nhas four colored wires, which [must be connected as](https://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable/connect-the-lead):\n\n| cable wire function | cable wire color | RPi GPIO      |\n|---------------------|------------------|---------------|\n| GND                 | black            | GND           |\n| RX                  | white            | GPIO 14 / TX  |\n| TX                  | green            | GPIO 15 / RX  |\n| 5v                  | red              | NOT CONNECTED |\n\nThen, in your PC, you can connect to the serial console with picocom:\n\n```bash\nsudo apt-get install -y picocom\n# NB to quit picocom type Ctrl+A Ctrl+X.\n# NB to use ESC key you have to press it once and wait a bit or\n#    you need to press it twice.\n# NB to send the F10 key you must prevent your terminal emulator\n#    from using that key. in gnome, select the Edit menu,\n#    Preferences, General tab and then unselect the Enable the\n#    menu accelerator key option.\nsudo picocom --baud 115200 /dev/ttyUSB0\n```\n\nOr, if you prefer, with minicom:\n\n```bash\nsudo apt-get install -y minicom\nsudo tee /etc/minicom/minirc.rpi \u003e/dev/null \u003c\u003c'EOF'\n# NB use \"minicom -s rpi\" to change these default parameters.\npu port       /dev/ttyUSB0\npu baudrate   115200\npu bits       8\npu parity     N\npu stopbits   1\npu hasdcd     No    # disable DCD line detection.\npu rtscts     No    # disable hardware flow control.\npu xonxoff    No    # disable software flow control.\npu histlines  5000\nEOF\n# NB to quit minicom type Ctrl+A Q.\n# NB minicom will say its offline when the usb-to-serial adaptor\n#    does not support the Data Carrier Detect (DCD) line, and\n#    even if it would, the RPi serial console pins do not have\n#    support for it. so just ignore the offline message or change\n#    the status line with the -F or --statlinefmt argument.\n# NB to use ESC key you have to press it once and wait a bit or\n#    you need to press it twice.\n# NB to send the F10 key you must prevent your terminal emulator\n#    from using that key. in gnome, select the Edit menu,\n#    Preferences, General tab and then unselect the Enable the\n#    menu accelerator key option.\n# NB you can use --device=/dev/ttyUSBX to override the value\n#    from minirc.rpi.\nsudo minicom --color=on rpi\n```\n\n## sd-card flashing\n\nFind which device was allocated for the sd-card that will store the uefi firmware:\n\n```bash\nlsblk -o KNAME,SIZE,TRAN,FSTYPE,UUID,LABEL,MODEL,SERIAL\n# lsblk should output all the plugged block devices, in my case, this is the device that I'm interested in:\n#\n#   sde    28,9G usb                                                                STORAGE DEVICE   000000078\n#   sde1    256M        vfat   9F2D-0578                            boot\n#   sde2    6,1G        ext4   efc2ea8b-042f-47f5-953e-577d8860de55 rootfs\n```\n\nWipe the sd-card (in this example its at `/dev/sde`) and put the [pftf/RPi4 firmware](https://github.com/pftf/RPi4) in it:\n\n**NB** the rpi4 `recovery.bin` (which will end up inside the eeprom) bootloader only\nsupports booting from an MBR/MSDOS partition type/table/label and from a\nFAT32 LBA (0x0c) or FAT16 LBA (0x0e) partition types/filesystem. Eventually\n[it will support GPT](https://github.com/raspberrypi/rpi-eeprom/issues/126).\n\n**NB** the rpi4 bootloader that is inside the [mask rom](https://en.wikipedia.org/wiki/Mask_ROM) also [seems to support GPT](https://github.com/raspberrypi/rpi-eeprom/issues/126#issuecomment-628719223), but until its supported by `recovery.bin` we cannot use a GPT.\n\n```bash\n# switch to root.\nsudo -i\n\n# set the sd-card target device and mount point.\ntarget_device=/dev/sde\ntarget=/mnt/rpi4-uefi\n\n# umount any existing partition that you might have already mounted.\numount ${target_device}?\n\n# format the sd-card at $target_device.\nparted --script $target_device mklabel msdos\nparted --script $target_device mkpart primary fat32 4 100\nparted $target_device print\n# Model: Generic STORAGE DEVICE (scsi)\n# Disk /dev/sde: 31,0GB\n# Sector size (logical/physical): 512B/512B\n# Partition Table: msdos\n# Disk Flags:\n#\n# Number  Start   End     Size    Type     File system  Flags\n#  1      4194kB  2048MB  2044MB  primary  fat32        lba\nmkfs -t vfat -n RPI4-UEFI ${target_device}1\n\n# install the firmware in the sd-card.\nmkdir -p $target\nmount ${target_device}1 $target\n# get the rpi4 uefi firmware.\nwget https://github.com/pftf/RPi4/releases/download/v1.27/RPi4_UEFI_Firmware_v1.27.zip\nunzip RPi4_UEFI_Firmware_v1.27.zip -d $target\n# add the drivers for the AX88179 gigabit ethernet chip.\n# NB this is needed for my UGREEN USB 3.0 to RJ45 Ethernet Gigabit Lan Adapter.\n#    see https://www.ugreen.com/products/usb-3-0-to-rj45-gigabit-ethernet-adapter\n# NB this is needed because out-of-the-box edk2 only supports the chips at:\n#      https://github.com/tianocore/edk2-platforms/tree/master/Drivers/OptionRomPkg/Bus/Usb/UsbNetworking\n# See https://www.asix.com.tw/en/product/USBEthernet/Super-Speed_USB_Ethernet/AX88179\nunzip drivers/AX88179_178A_UEFI_V2.8.0_ARM_AARCH64.zip -d $target\n\n# setup the uefi shell to automatically load the driver.\n# NB press F1 at the raspberry pi boot logo to enter the uefi shell\n#    and automatically execute this startup.nsh script.\n# RPi4_UEFI_Firmware_v1.27.zip ver is:\n#       UEFI Interactive Shell v2.2\n#       EDK II\n#       UEFI v2.70 (https://github.com/pftf/RPi4, 0x00010000)\n# see https://github.com/pftf/RPi4/issues/13\n# see https://github.com/tianocore/tianocore.github.io/wiki/HTTP-Boot\n# see https://uefi.org/sites/default/files/resources/UEFI_Shell_Spec_2_0.pdf\ncat \u003e$target/startup.nsh \u003c\u003cEOF\n# set the terminal size.\nmode 80 50 # make the terminal a bit taller.\nmode       # show the available terminal modes.\n\n# show the UEFI versions.\nver\n\n# show the memory map.\nmemmap\n\n# show the disks and filesystems.\nmap\n\n# show the environment variables.\nset\n\n# show all UEFI variables.\n#dmpstore\n\n# show some rpi uefi variables.\n# show the RAM Limit to 3 GB int32 (little endian) variable.\n# possible values:\n#   00 00 00 00: do not limit the ram to 3GB.\n#   01 00 00 00: limit the ram to 3GB (default).\nsetvar -guid CD7CC258-31DB-22E6-9F22-63B0B8EED6B5 RamLimitTo3GB\n# show the System Table Selection int32 (little endian) variable.\n# possible values:\n#   00 00 00 00: ACPI (default).\n#   01 00 00 00: ACPI and DT.\n#   02 00 00 00: DT.\nsetvar -guid CD7CC258-31DB-22E6-9F22-63B0B8EED6B5 SystemTableMode\n# show the smbios asset tag string variable.\nsetvar -guid CD7CC258-31DB-22E6-9F22-63B0B8EED6B5 AssetTag\n\n# change to the first filesystem and show its contents.\nFS0:\ndir\n\n# load the network interface driver.\nload FS0:\\AX88179_178A_UEFI_V2.8.0_ARM_AARCH64\\AX88179_178A_UEFI_V2.8.0_AARCH64.efi\n\n# connect all the drivers to all the devices, recursively.\nconnect -r\n\n# configure the network interface to use DHCP.\nifconfig -l\nifconfig -s eth0 dhcp # NB this starts the DHCP request in background.\n# sleep 10s (10 followed by 6 zeros) and hope dhcp has worked.\n@echo \"waiting 10s to give dhcp time to come up...\"\nstall 10000000\nifconfig -l\n\n# test pinging a machine in my network.\nping -n 4 192.168.1.1\n\n# show more more information about drivers.\n# the \"drivers\" command displays all the drivers, the AX88179 is normally the last one:\n#               T   D\n#   D           Y C I\n#   R           P F A\n#   V  VERSION  E G G #D #C DRIVER NAME                        IMAGE NAME\n#   == ======== = = = == == ================================== ==========\n#   A3 0000000A B - -  1  1 ASIX AX88179 Ethernet Driver 2.8.0 \\AX88179_178A_UEFI_V2.8.0_AARCH64.efi\n#drivers\n#dh -d A3 -v # NB \"A3\" is the value of the first column \"DRV\".\n\n# you can edit file with edit.\n#edit FS0:\\startup.nsh\n\n# do not limit the ram to 3GB.\n# NB this only applies after you reboot the pi with the reset command.\nsetvar -guid CD7CC258-31DB-22E6-9F22-63B0B8EED6B5 -bs -rt -nv RamLimitTo3GB =0x00000000\nsetvar -guid CD7CC258-31DB-22E6-9F22-63B0B8EED6B5 RamLimitTo3GB # show\n\n# set the smbios asset tag.\n# NB this has a maximum of 32-characters.\nsetvar -guid CD7CC258-31DB-22E6-9F22-63B0B8EED6B5 -bs -rt -nv AssetTag =L\"PI00000001\" =0x0000\nsetvar -guid CD7CC258-31DB-22E6-9F22-63B0B8EED6B5 AssetTag # show\n\n@echo \"TIP: Press the Page-Up key to see the terminal history\"\nEOF\n\n# check the results.\nfind $target\n\n# eject the sd-card.\numount $target\neject $target_device\n\n# exit the root shell.\nexit\n```\n\nRemove the sd-card from the computer. \n\n## Reference\n\n* https://github.com/pftf/RPi4/blob/v1.27/.github/workflows/linux_edk2.yml\n* [UEFI Driver Writer's Guide](https://github.com/tianocore/tianocore.github.io/wiki/UEFI-Driver-Writer%27s-Guide)\n* https://en.opensuse.org/UEFI_HTTPBoot_Server_Setup\n  * https://patchwork.kernel.org/patch/9231147/\n* https://github.com/pftf/RPi4/issues/13\n* https://github.com/tianocore/tianocore.github.io/wiki/HTTP-Boot\n* https://github.com/tianocore/edk2-platforms/tree/master/Drivers/OptionRomPkg/Bus/Usb/UsbNetworking\n* https://github.com/tianocore/tianocore.github.io/wiki/ShellPkg\n* http://www.uefi.org/sites/default/files/resources/UEFI_Shell_2_2.pdf\n\n## Interesting projects\n\n* https://github.com/andreiw/UefiToolsPkg\n* https://github.com/bluebat/gnu-efi-applets\n* https://github.com/chipsec/chipsec\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fraspberrypi-uefi-edk2-vagrant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frgl%2Fraspberrypi-uefi-edk2-vagrant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fraspberrypi-uefi-edk2-vagrant/lists"}