Broken loader on 7.0-RC1

Oliver Fromme olli at lurza.secnetix.de
Mon Feb 4 12:37:47 UTC 2008


Nikolay Pavlov wrote:
 > While building 7.0-RC1 i've discovered that the loader file is broken in my 
 > box and i am unable to boot using it. I've already hit this problem 2 
 > months ago. After playing a bit i've found the way on how to reproduce it 
 > easily:
 > 
 > ~# cd /usr/src/sys/boot/i386
 > /usr/src/sys/boot/i386# make btx libi386 loader

I'm afraid I can't reproduce it.  I've tried the exact same
command, and it built a working loader for me.  Are you
building on i386 or amd64?  They use the same i386 loader,
but there are slight differences in the build process.

Note that your command does not build ficl nor libstand,
both of which are required for the loader.  Did you build
them before?  (However, you should get an error message
if one of them is missing.)

A simple way to check is to use this command:
    strings loader | grep /src/
Compare the output for the working and the non-working
loader.

 > [...]
 > client: fmt=elf size=283b0 text=22038 data=4248 bss=60b8 entry=0

Mine looks like this:

client: fmt=elf size=3b3b0 text=342d8 data=5248 bss=60d8 entry=0

Clearly your loader.bin ELF binary (called "client" in BTX
terms) is much smaller.  Something must be missing.

You can also check and compare the link commands (that's
the last "cc" command in the make process, only a few lines
above the snippet that you posted).  Mine looks like this:

cc -O2 -fno-strict-aliasing -pipe -DLOADER_NFS_SUPPORT -DBOOT_FORTH
-I/usr/src/sys/boot/i386/loader/../../ficl
-I/usr/src/sys/boot/i386/loader/../../ficl/i386 -DLOADER_GZIP_SUPPORT
-I/usr/src/sys/boot/i386/loader/../../common -I. -Wall
-I/usr/src/sys/boot/i386/loader/.. -I/usr/src/sys/boot/i386/loader/../btx/lib
-ffreestanding -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse
-mno-sse2 -mno-sse3  -static -Ttext 0x0 -nostdlib -o loader.sym
/usr/obj/usr/src/sys/boot/i386/loader/../btx/lib/crt0.o main.o conf.o vers.o
boot.o commands.o console.o devopen.o interp.o interp_backslash.o
interp_parse.o ls.o misc.o module.o panic.o load_elf32.o load_elf32_obj.o
reloc_elf32.o load_elf64.o load_elf64_obj.o reloc_elf64.o bcache.o isapnp.o
pnp.o interp_forth.o /usr/obj/usr/src/sys/boot/i386/loader/../../ficl/libficl.a
/usr/obj/usr/src/sys/boot/i386/loader/../libi386/libi386.a -lstand

If you're on amd64, there should be additional options
"-m32 -march=i386 -m elf_i386_fbsd", but other than that
it should look exactly the same.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"Clear perl code is better than unclear awk code; but NOTHING
comes close to unclear perl code"  (taken from comp.lang.awk FAQ)


More information about the freebsd-current mailing list