Page MenuHomeFreeBSD

Start of EFI32 boot loader support
ClosedPublic

Authored by sbruno on Sep 6 2016, 8:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 28, 8:32 AM
Unknown Object (File)
Fri, Apr 26, 4:42 PM
Unknown Object (File)
Fri, Apr 26, 4:42 PM
Unknown Object (File)
Fri, Apr 26, 4:41 PM
Unknown Object (File)
Fri, Apr 26, 4:41 PM
Unknown Object (File)
Fri, Apr 26, 4:38 PM
Unknown Object (File)
Fri, Apr 26, 4:38 PM
Unknown Object (File)
Fri, Apr 26, 4:37 PM
Subscribers

Details

Summary

Doesn't build due to fat template error of being too large

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sbruno retitled this revision from to Start of EFI32 boot loader support.
sbruno updated this object.
sbruno edited the test plan for this revision. (Show Details)
sbruno added a reviewer: emaste.

currently errors out with:

===> sys/boot/efi/boot1 (all)
boot1 8704 bytes too large; regenerate FAT templates?
*** Error code 1
sys/boot/efi/loader/arch/i386/exec.c
39 ↗(On Diff #20110)

how does btxld come into play here?

sys/boot/efi/loader/copy.c
43 ↗(On Diff #20110)

why?

sys/boot/ficl/loader.c
803 ↗(On Diff #20110)

better fix needed here :)

sys/boot/efi/loader/copy.c
43 ↗(On Diff #20110)

ew ... debugging test was inserted here. Your tree predated this change. I'll remove this.

sys/boot/efi/loader/arch/i386/exec.c
39 ↗(On Diff #20110)

Cut-n-paste comment here. Should have read something to the effect of "fix missing definition for exit()"

===> sys/boot/efi/loader (all)
/home/sbruno/bsd/fbsd_head/sys/boot/efi/loader/arch/i386/exec.c:51:2: error: implicit declaration of function 'exit' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        exit(1);
        ^
1 error generated.

Slightly more improved version of the build for EFI32 support.

This doesn't quite do what I want it to do, which is build a loader/ficl
for EFI and non-efi, but its good enough for science and fixes issues with
the review that emaste pointed out.

This still bails as we're 8k over? I'm super confused how this is happening.

cc -target i386-unknown-freebsd12.0 --sysroot=/var/tmp/i386.i386/home/sbruno/bsd/fbsd_head/tmp -B/var/tmp/i386.i386/home/sbruno/bsd/fbsd_head/tmp/usr/bin -O2 -pipe -I. -I/home/sbruno/bsd/fbsd_head/sys/boot/efi/boot1/../include -I/home/sbruno/bsd/fbsd_head/sys/boot/efi/boot1/../include/i386 -I/home/sbruno/bsd/fbsd_head/sys/boot/efi/boot1/../../../contrib/dev/acpica/include -I/home/sbruno/bsd/fbsd_head/sys/boot/efi/boot1/../../.. -DEFI_UFS_BOOT -I/home/sbruno/bsd/fbsd_head/sys/boot/efi/boot1/../../zfs/ -I/home/sbruno/bsd/fbsd_head/sys/boot/efi/boot1/../../../cddl/boot/zfs/ -I/home/sbruno/bsd/fbsd_head/sys/boot/efi/boot1/../../../crypto/skein -DEFI_ZFS_BOOT -I/home/sbruno/bsd/fbsd_head/sys/boot/efi/boot1/../../common -fPIC -march=i386 -mno-aes -ffreestanding -Wformat -msoft-float -mno-mmx -mno-sse -mno-avx -g -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Qunused-arguments  -Wl,-T/home/sbruno/bsd/fbsd_head/sys/boot/efi/boot1/../loader/arch/i386/ldscript.i386 -Wl,-Bsymbolic -shared -Wl,-znocombreloc -nostdlib -o boot1.sym.full boot1.o self_reloc.o start.o ufs_module.o zfs_module.o skein.o skein_block.o  -lstand
objcopy --only-keep-debug boot1.sym.full boot1.sym.debug
objcopy --strip-debug --add-gnu-debuglink=boot1.sym.debug  boot1.sym.full boot1.sym
if nm boot1.sym | grep ' U '; then  echo "Undefined symbols in boot1.sym";  exit 1;  fi
SOURCE_DATE_EPOCH=1451606400  objcopy -j .peheader -j .text -j .sdata -j .data  -j .dynamic -j .dynsym -j .rel.dyn  -j .rela.dyn -j .reloc -j .eh_frame  --output-target=efi-app-ia32 boot1.sym boot1.efi
boot1 8704 bytes too large; regenerate FAT templates?
*** Error code 1

Thanks to Allan, shrink the skein_block code significantly by not
unrolling loops. This now allows me to get to the first kernel boot
twiddle, but not much else. :-(

Functional Loader though, not too shabby.

sys/boot/ficl/loader.c
1007 ↗(On Diff #20156)

This sucks. This means we have to build two different images for ficl, one for the EFI build and one for the !EFI build. A better approach would be to kick these functions to a specific .o that's only included in loader and not loader.efi. You should get that jerk that put these in to fix it for you... Oh, wait, who was that again :)

sys/boot/ficl/loader.c
1007 ↗(On Diff #20156)

*IF ONLY THIS WERE POSSIBLE*

:-)

Drop skein build modifications in preference to D7824

Drop skein build modifications in preference to D7824

I think you mean D7826 instead, the skein sys/boot change?

tsoome added inline comments.
sys/boot/ficl/loader.c
1007 ↗(On Diff #20156)

You actually will need multiple ficl images to be built anyhow, because booting UEFI32 will need 32bit boot1 and 32bit loader, and booting 64bit UEFI needs 64bit boot1 and 64bit loader. Even with 32bit UEFI, you still wanna test and boot 64bit kernel (if the hardware allows and you have the kernel variant). And this is because of 64bit systems which are actually using 32bit UEFI (like intel atom).

sys/boot/ficl/Makefile
47 ↗(On Diff #20310)

This code block is superseded by D8145 and will be dropped.

sys/boot/ficl/loader.c
1007 ↗(On Diff #20156)

This code block has been superseded by D8145 and will be dropped.

803 ↗(On Diff #20110)

This code block has been superseded by D8145 and will be dropped.

sbruno edited edge metadata.

FICL loader changes will not be required once D8145 hits the tree.

sys/boot/efi/Makefile
18 ↗(On Diff #21040)

I would suggest we don't commit this part until we're at least close to having the kernel side in place.

targets/pseudo/userland/misc/Makefile.depend
80 ↗(On Diff #20310)

this change looks good

sbruno added inline comments.
sys/boot/efi/Makefile
18 ↗(On Diff #21040)

Wouldn't removing this make it more difficult for folks to start working on real booting support? Or does this change do something other than what I think?

sys/boot/efi/Makefile
18 ↗(On Diff #21040)

I just mean that until there's a kernel it can boot, having a i386 loader.efi might be more confusing to end users. Folks working on boot support can carry this tiny patch or just build the i386 loader directly.

Drop the actual building of i386 loader.efi to not confuse people
into thinking that it *works*.

This revision is now accepted and ready to land.Oct 14 2016, 4:57 PM
This revision was automatically updated to reflect the committed changes.