Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial aarch64 support, cross arch stateless images with qemu-user-static, grub2 for x86 #7257

Merged
merged 13 commits into from
Jul 25, 2024

Conversation

Obihoernchen
Copy link
Member

@Obihoernchen Obihoernchen commented Sep 30, 2022

The following PR adds three features:

  • initial aarch64 support for xCAT using grub2
  • grub2 support for x86 arch
  • cross arch stateless image generation with qemu-user-static allowing you to build ppc64 or aarch64 stateless images on x86 hosts

It's not 100% ready yet and at the moment I've only tested EL8, but it should be good enough for some PoC tests :)

Status

  • stateful aarch64 images
  • stateless aarch64 images
  • Fix aarch64 install dependencies
  • activate xCAT-genesis-scripts-aarch64 build + build xCAT-genesis-base-aarch64 + add dep to xCAT.spec (optional)
  • grub2 support for x86 arch
  • cross arch stateless image generation with qemu-user-static
  • Man pages
  • Documentation

Emulate aarch64 on x86_64 with QEMU for testing

  • Install qemu-system-aarch64
  • Create VM with:
    • arch: aarch64
    • machine type: virt
    • cpu model: max
    • emulator: /usr/bin/qemu-system-aarch64
    • firmware: UEFI aarch64: /usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw

Note: tested with Fedora 36

Refs:

xCAT RPMs for aarch64

  • xcat-core packages are builded for aarch64 with: bf57a2b13ef5978a3e05076b195f01dc3f2ddb35
  • Missing dependencies:
    • ipmitool-xcat
    • goconserver [dep, SOL] --> built
    • perl-IO-Tty.x86_64 [dep] --> perl-IO-Tty.aarch64 in powertools repo

Build goconserver for aarch64

