threefoldtech / 0-bootstrap

Zero-OS Bootstrap Webservice
Apache License 2.0
1 stars 2 forks source link

Alpine ipxe build #25

Open robvanmieghem opened 1 year ago

robvanmieghem commented 1 year ago

Check if the compiled ipxe works and document the requirements

robvanmieghem commented 1 year ago

apk add --no-cache bash git make openssl gcc perl coreutils musl-dev xz-dev syslinux xorriso bash setup/template.sh

It worked on a microvm with Alpine on the grid but in the builders I'm getting this error:

[BUILD] bin/isqrt.o
[-] build: In file included from include/string.h:23,
[-] build:                  from core/gdbudp.c:27:
[-] build: In function '__constant_memcpy',
[-] build:     inlined from 'memcpy' at arch/x86/include/bits/string.h:168:10,
[-] build:     inlined from 'gdbudp_send' at core/gdbudp.c:206:2,
[-] build:     inlined from 'gdbudp_send' at core/gdbudp.c:163:13:
[-] build: arch/x86/include/bits/string.h:94:44: error: array subscript 'const union <anonymous>[0]' is partly outside array bounds of 'uint8_t[6]' {aka 'unsigned char[6]'} [-Werror=array-bounds]
[-] build:    94 |                 dest_u->u32[0] = src_u->u32[0];
[-] build:       |                                  ~~~~~~~~~~^~~
[-] build: core/gdbudp.c: In function 'gdbudp_send':
[-] build: core/gdbudp.c:53:16: note: object 'dest_eth' of size 6
[-] build:    53 | static uint8_t dest_eth[ETH_ALEN];
[-] build:       |                ^~~~~~~~
[-] build: In function '__constant_memcpy',
[-] build:     inlined from 'memcpy' at arch/x86/include/bits/string.h:168:10,
[-] build:     inlined from 'gdbudp_send' at core/gdbudp.c:206:2,
[-] build:     inlined from 'gdbudp_send' at core/gdbudp.c:163:13:
[-] build: arch/x86/include/bits/string.h:95:44: error: array subscript 'const union <anonymous>[0]' is partly outside array bounds of 'uint8_t[6]' {aka 'unsigned char[6]'} [-Werror=array-bounds]
[-] build:    95 |                 dest_u->u16[2] = src_u->u16[2];
[-] build:       |                                  ~~~~~~~~~~^~~
[-] build: core/gdbudp.c: In function 'gdbudp_send':
[-] build: core/gdbudp.c:53:16: note: object 'dest_eth' of size 6
[-] build:    53 | static uint8_t dest_eth[ETH_ALEN];
[-] build:       |                ^~~~~~~~
[-] build: In function '__constant_memcpy',
[-] build:     inlined from 'memcpy' at arch/x86/include/bits/string.h:168:10,
[-] build:     inlined from 'gdbudp_recv' at core/gdbudp.c:137:4:
[-] build: arch/x86/include/bits/string.h:94:32: error: array subscript 'union <anonymous>[0]' is partly outside array bounds of 'uint8_t[6]' {aka 'unsigned char[6]'} [-Werror=array-bounds]
[-] build:    94 |                 dest_u->u32[0] = src_u->u32[0];
[-] build:       |                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
[-] build: core/gdbudp.c: In function 'gdbudp_recv':
[-] build: core/gdbudp.c:53:16: note: object 'dest_eth' of size 6
[-] build:    53 | static uint8_t dest_eth[ETH_ALEN];
[-] build:       |                ^~~~~~~~
[-] build: In function '__constant_memcpy',
[-] build:     inlined from 'memcpy' at arch/x86/include/bits/string.h:168:10,
[-] build:     inlined from 'gdbudp_recv' at core/gdbudp.c:137:4:
[-] build: arch/x86/include/bits/string.h:95:32: error: array subscript 'union <anonymous>[0]' is partly outside array bounds of 'uint8_t[6]' {aka 'unsigned char[6]'} [-Werror=array-bounds]
[-] build:    95 |                 dest_u->u16[2] = src_u->u16[2];
[-] build:       |                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
[-] build: core/gdbudp.c: In function 'gdbudp_recv':
[-] build: core/gdbudp.c:53:16: note: object 'dest_eth' of size 6
[-] build:    53 | static uint8_t dest_eth[ETH_ALEN];
[-] build:       |                ^~~~~~~~
[+] build:   [BUILD] bin/job.o
[+] build:   [BUILD] bin/linebuf.o
[+] build:   [BUILD] bin/lineconsole.o
[-] build: cc1: all warnings being treated as errors
[-] build: make: *** [Makefile.housekeeping:952: bin/gdbudp.o] Error 1
maxux commented 1 year ago

Can you give me information ? Alpine version, arch, etc ?

robvanmieghem commented 1 year ago

steps to reproduce ( on an ubuntu 22.04 amd64 vm on the grid):

docker run -it --rm alpine:3.17.2 /bin/sh
apk add --no-cache bash git make openssl gcc perl coreutils musl-dev xz-dev syslinux xorriso
wget -cnv https://github.com/threefoldtech/0-bootstrap/archive/refs/tags/v3.0.2.tar.gz  -O /tmp/src.tar.gz
tar --strip-components=1 -xzf /tmp/src.tar.gz -C ./
bash setup/template.sh

The alpine image inspect gives "Architecture": "amd64"

robvanmieghem commented 1 year ago

on an alpine microvm on the grid ( Alpine 3.15.0) it does work:

...
[+] ================================================================
[+] ipxe legacy template installed on: /opt/ipxe-template
[+] ipxe uefi template installed on: /opt/ipxe-template-uefi
[+] ================================================================
robvanmieghem commented 1 year ago

It also works in an alpine 3.15.0 docker ( on the same ubuntu 22.04 amd64 vm on the grid as used for the alpine:3.17.2)

maxux commented 1 year ago

Fixed using gcc-12 branch of our iPXE fork.

The problem is related to gcc 12 which is used in the latest alpine. The bug have been fixed in the latest master of upstream https://github.com/ipxe/ipxe. I merged that master into gcc-12 branch of our fork (https://github.com/threefoldtech/ipxe). It compiles.

Now we need to see if that latest version works correctly :)