Bug 254600 - net/ipxe: update to newer commit and enable arm64
Summary: net/ipxe: update to newer commit and enable arm64
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Vinícius Zavam
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-27 10:40 UTC by Dave Cottlehuber
Modified: 2021-05-07 19:14 UTC (History)
3 users (show)

See Also:
egypcio: maintainer-feedback+


Attachments
log (17.43 KB, text/plain)
2021-04-15 06:25 UTC, Dave Cottlehuber
no flags Details
[PATCH] net/ipxe: enable aarch64 (arm64) (2.71 KB, patch)
2021-04-27 19:15 UTC, Vinícius Zavam
egypcio: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Cottlehuber freebsd_committer 2021-03-27 10:40:41 UTC
Could the port be updated, and amended to allow SNP EFI for armv8 please?

A number of 64-bit armv8 ampere servers are coming to the FreeBSD Foundation. They can boot using iPXE, cross-built as follows:

```
# on a boring standard ubuntu
$ sudo apt-get -y --no-install-recommends install build-essential \
  gcc-aarch64-linux-gnu git liblzma-dev
$ git clone https://github.com/ipxe/ipxe
$ cd ipxe/src
$ git log --oneline HEAD -1
  1192edf3 (HEAD -> master) [dhcp] Handle DHCPNAK by returning to discovery state
$ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 bin-arm64-efi/snp.efi
```

thanks!
Comment 1 Vinícius Zavam freebsd_committer 2021-04-14 10:12:04 UTC
hello there!

I plan to split this one in 2 different commits:

 - update the port itself;
 - allow building on aarch64.

thanks for raising this one! :)
Comment 2 commit-hook freebsd_committer 2021-04-14 11:16:17 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e91ecf9b7664d357cf9270b0edc43524957e9777

commit e91ecf9b7664d357cf9270b0edc43524957e9777
Author:     Vinícius Zavam <egypcio@FreeBSD.org>
AuthorDate: 2021-04-14 11:11:06 +0000
Commit:     Vinícius Zavam <egypcio@FreeBSD.org>
CommitDate: 2021-04-14 11:11:06 +0000

    net/ipxe: update g20201129 (13a6d17) to g20210413 (8ca43cc)

      - https://github.com/ipxe/ipxe/commit/79c0173

        Create util/genfsimg for building filesystem-based images

        Generalise util/geniso, util/gensdsk, and util/genefidsk to
        create a single script util/genfsimg that can be used to build
        either FAT filesystem images or ISO images.

      - https://github.com/ipxe/ipxe/commit/f034ae5

        Allow elf2efi.c to build on FreeBSD

    PR:             254600
    Reported by:    dch@

 net/ipxe/Makefile                          |  6 +++---
 net/ipxe/distinfo                          |  6 +++---
 net/ipxe/files/patch-util_elf2efi.c (gone) | 11 -----------
 3 files changed, 6 insertions(+), 17 deletions(-)
