Skip to content

Commit b08ab76

Browse files
committed
Add partial support for arm64
This is enough support that `pixiecore quick debian testing --arch arm64` is able to successfully boot a raspberry pi 4 that's using the experimental edk2 raspberry pi UEFI firmware. It does not seem to work with the built-in eeprom pxe booting the raspberry pi 4 includes, but the eeprom pxe implementation is severely lacking, so I'm not surprised.
1 parent 71511b3 commit b08ab76

File tree

7 files changed

+25
-4
lines changed

7 files changed

+25
-4
lines changed

cmd/pixiecore/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func main() {
2626
cli.Ipxe[pixiecore.FirmwareEFI32] = ipxe.MustAsset("third_party/ipxe/src/bin-i386-efi/ipxe.efi")
2727
cli.Ipxe[pixiecore.FirmwareEFI64] = ipxe.MustAsset("third_party/ipxe/src/bin-x86_64-efi/ipxe.efi")
2828
cli.Ipxe[pixiecore.FirmwareEFIBC] = ipxe.MustAsset("third_party/ipxe/src/bin-x86_64-efi/ipxe.efi")
29+
cli.Ipxe[pixiecore.FirmwareEFIArm64] = ipxe.MustAsset("third_party/ipxe/src/bin-arm64-efi/ipxe.efi")
2930
cli.Ipxe[pixiecore.FirmwareX86Ipxe] = ipxe.MustAsset("third_party/ipxe/src/bin/ipxe.pxe")
3031
cli.CLI()
3132
}

go.sum

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
22
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
33
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
44
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
5+
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
56
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
7+
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
68
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
79
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
810
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
@@ -82,12 +84,14 @@ github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDf
8284
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
8385
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
8486
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
87+
github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM=
8588
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
8689
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
8790
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
8891
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
8992
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
9093
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
94+
github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
9195
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
9296
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
9397
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
@@ -169,6 +173,7 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl
169173
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
170174
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
171175
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
176+
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
172177
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
173178
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
174179
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=

pixiecore/cli/quickcmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ func netbootRecipe(parent *cobra.Command) {
299299
Long: `https://network.xyz allows to boot multiple operating
300300
systems and useful system utilities.`,
301301
Run: func(cmd *cobra.Command, args []string) {
302-
kernel := "https://boot.netboot.xyz/ipxe/netboot.xyz.lkrn"
302+
kernel := "https://boot.netboot.xyz/ipxe/netboot.xyz-packet-arm64.efi"
303303
fmt.Println(staticFromFlags(cmd, kernel, []string{}, "").Serve())
304304
},
305305
}

pixiecore/dhcp.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,15 @@ func (s *Server) validateDHCP(pkt *dhcp4.Packet) (mach Machine, fwtype Firmware,
115115
case 9:
116116
mach.Arch = ArchX64
117117
fwtype = FirmwareEFIBC
118+
case 11:
119+
// Not in the original rfc, but in
120+
// https://www.ietf.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml#processor-architecture
121+
// In practice, used by edk2
122+
// https://github.com/tianocore/edk2/blob/ef5dcba975ee3b4c29b19ad0b23d371a2cd9d60a/MdePkg/Include/IndustryStandard/Dhcp.h#L258-L272
123+
mach.Arch = Arm64
124+
fwtype = FirmwareEFIArm64
118125
default:
119-
return mach, 0, fmt.Errorf("unsupported client firmware type '%d' (please file a bug!)", fwtype)
126+
return mach, 0, fmt.Errorf("unsupported client firmware type '%d' (please file a bug!)", fwt)
120127
}
121128

122129
// Now, identify special sub-breeds of client firmware based on
@@ -210,7 +217,7 @@ func (s *Server) offerDHCP(pkt *dhcp4.Packet, mach Machine, serverIP net.IP, fwt
210217
resp.Options[43] = bs
211218
resp.BootFilename = fmt.Sprintf("tftp://%s/%s/%d", serverIP, mach.MAC, fwtype)
212219

213-
case FirmwareEFI32, FirmwareEFI64, FirmwareEFIBC:
220+
case FirmwareEFI32, FirmwareEFI64, FirmwareEFIBC, FirmwareEFIArm64:
214221
// In theory, the response we send for FirmwareX86PC should
215222
// also work for EFI. However, some UEFI firmwares don't
216223
// support PXE properly, and will ignore ProxyDHCP responses

pixiecore/http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (s *Server) handleIpxe(w http.ResponseWriter, r *http.Request) {
7474
}
7575
arch := Architecture(i)
7676
switch arch {
77-
case ArchIA32, ArchX64:
77+
case ArchIA32, ArchX64, Arm64:
7878
default:
7979
s.debug("HTTP", "Bad request %q from %s, unknown architecture %q", r.URL, r.RemoteAddr, arch)
8080
http.Error(w, "unknown architecture", http.StatusBadRequest)

pixiecore/pixiecore.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ const (
5151
ArchIA32 Architecture = iota
5252
// ArchX64 is a 64-bit x86 machine (aka amd64 aka X64).
5353
ArchX64
54+
// ARM aarch64, go calls it 'arm64' in its cross toolchain, so stick with
55+
// that.
56+
Arm64
5457
)
5558

5659
func (a Architecture) String() string {
@@ -59,6 +62,8 @@ func (a Architecture) String() string {
5962
return "IA32"
6063
case ArchX64:
6164
return "X64"
65+
case Arm64:
66+
return "ARM64"
6267
default:
6368
return "Unknown architecture"
6469
}
@@ -147,6 +152,7 @@ const (
147152
FirmwareEFI32 // 32-bit x86 processor running EFI
148153
FirmwareEFI64 // 64-bit x86 processor running EFI
149154
FirmwareEFIBC // 64-bit x86 processor running EFI
155+
FirmwareEFIArm64 // 64-bit arm processor (aarch64), running EFI
150156
FirmwareX86Ipxe // "Classic" x86 BIOS running iPXE (no UNDI support)
151157
FirmwarePixiecoreIpxe // Pixiecore's iPXE, which has replaced the underlying firmware
152158
)

pixiecore/pxe.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ func (s *Server) validatePXE(pkt *dhcp4.Packet) (fwtype Firmware, err error) {
103103
fwtype = FirmwareEFI64
104104
case 9:
105105
fwtype = FirmwareEFIBC
106+
case 11:
107+
fwtype = FirmwareEFIArm64
106108
default:
107109
return 0, fmt.Errorf("unsupported client firmware type '%d' (please file a bug!)", fwt)
108110
}

0 commit comments

Comments
 (0)