dnf install golang
git clone https://github.com/xcat2/goconserver.git
cd goconserver
go env -w GO111MODULE=auto
make deps
make rpm
ls -l build/*.rpm

grub2 boot preparation

qemu-user-static for cross arch stateless images

:qemu-aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-aarch64-static:F
  • Restart binfmt service: systemctl restart systemd-binfmt

Misc

[root@xcat-aarch64 grub2]# lsdef -t osimage rocky8-aarch64-netboot-compute
Object name: rocky8-aarch64-netboot-compute
    exlist=/opt/xcat/share/xcat/netboot/rocky/compute.rocky8.x86_64.exlist
    imagetype=linux
    osarch=aarch64
    osdistroname=rocky8-aarch64
    osname=Linux
    osvers=rocky8
    otherpkgdir=/install/post/otherpkgs/rocky8/aarch64
    permission=755
    pkgdir=/install/rocky8/aarch64
    pkglist=/opt/xcat/share/xcat/netboot/rocky/compute.rocky8.x86_64.pkglist
    postinstall=/opt/xcat/share/xcat/netboot/rocky/compute.rocky8.x86_64.postinstall
    profile=compute
    provmethod=netboot
    rootimgdir=/install/netboot/rocky8/aarch64/compute

@Obihoernchen Obihoernchen changed the title Initial aarch64 support Initial aarch64 support, cross arch stateless images with qemu-user-static, grub2 for x86 Sep 30, 2022
@Obihoernchen Obihoernchen changed the title Initial aarch64 support, cross arch stateless images with qemu-user-static, grub2 for x86 WIP: Initial aarch64 support, cross arch stateless images with qemu-user-static, grub2 for x86 Sep 30, 2022
@Obihoernchen Obihoernchen added this to the 2.17 milestone Feb 7, 2024
@Obihoernchen Obihoernchen self-assigned this Feb 7, 2024
@Obihoernchen
Copy link
Member Author

Obihoernchen commented Feb 23, 2024

Works fine with el9, too.
Feel free to test it. You don't need an arm management node for testing.
Just install grub2 and qemu-user-static on your management node as described above.

@Obihoernchen
Copy link
Member Author

Note: you might have to manually edit generated grub configs because ARM servers might use serial port ttyAMA0 and xCAT will always use the string "ttyS" + nodehm.serialport

@Obihoernchen Obihoernchen force-pushed the aarch64 branch 3 times, most recently from b4a6bf9 to c4edbdd Compare July 12, 2024 16:49
@Obihoernchen Obihoernchen changed the title WIP: Initial aarch64 support, cross arch stateless images with qemu-user-static, grub2 for x86 Initial aarch64 support, cross arch stateless images with qemu-user-static, grub2 for x86 Jul 12, 2024
@Obihoernchen Obihoernchen requested a review from ocfmatt July 12, 2024 17:38
@Obihoernchen
Copy link
Member Author

@ocfmatt please take a look at it. Especially the documentation I have written.

Copy link

@ocfmatt ocfmatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me. I like the use of qemu for cross architecture compiling.

@Obihoernchen Obihoernchen merged commit c8cb1d6 into xcat2:master Jul 25, 2024
1 check passed
@WZT666-dev
Copy link

Hello:
I am trying to distribute aarch64 on a physical server. My management node is x86_64 and the system version is rocky8.5; The distributed system is the ARM version of Rockey8.10, and the CPU of my client machine is ARM architecture. When I prepared grub2.aarch64 under/tftpboot/boot/grub2, I encountered the following error when restarting

Start PXE over IPv4
Mac Addr:F4-DE-AF-54-5D-9D.
Station IP address is 172.22.2.26
Server IP address is 172.22.2.223
NBP filename is grubaa64.efi
NBP filesize is 0 Bytes
PXE-E23:Client received TFTP error from server

How can this need be resolved?

@Obihoernchen
Copy link
Member Author

Did you check firewall etc.?
Is grub2 boot working for x86 nodes?

@WZT666-dev
Copy link

Did you check firewall etc.? Is grub2 boot working for x86 nodes?

Thanks,
All firewalls are turned off.
What do you mean by grub2? My client node is ARM and I have prepared grub2.aarch64

@Obihoernchen
Copy link
Member Author

Do you have a x86 client node?
For testing purposes you could also add the grub2 file for x86 (see doc) and boot the x86 client via netboot=grub2.
I just want to see whether this is general issue with your setup or an aarch64 specific issue.

@WZT666-dev
Copy link

Do you have a x86 client node? For testing purposes you could also add the grub2 file for x86 (see doc) and boot the x86 client via netboot=grub2. I just want to see whether this is general issue with your setup or an aarch64 specific issue.

Thank you for your response. I am currently testing the x86 client to see if it is a configuration issue.

@WZT666-dev
Copy link

NBP filename is grubaa64.efi
NBP filesize is 0 Bytes
PXE-E23:Client received TFTP error from server

I tested using the x86_64 client and successfully deployed the system, but ARM still encountered errors
NBP filename is grubaa64.efi
NBP filesize is 0 Bytes
PXE-E23:Client received TFTP error from server

@Obihoernchen
Copy link
Member Author

Can you please post the output of:

grep -A 1 -B 10 grub2 /etc/dhcp/dhcpd.conf /var/lib/dhcpd/dhcpd.leases

@WZT666-dev
Copy link

Can you please post the output of:

grep -A 1 -B 10 grub2 /etc/dhcp/dhcpd.conf /var/lib/dhcpd/dhcpd.leases

`/etc/dhcp/dhcpd.conf- filename "xcat/xnba.kpxe";
/etc/dhcp/dhcpd.conf- } else if option vendor-class-identifier = "Etherboot-5.4" { #x86
/etc/dhcp/dhcpd.conf- filename "xcat/xnba.kpxe";
/etc/dhcp/dhcpd.conf- } else if option client-architecture = 00:07 { #x86_64 uefi
/etc/dhcp/dhcpd.conf- filename "xcat/xnba.efi";
/etc/dhcp/dhcpd.conf- } else if option client-architecture = 00:09 { #x86_64 uefi alternative id
/etc/dhcp/dhcpd.conf- filename "xcat/xnba.efi";
/etc/dhcp/dhcpd.conf- } else if option client-architecture = 00:02 { #ia64
/etc/dhcp/dhcpd.conf- filename "elilo.efi";
/etc/dhcp/dhcpd.conf- } else if option client-architecture = 00:0b { #aaarch64
/etc/dhcp/dhcpd.conf: filename "boot/grub2/grub2.aarch64";
/etc/dhcp/dhcpd.conf- } else if option client-architecture = 00:0e { #OPAL-v3

/var/lib/dhcpd/dhcpd.leases- supersede server.ddns-hostname = "fat09";
/var/lib/dhcpd/dhcpd.leases- supersede host-name = "fat09";
/var/lib/dhcpd/dhcpd.leases-}
/var/lib/dhcpd/dhcpd.leases-host arm01 {
/var/lib/dhcpd/dhcpd.leases- dynamic;
/var/lib/dhcpd/dhcpd.leases- hardware ethernet f4:de:af:54:5d:9d;
/var/lib/dhcpd/dhcpd.leases- uid f4:de:af:54:5d:9d;
/var/lib/dhcpd/dhcpd.leases- fixed-address 172.22.2.246;
/var/lib/dhcpd/dhcpd.leases- supersede server.ddns-hostname = "arm01";
/var/lib/dhcpd/dhcpd.leases- supersede host-name = "arm01";
/var/lib/dhcpd/dhcpd.leases: supersede server.filename = "/boot/grub2/grub2-arm01";
/var/lib/dhcpd/dhcpd.leases- supersede server.next-server = ac:16:02:f4;
/var/lib/dhcpd/dhcpd.leases-}
/var/lib/dhcpd/dhcpd.leases-host arm02 {
/var/lib/dhcpd/dhcpd.leases- dynamic;
/var/lib/dhcpd/dhcpd.leases- hardware ethernet f4:de:af:54:58:25;
/var/lib/dhcpd/dhcpd.leases- uid f4:de:af:54:58:25;
/var/lib/dhcpd/dhcpd.leases- fixed-address 172.22.2.247;
/var/lib/dhcpd/dhcpd.leases- supersede server.ddns-hostname = "arm02";
/var/lib/dhcpd/dhcpd.leases- supersede host-name = "arm02";
/var/lib/dhcpd/dhcpd.leases: supersede server.filename = "/boot/grub2/grub2-arm02";
/var/lib/dhcpd/dhcpd.leases- supersede server.next-server = ac:16:02:f4;

/var/lib/dhcpd/dhcpd.leases- dynamic;
/var/lib/dhcpd/dhcpd.leases- deleted;
/var/lib/dhcpd/dhcpd.leases-}
/var/lib/dhcpd/dhcpd.leases-host c02n04 {
/var/lib/dhcpd/dhcpd.leases- dynamic;
/var/lib/dhcpd/dhcpd.leases- hardware ethernet 9c:dc:71:68:cb:30;
/var/lib/dhcpd/dhcpd.leases- uid 9c:dc:71:68:cb:30;
/var/lib/dhcpd/dhcpd.leases- fixed-address 172.22.2.30;
/var/lib/dhcpd/dhcpd.leases- supersede server.ddns-hostname = "c02n04";
/var/lib/dhcpd/dhcpd.leases- supersede host-name = "c02n04";
/var/lib/dhcpd/dhcpd.leases: supersede server.filename = "/boot/grub2/grub2-c02n04";
/var/lib/dhcpd/dhcpd.leases- supersede server.next-server = ac:16:02:f4;

/var/lib/dhcpd/dhcpd.leases- dynamic;
/var/lib/dhcpd/dhcpd.leases- deleted;
/var/lib/dhcpd/dhcpd.leases-}
/var/lib/dhcpd/dhcpd.leases-host arm01 {
/var/lib/dhcpd/dhcpd.leases- dynamic;
/var/lib/dhcpd/dhcpd.leases- hardware ethernet f4:de:af:54:5d:9d;
/var/lib/dhcpd/dhcpd.leases- uid f4:de:af:54:5d:9d;
/var/lib/dhcpd/dhcpd.leases- fixed-address 172.22.2.246;
/var/lib/dhcpd/dhcpd.leases- supersede server.ddns-hostname = "arm01";
/var/lib/dhcpd/dhcpd.leases- supersede host-name = "arm01";
/var/lib/dhcpd/dhcpd.leases: supersede server.filename = "/boot/grub2/grub2-arm01";
/var/lib/dhcpd/dhcpd.leases- supersede server.next-server = ac:16:02:f4;

/var/lib/dhcpd/dhcpd.leases- dynamic;
/var/lib/dhcpd/dhcpd.leases- deleted;
/var/lib/dhcpd/dhcpd.leases-}
/var/lib/dhcpd/dhcpd.leases-host c02n04 {
/var/lib/dhcpd/dhcpd.leases- dynamic;
/var/lib/dhcpd/dhcpd.leases- hardware ethernet 9c:dc:71:68:cb:30;
/var/lib/dhcpd/dhcpd.leases- uid 9c:dc:71:68:cb:30;
/var/lib/dhcpd/dhcpd.leases- fixed-address 172.22.2.30;
/var/lib/dhcpd/dhcpd.leases- supersede server.ddns-hostname = "c02n04";
/var/lib/dhcpd/dhcpd.leases- supersede host-name = "c02n04";
/var/lib/dhcpd/dhcpd.leases: supersede server.filename = "/boot/grub2/grub2-c02n04";
/var/lib/dhcpd/dhcpd.leases- supersede server.next-server = ac:16:02:f4;

/var/lib/dhcpd/dhcpd.leases- dynamic;
/var/lib/dhcpd/dhcpd.leases- deleted;
/var/lib/dhcpd/dhcpd.leases-}
/var/lib/dhcpd/dhcpd.leases-host arm02 {
/var/lib/dhcpd/dhcpd.leases- dynamic;
/var/lib/dhcpd/dhcpd.leases- hardware ethernet f4:de:af:54:58:25;
/var/lib/dhcpd/dhcpd.leases- uid f4:de:af:54:58:25;
/var/lib/dhcpd/dhcpd.leases- fixed-address 172.22.2.247;
/var/lib/dhcpd/dhcpd.leases- supersede server.ddns-hostname = "arm02";
/var/lib/dhcpd/dhcpd.leases- supersede host-name = "arm02";
/var/lib/dhcpd/dhcpd.leases: supersede server.filename = "/boot/grub2/grub2-arm02";
/var/lib/dhcpd/dhcpd.leases- supersede server.next-server = ac:16:02:f4;

/var/lib/dhcpd/dhcpd.leases- dynamic;
/var/lib/dhcpd/dhcpd.leases- deleted;
/var/lib/dhcpd/dhcpd.leases-}
/var/lib/dhcpd/dhcpd.leases-host arm01 {
/var/lib/dhcpd/dhcpd.leases- dynamic;
/var/lib/dhcpd/dhcpd.leases- hardware ethernet f4:de:af:54:5d:9d;
/var/lib/dhcpd/dhcpd.leases- uid f4:de:af:54:5d:9d;
/var/lib/dhcpd/dhcpd.leases- fixed-address 172.22.2.246;
/var/lib/dhcpd/dhcpd.leases- supersede server.ddns-hostname = "arm01";
/var/lib/dhcpd/dhcpd.leases- supersede host-name = "arm01";
/var/lib/dhcpd/dhcpd.leases: supersede server.filename = "/boot/grub2/grub2-arm01";
/var/lib/dhcpd/dhcpd.leases- supersede server.next-server = ac:16:02:f4;
`

c02n04是x86节点,arm01与02是客户端节点

@Obihoernchen
Copy link
Member Author

Hmm looks good.
Does /tftpboot/boot/grub2/grub2-arm01 link to grub2.aarch64?

@WZT666-dev
Copy link

Hmm looks good. Does /tftpboot/boot/grub2/grub2-arm01 link to grub2.aarch64?

Yes, I have tried the default one, which is/tftpboot/boot/grub2/grub2-arm01 link to grub2.aarch64
I also tried canceling/tftpboot/boot/grub2/grub2-arm01 link to grub2.aarch64, copying grub2.aarch64 to grub2-arm01, but still encountered an error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants