├── .dockerignore ├── .github └── workflows │ └── build.yml ├── .gitignore ├── .gitmodules ├── Dockerfile ├── Makefile ├── README.md ├── apply_patches.sh ├── autoexec.ipxe ├── config.txt ├── docker-compose.yml ├── edksetup.sh ├── example ├── boot.ipxe ├── cloud-init │ ├── meta-data │ ├── user-data │ └── vendor-data ├── dnsmasq.conf ├── docker-compose.yml └── tftpboot │ └── .gitignore ├── mtoolsrc └── patches └── edk2-platforms ├── 0001-RPi4-fix-serial-number.patch ├── 0002-RPi4-iPXE-driver.patch └── 0003-RPi4-fix-usb-on-recent-kernels.patch /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | edk2* 3 | ipxe 4 | firmware* 5 | pxe* 6 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*' 7 | 8 | jobs: 9 | build: 10 | name: Build 11 | runs-on: ubuntu-20.04 12 | steps: 13 | 14 | - name: Check out code 15 | uses: actions/checkout@v2 16 | 17 | - name: Install packages 18 | run: | 19 | sudo apt update 20 | sudo apt install -y -o Acquire::Retries=50 \ 21 | gcc-aarch64-linux-gnu iasl mtools subversion \ 22 | lzma-dev uuid-dev 23 | sudo ln -sf /bin/bash /bin/sh 24 | 25 | - name: Build everything 26 | run: | 27 | make -j8 28 | 29 | - name: Create release 30 | id: create_release 31 | uses: actions/create-release@v1 32 | env: 33 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 34 | with: 35 | tag_name: ${{ github.ref }} 36 | release_name: ${{ github.ref }} 37 | 38 | - name: Upload (tftpboot.zip) 39 | uses: actions/upload-release-asset@v1 40 | env: 41 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 42 | with: 43 | upload_url: ${{ steps.create_release.outputs.upload_url }} 44 | asset_name: tftpboot.zip 45 | asset_path: tftpboot.zip 46 | asset_content_type: application/zip 47 | 48 | - name: Upload (boot.img) 49 | uses: actions/upload-release-asset@v1 50 | env: 51 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 52 | with: 53 | upload_url: ${{ steps.create_release.outputs.upload_url }} 54 | asset_name: boot.img 55 | asset_path: boot.img 56 | asset_content_type: application/octet-stream 57 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Build/ 2 | firmware/ 3 | pxe* 4 | .env 5 | tftpboot.zip 6 | boot.img 7 | Drivers/Ipxe/Ipxe.efi 8 | .idea 9 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "edk2"] 2 | path = edk2 3 | url = https://github.com/tianocore/edk2.git 4 | [submodule "edk2-platforms"] 5 | path = edk2-platforms 6 | url = https://github.com/tianocore/edk2-platforms.git 7 | [submodule "edk2-non-osi"] 8 | path = edk2-non-osi 9 | url = https://github.com/tianocore/edk2-non-osi.git 10 | [submodule "ipxe"] 11 | path = ipxe 12 | url = https://github.com/ipxe/ipxe/ 13 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | RUN true \ 4 | && apt-get update \ 5 | && apt-get install -y software-properties-common \ 6 | && apt-add-repository universe \ 7 | && apt-get update \ 8 | && apt-get install -y -o Acquire::Retries=50 \ 9 | binutils \ 10 | build-essential \ 11 | g++ \ 12 | gcc \ 13 | gcc-aarch64-linux-gnu \ 14 | gcc-x86-64-linux-gnu \ 15 | git-core \ 16 | iasl \ 17 | make \ 18 | perl \ 19 | python-is-python3 \ 20 | liblzma-dev \ 21 | lzma-dev \ 22 | uuid-dev \ 23 | zip \ 24 | wget \ 25 | && true 26 | 27 | # mtools version 4.0.32 in the ubuntu repo as of 2022-03-26 does not work, so let's download a working version manually 28 | RUN \ 29 | wget https://ftp.gnu.org/gnu/mtools/mtools_4.0.38_amd64.deb \ 30 | && dpkg -i mtools_4.0.38_amd64.deb \ 31 | && true 32 | 33 | RUN mkdir -p /opt/build 34 | RUN ln -sf /bin/bash /bin/sh 35 | 36 | WORKDIR /opt/build 37 | CMD ["make", "-j8"] 38 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | FW_URL := https://raw.githubusercontent.com/raspberrypi/firmware/master/boot 2 | 3 | SHELL = /bin/bash 4 | EFI_IPXE_DRIVER := FALSE 5 | EFI_BUILD := RELEASE 6 | EFI_ARCH := AARCH64 7 | EFI_TOOLCHAIN := GCC5 8 | EFI_TIMEOUT := 0 9 | EFI_FLAGS := --pcd=PcdPlatformBootTimeOut=$(EFI_TIMEOUT) --pcd=PcdRamLimitTo3GB=0 --pcd=PcdRamMoreThan3GB=1 --pcd=PcdSystemTableMode=2 -D IPXE_DRIVER_ENABLE=$(EFI_IPXE_DRIVER) 10 | EFI_SRC := edk2-platforms 11 | EFI_DSC := $(EFI_SRC)/Platform/RaspberryPi/RPi4/RPi4.dsc 12 | EFI_FDF := $(EFI_SRC)/Platform/RaspberryPi/RPi4/RPi4.fdf 13 | EFI_FD := Build/RPi4/$(EFI_BUILD)_$(EFI_TOOLCHAIN)/FV/RPI_EFI.fd 14 | 15 | IPXE_CROSS := aarch64-linux-gnu- 16 | IPXE_SRC := ipxe/src 17 | ifeq '$(EFI_IPXE_DRIVER)' 'TRUE' 18 | IPXE_TGT := bin-arm64-efi/ipxe.efidrv 19 | else 20 | IPXE_TGT := bin-arm64-efi/snp.efi 21 | endif 22 | IPXE_EFI := $(IPXE_SRC)/$(IPXE_TGT) 23 | IPXE_CONSOLE := $(IPXE_SRC)/config/local/rpi/console.h 24 | IPXE_GENERAL := $(IPXE_SRC)/config/local/rpi/general.h 25 | 26 | SDCARD_MB := 8 27 | export MTOOLSRC := mtoolsrc 28 | 29 | all : tftpboot.zip boot.img 30 | 31 | submodules : 32 | which git && git submodule update --init --recursive && ./apply_patches.sh || true 33 | 34 | firmware : firmware/start4.elf firmware/fixup4.dat firmware/bcm2711-rpi-4-b.dtb firmware/overlays/overlay_map.dtb 35 | 36 | firmware/%: 37 | [ -d $(shell dirname $@) ] || mkdir -p $(shell dirname $@) 38 | wget -O $@ $(FW_URL)/$* 39 | 40 | efi : $(EFI_FD) 41 | 42 | efi-basetools : submodules 43 | $(MAKE) -C edk2/BaseTools 44 | 45 | $(EFI_FD) : submodules efi-basetools $(IPXE_EFI) 46 | . ./edksetup.sh && \ 47 | build -b $(EFI_BUILD) -a $(EFI_ARCH) -t $(EFI_TOOLCHAIN) \ 48 | -p $(EFI_DSC) $(EFI_FLAGS) 49 | 50 | $(IPXE_GENERAL) : submodules 51 | mkdir -p $$(dirname $@) || true 52 | echo "#define DOWNLOAD_PROTO_HTTPS" > $@ 53 | echo "#define NTP_CMD" >> $@ 54 | 55 | $(IPXE_CONSOLE) : submodules 56 | mkdir -p $$(dirname $@) || true 57 | echo "#undef LOG_LEVEL" > $@ 58 | echo "#define LOG_LEVEL LOG_ALL" >> $@ 59 | echo "#define CONSOLE_SYSLOG CONSOLE_USAGE_ALL" >> $@ 60 | 61 | ipxe : $(IPXE_EFI) 62 | 63 | $(IPXE_EFI) : submodules $(IPXE_CONSOLE) $(IPXE_GENERAL) 64 | $(MAKE) -C $(IPXE_SRC) CROSS=$(IPXE_CROSS) CONFIG=rpi $(IPXE_TGT) 65 | ifeq '$(EFI_IPXE_DRIVER)' 'TRUE' 66 | cp $(IPXE_SRC)/$(IPXE_TGT) $(EFI_SRC)/Drivers/Ipxe/Ipxe.efi 67 | endif 68 | 69 | pxe : firmware efi ipxe 70 | $(RM) -rf pxe 71 | mkdir -p pxe 72 | cp -r $(sort $(filter-out firmware/kernel%,$(wildcard firmware/*))) \ 73 | pxe/ 74 | cp config.txt $(EFI_FD) edk2/License.txt pxe/ 75 | ifneq '$(EFI_IPXE_DRIVER)' 'TRUE' 76 | mkdir -p pxe/efi/boot 77 | cp $(IPXE_SRC)/$(IPXE_TGT) pxe/efi/boot/bootaa64.efi 78 | cp ./autoexec.ipxe pxe/efi/boot/autoexec.ipxe 79 | endif 80 | cp ipxe/COPYING* pxe/ 81 | 82 | tftpboot.zip : pxe 83 | $(RM) -f $@ 84 | ( pushd $< ; zip -q -r ../$@ * ; popd ) 85 | 86 | boot.img: pxe 87 | truncate -s $(SDCARD_MB)M $@ 88 | mpartition -I -c -b 32 -s 32 -h 64 -t $(SDCARD_MB) -a "z:" 89 | mformat -v "pipxe" "z:" 90 | mcopy -s $(sort $(filter-out pxe/efi%,$(wildcard pxe/*))) "z:" 91 | 92 | update: 93 | git submodule foreach git pull origin master 94 | 95 | tag : 96 | git tag v`git show -s --format='%ad' --date=short | tr -d -`-rpi4 97 | 98 | .PHONY : submodules firmware efi efi-basetools $(EFI_FD) ipxe $(IPXE_EFI) pxe 99 | 100 | clean : 101 | $(RM) -rf firmware Build pxe tftpboot.zip boot.img 102 | if [ -d $(IPXE_SRC) ] ; then $(MAKE) -C $(IPXE_SRC) clean ; fi 103 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PXE-chainloadable iPXE for the Raspberry Pi 4 2 | ================================= 3 | 4 | piPXE is a build of the [iPXE] network boot firmware for the [Raspberry Pi]. 5 | 6 | Quick start 7 | ----------- 8 | 9 | 1. Bring TFTP/PXE server up – set variables according to your network. You can use .env file for convenience. 10 | ``` 11 | git clone https://github.com/valtzu/pixpe 12 | cd pixpe/example 13 | INTERFACE=eth0 SUBNET=192.168.1.0 NETMASK=255.255.255.0 docker-compose up 14 | ``` 15 | 2. Power on your Raspberry Pi 4 with Ethernet cable attached to the same network as your $INTERFACE above 16 | 3. Wait a couple of minutes, it should load images directly from the [images.maas.io] (~500MB or so) 17 | 4. You can now SSH to the machine (get the IP from dnsmasq output for example), username `unsafe`, password `unsafe` 18 | 19 | 20 | Build from source 21 | ----------- 22 | ``` 23 | git clone https://github.com/valtzu/pixpe 24 | cd pixpe 25 | docker-compose up 26 | ``` 27 | 28 | HTTP boot 29 | ----------------------------------------- 30 | 31 | ### Boot sequence 32 | 1. EEPROM loads `http://your-server/net_install/boot.img` and verifies it against `http://your-server/net_install/boot.sig` 33 | 2. `start4.elf` is launched (from `boot.img`) 34 | 3. UEFI (`RPI_EFI.fd`) is launched (from `boot.img`), defined in `config.txt`: `armstub=RPI_EFI.fd` 35 | 4. iPXE (embedded inside `RPI_EFI.fd` as EFI driver) is launched 36 | 5. iPXE looks up `autoexec.ipxe` from SD card or from TFTP server (which may be resolved using DHCP) 37 | 38 | Embedding iPXE script inside `boot.img` makes it possible to iPXE boot from internet, without SD card or TFTP server, eliminating step number 5 above. 39 | 40 | ### Implementation 41 | 42 | 1. Build `boot.img` with `docker-compose run --rm build make EMBED=/opt/build/autoexec.ipxe` (or wherever your ipxe script is) 43 | 2. Create 2048-bit RSA key pair in PEM format (Google is your friend) 44 | 3. Create `boot.sig` from `boot.img` with `rpi-eeprom-digest -i boot.img -o boot.sig -k your-private-key.pem` 45 | 4. Copy `boot.img` to your HTTP server (you may need to also sign it with `rpi-eeprom-digest`) 46 | 5. Flash EEPROM with your public key, `BOOT_ORDER`, `HTTP_HOST` etc. – but note that `HTTP_PATH` does not work and is always `net_install` (2022-04-02). See official [docs on HTTP boot](https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#http-boot). 47 | 48 | All of the above is made easy with [valtzu/pipxe-http](https://github.com/valtzu/pipxe-http). 49 | 50 | Licence 51 | ------- 52 | 53 | Every component is under an open source licence. See the individual 54 | subproject licensing terms for more details: 55 | 56 | * 57 | * 58 | * 59 | 60 | [images.maas.io]: http://images.maas.io/ephemeral-v3/ 61 | [iPXE]: https://ipxe.org 62 | [Raspberry Pi]: https://www.raspberrypi.org 63 | [tftpboot.zip]: https://github.com/valtzu/pipxe/releases/latest/download/tftpboot.zip 64 | [Etcher]: https://www.balena.io/etcher 65 | [VC4 boot firmware]: https://github.com/raspberrypi/firmware/tree/master/boot 66 | [TianoCore EDK2]: https://github.com/tianocore/edk2 67 | -------------------------------------------------------------------------------- /apply_patches.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | cd $(dirname $0) 6 | 7 | for dir in patches/* ; do 8 | repo=$(basename $dir) 9 | pushd $repo 10 | git config user.email || git config user.email "nobody@example.org" 11 | git config user.name || git config user.name "Nobody" 12 | for patch in ../patches/$repo/*.patch ; do 13 | git apply --3way --ignore-space-change $patch 14 | git commit -m "Apply $(basename $patch)" 15 | done 16 | popd 17 | done 18 | -------------------------------------------------------------------------------- /autoexec.ipxe: -------------------------------------------------------------------------------- 1 | #!ipxe 2 | dhcp 3 | 4 | # Required for TLS cert verification 5 | ntp pool.ntp.org 6 | 7 | chain https://raw.githubusercontent.com/valtzu/pipxe/master/example/boot.ipxe 8 | -------------------------------------------------------------------------------- /config.txt: -------------------------------------------------------------------------------- 1 | arm_64bit=1 2 | armstub=RPI_EFI.fd 3 | boot_delay=0 4 | disable_splash=1 5 | enable_uart=1 6 | uart_2ndstage=1 7 | hdmi_safe=1 8 | enable_gic=1 9 | disable_commandline_tags=2 10 | device_tree_address=0x1f0000 11 | device_tree_end=0x200000 12 | dtoverlay=disable-bt 13 | dtoverlay=upstream-pi4 14 | arm_boost=1 15 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | build: 4 | user: ${HOST_UID:-1000}:${HOST_GID:-1000} 5 | init: true 6 | build: 7 | context: . 8 | dockerfile: Dockerfile 9 | volumes: 10 | - ./:/opt/build 11 | -------------------------------------------------------------------------------- /edksetup.sh: -------------------------------------------------------------------------------- 1 | export WORKSPACE=$(pwd) 2 | export PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-platforms:$WORKSPACE/edk2-non-osi 3 | export GCC5_ARM_PREFIX=arm-linux-gnu- 4 | export GCC5_AARCH64_PREFIX=aarch64-linux-gnu- 5 | 6 | . ./edk2/edksetup.sh 7 | -------------------------------------------------------------------------------- /example/boot.ipxe: -------------------------------------------------------------------------------- 1 | #!ipxe 2 | dhcp 3 | 4 | # Required for TLS cert verification 5 | ntp pool.ntp.org 6 | 7 | set root-url http://github.com/valtzu/rpi-images/releases/latest/download 8 | set cloud-init https://raw.githubusercontent.com/valtzu/pipxe/master/example/cloud-init/ 9 | initrd ${root-url}/initrd.img 10 | chain ${root-url}/vmlinuz initrd=initrd.img root=${root-url}/focal-minimal-cloudimg-arm64.tar.xz ip=dhcp overlayroot=tmpfs:recurse=0 network-config=disabled ds=nocloud-net;s=${cloud-init} 11 | boot 12 | -------------------------------------------------------------------------------- /example/cloud-init/meta-data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valtzu/pipxe/16efdeb73a0f41fc7e0492c2d27c904dd710b7d7/example/cloud-init/meta-data -------------------------------------------------------------------------------- /example/cloud-init/user-data: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | users: 3 | - name: unsafe 4 | plain_text_passwd: unsafe 5 | lock_passwd: false 6 | ssh_pwauth: yes 7 | -------------------------------------------------------------------------------- /example/cloud-init/vendor-data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valtzu/pipxe/16efdeb73a0f41fc7e0492c2d27c904dd710b7d7/example/cloud-init/vendor-data -------------------------------------------------------------------------------- /example/dnsmasq.conf: -------------------------------------------------------------------------------- 1 | port=0 2 | log-facility=- 3 | log-dhcp 4 | enable-tftp 5 | tftp-root=/srv/tftpboot 6 | 7 | #pxe-service=tag:rpi-fw,0,"Raspberry Pi Boot" 8 | #dhcp-match=set:rpi-fw,60,PXEClient:Arch:00000:UNDI:002001 9 | 10 | #dhcp-match=set:rpi-uefi,60,PXEClient:Arch:00011:UNDI:003000 11 | #dhcp-boot=tag:rpi-uefi,efi/boot/bootaa64.efi 12 | 13 | #dhcp-userclass=set:ipxe,iPXE 14 | #dhcp-boot=tag:ipxe,http://raw.githubusercontent.com/valtzu/pipxe/master/example/tftpboot/autoexec.ipxe 15 | -------------------------------------------------------------------------------- /example/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | dnsmasq: 4 | image: jpillora/dnsmasq 5 | volumes: 6 | - ./dnsmasq.conf:/etc/dnsmasq.conf 7 | - ./tftpboot:/srv/tftpboot 8 | - ./boot.ipxe:/srv/tftpboot/efi/boot/autoexec.ipxe 9 | network_mode: host 10 | entrypoint: [] 11 | command: | 12 | sh -c " 13 | cd /srv/tftpboot 14 | if [ ! -f RPI_EFI.fd ] ; then 15 | wget --no-check-certificate https://github.com/valtzu/pipxe/releases/latest/download/tftpboot.zip -O - | unzip - 16 | chown -R $$(stat -c '%u' .):$$(stat -c '%g' .) . 17 | fi 18 | if [ -z '${INTERFACE}' ] ; then 19 | echo 'Usage: INTERFACE=eth0 SUBNET=192.168.1.0 NETMASK=255.255.255.0 docker-compose up' 20 | exit 1 21 | fi 22 | dnsmasq \ 23 | --no-daemon \ 24 | --interface=${INTERFACE} \ 25 | --dhcp-range=${SUBNET:-192.168.1.0},proxy,${NETMASK:-255.255.255.0} 26 | " 27 | -------------------------------------------------------------------------------- /example/tftpboot/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !efi/boot/autoexec.ipxe 4 | -------------------------------------------------------------------------------- /mtoolsrc: -------------------------------------------------------------------------------- 1 | drive z: 2 | file="boot.img" 3 | partition=1 4 | -------------------------------------------------------------------------------- /patches/edk2-platforms/0001-RPi4-fix-serial-number.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c 2 | index 4edec0ad..984083f7 100644 3 | --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c 4 | +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c 5 | @@ -340,7 +340,7 @@ RpiFirmwareGetMacAddress ( 6 | return EFI_SUCCESS; 7 | } 8 | 9 | -#pragma pack() 10 | +#pragma pack(1) 11 | typedef struct { 12 | UINT64 Serial; 13 | } RPI_FW_SERIAL_TAG; 14 | -------------------------------------------------------------------------------- /patches/edk2-platforms/0002-RPi4-iPXE-driver.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Drivers/Ipxe/.gitignore b/Drivers/Ipxe/.gitignore 2 | new file mode 100644 3 | index 0000000000..a93b09a019 4 | --- /dev/null 5 | +++ b/Drivers/Ipxe/.gitignore 6 | @@ -0,0 +1 @@ 7 | +Ipxe.efi 8 | diff --git a/Drivers/Ipxe/Ipxe.inf b/Drivers/Ipxe/Ipxe.inf 9 | new file mode 100644 10 | index 0000000000..9c5df7714d 11 | --- /dev/null 12 | +++ b/Drivers/Ipxe/Ipxe.inf 13 | @@ -0,0 +1,9 @@ 14 | +[Defines] 15 | + INF_VERSION = 0x0001001B 16 | + BASE_NAME = Ipxe 17 | + FILE_GUID = EC60E14E-F6C6-4648-BEF7-057AC415E30B 18 | + MODULE_TYPE = UEFI_DRIVER 19 | + VERSION_STRING = 1.0 20 | + 21 | +[Binaries.AARCH64] 22 | + PE32|Drivers/Ipxe/Ipxe.efi|* 23 | diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc 24 | index 8ba0ca6185..a938608abb 100644 25 | --- a/Platform/RaspberryPi/RPi4/RPi4.dsc 26 | +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc 27 | @@ -32,6 +32,7 @@ 28 | DEFINE SECURE_BOOT_ENABLE = FALSE 29 | DEFINE INCLUDE_TFTP_COMMAND = FALSE 30 | DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F 31 | + DEFINE IPXE_DRIVER_ENABLE = FALSE 32 | 33 | !ifndef TFA_BUILD_ARTIFACTS 34 | # 35 | @@ -593,6 +594,13 @@ 36 | # 37 | ################################################################################ 38 | [Components.common] 39 | +!if $(IPXE_DRIVER_ENABLE) == TRUE 40 | + # 41 | + # iPXE Driver 42 | + # 43 | + Drivers/Ipxe/Ipxe.inf 44 | +!endif 45 | + 46 | # 47 | # PEI Phase modules 48 | # 49 | diff --git a/Platform/RaspberryPi/RPi4/RPi4.fdf b/Platform/RaspberryPi/RPi4/RPi4.fdf 50 | index 0c782d2f35..ec6091d855 100644 51 | --- a/Platform/RaspberryPi/RPi4/RPi4.fdf 52 | +++ b/Platform/RaspberryPi/RPi4/RPi4.fdf 53 | @@ -314,6 +314,13 @@ READ_LOCK_STATUS = TRUE 54 | # 55 | INF Platform/RaspberryPi/Drivers/LogoDxe/LogoDxe.inf 56 | 57 | +!if $(IPXE_DRIVER_ENABLE) == TRUE 58 | + # 59 | + # iPXE Driver 60 | + # 61 | + INF Drivers/Ipxe/Ipxe.inf 62 | +!endif 63 | + 64 | [FV.FVMAIN_COMPACT] 65 | FvAlignment = 16 66 | ERASE_POLARITY = 1 67 | -------------------------------------------------------------------------------- /patches/edk2-platforms/0003-RPi4-fix-usb-on-recent-kernels.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c 2 | index cbbc2ad..c6c9e2b 100644 3 | --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c 4 | +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c 5 | @@ -375,31 +375,6 @@ SyncPcie ( 6 | return EFI_NOT_FOUND; 7 | } 8 | 9 | - /* 10 | - * Now that we are always running without DMA translation, and with a 3G 11 | - * limit, there shouldn't be a need to reset/reload the XHCI. The 12 | - * possible problem is that the PCIe root port is itself being reset (by 13 | - * Linux+DT). The RPi foundation claims this is needed as a pre-req to 14 | - * reloading the XHCI firmware, which also implies that a PCI fundamental 15 | - * reset should cause the XHCI itself to reset. This isn't happening 16 | - * fully, otherwise reloading the firmware would be mandatory. As it is, 17 | - * recent kernels actually start to have problems following the XHCI 18 | - * reset notification mailbox! Instead lets stop the kernel from 19 | - * triggering the mailbox by removing the node. 20 | - */ 21 | - 22 | - Node = fdt_path_offset (mFdtImage, "/scb/pcie@7d500000/pci"); 23 | - if (Node < 0) { 24 | - // This can happen on CM4/etc which doesn't have an onboard XHCI 25 | - DEBUG ((DEBUG_INFO, "%a: failed to locate /scb/pcie@7d500000/pci\n", __FUNCTION__)); 26 | - } else { 27 | - Retval = fdt_del_node (mFdtImage, Node); 28 | - if (Retval != 0) { 29 | - DEBUG ((DEBUG_ERROR, "Failed to remove /scb/pcie@7d500000/pci\n")); 30 | - return EFI_NOT_FOUND; 31 | - } 32 | - } 33 | - 34 | #endif 35 | return EFI_SUCCESS; 36 | } 37 | --------------------------------------------------------------------------------