Comment 3 Vinícius Zavam freebsd_committer 2021-04-14 11:18:09 UTC
(In reply to Dave Cottlehuber from comment #0)

hi, would you mind to check if the latest version of the port builds and works fine with aarch64? that would take me a while to build the env, the port itself and test it all.

as soon as we got an OK on that, the new arch can be added.
Comment 4 Dave Cottlehuber freebsd_committer 2021-04-15 06:25:04 UTC
Created attachment 224127 [details]
log

thanks for the port update. Right now it fails on arm64 :-( full log attached.

===>  Building for ipxe-g20210413,1
install -m 644 /usr/local/share/syslinux/bios/core/isolinux.bin /tmp/usr/ports/net/ipxe/work/ipxe-8ca43cc/src/isolinux.bin
gmake[1]: Entering directory '/tmp/usr/ports/net/ipxe/work/ipxe-8ca43cc/src'
Makefile.housekeeping:366: arch/aarch64/Makefile: No such file or directory
gmake[1]: *** No rule to make target 'arch/aarch64/Makefile', needed by 'bin/deps/libgcc/__divdi3.c.d'.  Stop.
gmake[1]: Leaving directory '/tmp/usr/ports/net/ipxe/work/ipxe-8ca43cc/src'
*** Error code 1

this might be just a sed change for target name, perhaps?
Comment 5 Vinícius Zavam freebsd_committer 2021-04-19 20:19:09 UTC
(In reply to Dave Cottlehuber from comment #4)

ACK.

many thanks for the feedback! very appreciated.
it's on my watch now.
Comment 6 Dave Cottlehuber freebsd_committer 2021-04-21 09:01:39 UTC
egypcio, this works for building from src:

- git clone ... && cd ipxe/src
- install gcc, binutils && related dependencies same as port
- build using binutils ld/objcopy etc not the ones from /usr/bin/

$ export PATH=/usr/local/bin:$PATH
$ gmake ARCH=arm64 \
    bin-arm64-efi/snp.efi \
    bin-arm64-efi/ipxe.efi 

the native "ipxe.efi" version doesn't boot for me here; I get an exception on startup, but it may work for others.

iPXE 1.21.1+ (g3efd) -- Open Source Network Boot Firmware -- http://ipxe.org
Comment 7 Dave Cottlehuber freebsd_committer 2021-04-21 09:36:42 UTC
BTW ref https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216316 for the reason why freebsd's own objcopy etc aren't suitable for building ipxe.
Comment 8 Vinícius Zavam freebsd_committer 2021-04-21 17:50:53 UTC
thanks for sharing that! it's gonna take a while here for me to (cross)compile and test it all, but I am giving it quite an attention.

hope it works :)

you should hear from me soon.
Comment 9 Vinícius Zavam freebsd_committer 2021-04-23 11:28:09 UTC
hello there! as I do see the importance of getting us ipxe to work on aarch64, I am getting back to you again... sadly just to report I am still "building" a few packages here on my test lab.

- luckly I was able to install few pre-built packages with an extra help of our recent Tier1 repo, but there are still some that must be build (and tested).

we "just need to" (tm) patch the port's Makefile to get the proper replacement of aarch64/arm64 in place; or generate a patch for that under files/. it "should work" (tm)

- testing lab env follows;

 # uname ...
FreeBSD 14.0-CURRENT 1400008

# poudriere jail ...
12aarch64 12.2-STABLE     arm64.aarch64 url=https://artifact.ci.freebsd.org/snapshot/12.2-STABLE/f11b9574cd186762c4883e8819896c6475be3027/arm64/aarch64

last pid:  3978;  load averages:  1.14,  1.12,  1.08; battery: 100%                                                                                                               up 3+22:54:44  11:26:16

CTRL+t

load: 1.12  cmd: qemu-aarch64-static 3976 [running] 105.44r 105.13u 0.32s 100% 219512k
make[1]: Working in: /usr/ports/lang/gcc10
make: Working in: /usr/ports/net/ipxe
Comment 10 Vinícius Zavam freebsd_committer 2021-04-27 19:06:09 UTC
let's see where it goes now. and thanks for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216316 !
I admit that almost did not see what you shared before.



root@tak-poudriere:/usr/ports # make -s -DBATCH -DFORCE_PKG_REGISTER -C net/ipxe clean
===>  Cleaning for ipxe-g20210414,1
root@tak-poudriere:/usr/ports # make -s -DBATCH -DFORCE_PKG_REGISTER -C net/ipxe all
===>  License GPLv2 accepted by the user
===>   ipxe-g20210414,1 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by ipxe-g20210414,1 for building
===>  Extracting for ipxe-g20210414,1
=> SHA256 Checksum OK for ipxe-ipxe-g20210414-85d179f_GH0.tar.gz.
===>  Patching for ipxe-g20210414,1
===>   ipxe-g20210414,1 depends on executable: bash - found
===>   ipxe-g20210414,1 depends on executable: mformat - found
===>   ipxe-g20210414,1 depends on file: /usr/local/share/syslinux/bios/core/isolinux.bin - found
===>   ipxe-g20210414,1 depends on executable: bash - found
===>   ipxe-g20210414,1 depends on executable: mkisofs - found
===>   ipxe-g20210414,1 depends on package: gmake>=4.3 - found
===>   ipxe-g20210414,1 depends on executable: gcc10 - found
===>   ipxe-g20210414,1 depends on file: /usr/local/bin/as - found
===>   ipxe-g20210414,1 depends on package: perl5>=5.32.r0<5.33 - found
===>  Configuring for ipxe-g20210414,1
===>  Building for ipxe-g20210414,1
  [DEPS] arch/arm64/core/setjmp.S
  [DEPS] drivers/net/ath/ath9k/ath9k_xmit.c
  [DEPS] drivers/net/ath/ath9k/ath9k_recv.c
  [DEPS] drivers/net/ath/ath9k/ath9k_main.c
  [DEPS] drivers/net/ath/ath9k/ath9k_mac.c
  [DEPS] drivers/net/ath/ath9k/ath9k_init.c
  [DEPS] drivers/net/ath/ath9k/ath9k_hw.c
  [DEPS] drivers/net/ath/ath9k/ath9k_eeprom_def.c
  [DEPS] drivers/net/ath/ath9k/ath9k_eeprom_9287.c
  [DEPS] drivers/net/ath/ath9k/ath9k_eeprom_4k.c
  [DEPS] drivers/net/ath/ath9k/ath9k_eeprom.c
  [DEPS] drivers/net/ath/ath9k/ath9k_common.c
  [DEPS] drivers/net/ath/ath9k/ath9k_calib.c
  [DEPS] drivers/net/ath/ath9k/ath9k_ar9003_phy.c
  [DEPS] drivers/net/ath/ath9k/ath9k_ar9003_mac.c
...
Comment 11 Vinícius Zavam freebsd_committer 2021-04-27 19:15:07 UTC
Created attachment 224477 [details]
[PATCH] net/ipxe: enable aarch64 (arm64)

I am adding the (not-so-final-version-and-WIP) patch that made it fly on aarch64 here.
Comment 12 Vinícius Zavam freebsd_committer 2021-05-07 00:22:43 UTC
FYI: cleared all my previous jail (which was running 12), and restarting it all using 13.
Comment 13 Vinícius Zavam freebsd_committer 2021-05-07 19:14:10 UTC
/usr/local/bin/ar: creating bin/blib.a
/usr/local/bin/ld: bin/blib.a(serial.o): in function `serial_init':
/wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/serial.c:145: undefined reference to `uart_select'
/usr/local/bin/ld: bin/blib.a(serial.o): in function `uart_data_ready':
/wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/include/ipxe/uart.h:112: undefined reference to `uart_read'
/usr/local/bin/ld: /wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/include/ipxe/uart.h:112: undefined reference to `uart_read'
/usr/local/bin/ld: bin/blib.a(serial.o): in function `uart_receive':
/wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/include/ipxe/uart.h:124: undefined reference to `uart_read'
/usr/local/bin/ld: bin/blib.a(uart.o): in function `uart_transmit':
/wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:54: undefined reference to `uart_read'
/usr/local/bin/ld: /wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:61: undefined reference to `uart_write'
/usr/local/bin/ld: bin/blib.a(uart.o): in function `uart_flush':
/wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:75: undefined reference to `uart_read'
/usr/local/bin/ld: /wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:76: undefined reference to `uart_read'
/usr/local/bin/ld: bin/blib.a(uart.o): in function `uart_exists':
/wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:95: undefined reference to `uart_write'
/usr/local/bin/ld: /wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:96: undefined reference to `uart_read'
/usr/local/bin/ld: /wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:98: undefined reference to `uart_write'
/usr/local/bin/ld: /wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:99: undefined reference to `uart_read'
/usr/local/bin/ld: bin/blib.a(uart.o): in function `uart_init':
/wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:124: undefined reference to `uart_read'
/usr/local/bin/ld: /wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:126: undefined reference to `uart_write'
/usr/local/bin/ld: /wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:131: undefined reference to `uart_write'
/usr/local/bin/ld: /wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:132: undefined reference to `uart_write'
/usr/local/bin/ld: /wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:138: undefined reference to `uart_write'
/usr/local/bin/ld: /wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:141: undefined reference to `uart_write'
/usr/local/bin/ld: bin/blib.a(uart.o):/wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:144: more undefined references to `uart_write' follow
/usr/local/bin/ld: bin/blib.a(uart.o): in function `uart_init':
/wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:134: undefined reference to `uart_read'
/usr/local/bin/ld: /wrkdirs/usr/ports/net/ipxe/work/ipxe-106f4c5/src/core/uart.c:135: undefined reference to `uart_read'
/usr/local/bin/ld: bin/ipxe.efi.tmp: hidden symbol `uart_read' isn't defined
/usr/local/bin/ld: final link failed: bad value
gmake[1]: *** [Makefile.housekeeping:1219: bin/ipxe.efi.tmp] Error 1
*** Error code 1