Re: Squeezing out some 70 bytes out of the boot2 loader
... > > > [1] I'm trying to get support for /boot being mounted as a separate FS > > and > > > as such I would need to have a "self-pointing" symlink (e.g. "boot -> ." > > ) You're going about this the wrong way; no need to modify the boot2 source, just place a boot.config in the root of the /boot, with a single line: '/loader', then everything works fine. ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Squeezing out some 70 bytes out of the boot2 loader
Hi, On Jan 21, 2008 12:21 AM, Tim Kientzle <[EMAIL PROTECTED]> wrote: > Adrian Penisoara wrote: > > Hello > > > > I am trying to hack in some symlink support into the > [sys/boot/i386/]boot2 > > bootloader (for my project [1]) and I seem to fall short of about 69 > bytes: > > > ... > > > > [1] I'm trying to get support for /boot being mounted as a separate FS > and > > as such I would need to have a "self-pointing" symlink (e.g. "boot -> ." > ) > > Just because there is a symlink doesn't mean boot2 has > to follow it. > > I haven't looked at the boot2 code, but I presume > there's the equivalent of "chdir boot" in there. > What if you just ignored failure (if there's no > "boot" entry or "boot" isn't a dir, assume the > boot files are in the root of the FS). > > Wouldn't that work just as well and require less space? Actually the code which should be modified is common for multiple platforms/loaders and I fear I might be breaking more things than resolving what I want. And I would not like adding yet another hardcoded "/boot" string in there ;). Thanks, Adrian Penisoara ROFUG / EnterpriseBSD ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Squeezing out some 70 bytes out of the boot2 loader
Hi, On Jan 21, 2008 2:38 AM, Bernd Walter <[EMAIL PROTECTED]> wrote: > On Sun, Jan 20, 2008 at 10:39:45PM +0200, Adrian Penisoara wrote: > > Hello > > > > I am trying to hack in some symlink support into the > [sys/boot/i386/]boot2 > > bootloader (for my project [1]) and I seem to fall short of about 69 > bytes: > > > > as -o boot2.o boot2.s > > ld -static -N --gc-sections -nostdlib -Ttext 0x2000 -o > > boot2.out/build/obj/build/src/sys/boot/i386/boot2/../btx/lib/crt0.o > > boot2.o sio.o > > objcopy -S -O binary boot2.out boot2.bin > > btxld -v -E 0x2000 -f bin -b > > /build/obj/build/src/sys/boot/i386/boot2/../btx/btx/btx -l boot2.ldr -o > > boot2.ld -P 1 boot2.bin > > kernel: ver=1.01 size=7b0 load=9000 entry=9010 map=16M pgctl=1:1 > > client: fmt=bin size=1581 text=0 data=0 bss=0 entry=0 > > output: fmt=bin size=1e45 text=114 data=1d31 org=0 entry=0 > > -69 bytes available > > *** Error code 1 > > > > What can I do to get room for about 70-100 bytes for these changes to > make > > it into the bootloader ? > > > > [1] I'm trying to get support for /boot being mounted as a separate FS > and > > as such I would need to have a "self-pointing" symlink (e.g. "boot -> ." > ) > > to easily mask the fact that the boot stuff is now right in the root of > that > > FS. Fortunately the FORTH loader does support symlinks and I do not get > > problems with it. I know that I can use /boot.kernel as a workaround, > but > > that is not too elegant. > > The support is already there - at least to some definition. > You just need to symlink it the other way, so the kernel sees the > symlink and not the bootcode: > Mount your boot-FS into /bootdir with a /boot subdir inside. > So on ypur running system you have /bootdir/boot. > Then symlink /boot on your real /-FS to /bootdir/boot and you are fine > with tools expecting /boot on your running system. > Fill the directory with the usual content. > boot2 and later loader stages will just see it's normal /boot inside > with everything in it. Yes, it would work indeed, with quite minimal overhead, but it's not elegant enough for my taste. Fortunately /boot/loader knows how to deal with symlinks so I can push [1] a "boot -> ." symlink [2] into the boot partition, it's just the boot2 loader who doesn't know about this. [1] Actually I also need to get the boostrap code file (/boot/boot used by bsdlabel -B) out of the way first, renaming it to something more meaningful (e.g. /boot/bootstrap). [2] I seem to remember Linux was once doing this symlink once, but I guess that nowadays, when GRUB became the default bootloader, its utility has disappeared. > This is already published on http://wiki.freebsd.org/ZFSOnRoot for > having a non UFS filesystem as /. > Actually I am trying to build myself a ZFS root structure too. Thanks for the tip. Regards, Adrian Penisoara ROFUG / EnterpriseBSD ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Squeezing out some 70 bytes out of the boot2 loader
Hi, On Jan 31, 2008 8:58 PM, Eduardo Morras <[EMAIL PROTECTED]> wrote: > At 21:39 20/01/2008, you wrote: > > >Hello > > > > I am trying to hack in some symlink support into the > [sys/boot/i386/]boot2 > >bootloader (for my project [1]) and I seem to fall short of about 69 > bytes: > > > >as -o boot2.o boot2.s > >ld -static -N --gc-sections -nostdlib -Ttext 0x2000 -o > >boot2.out/build/obj/build/src/sys/boot/i386/boot2/../btx/lib/crt0.o > >boot2.o sio.o > >objcopy -S -O binary boot2.out boot2.bin > >btxld -v -E 0x2000 -f bin -b > >/build/obj/build/src/sys/boot/i386/boot2/../btx/btx/btx -l boot2.ldr -o > >boot2.ld -P 1 boot2.bin > >kernel: ver=1.01 size=7b0 load=9000 entry=9010 map=16M pgctl=1:1 > >client: fmt=bin size=1581 text=0 data=0 bss=0 entry=0 > >output: fmt=bin size=1e45 text=114 data=1d31 org=0 entry=0 > >-69 bytes available > >*** Error code 1 > > > > What can I do to get room for about 70-100 bytes for these changes to > make > >it into the bootloader ? > > > >[1] I'm trying to get support for /boot being mounted as a separate FS > and > >as such I would need to have a "self-pointing" symlink (e.g. "boot -> ." > ) > >to easily mask the fact that the boot stuff is now right in the root of > that > >FS. Fortunately the FORTH loader does support symlinks and I do not get > >problems with it. I know that I can use /boot.kernel as a workaround, but > >that is not too elegant. > > How big is boot2? You can compress it with an arithmetic coder, and > only put the decoder plus the compressed boot2. There are very tiny > arith coders, in assm, with 100-120 bytes of code (even less). > > boot2 has a fixed 7680 bytes size and it's made up of the boot2.bin (5505 bytes, stripped off boot2.o) and "cooked" with btxld(8). I see that the resulting boot2[.ld] file must not grow over 7680 bytes. Currently boot2.ldis at 7749 bytes... I guess code compression should be hacked into [sys/boot/i386/btx/]btxldr but, since I have an easy workaround for now (touching base with /boot.config), for the moment I'd rather trust the mature and long used present code. There will be time to get back to this later, unless grub prevails or another 1st stage bootloader emerges... ;) Thanks for the tips, Adrian Penisoara ROFUG / EnterpriseBSD ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Squeezing out some 70 bytes out of the boot2 loader
At 21:39 20/01/2008, you wrote: Hello I am trying to hack in some symlink support into the [sys/boot/i386/]boot2 bootloader (for my project [1]) and I seem to fall short of about 69 bytes: as -o boot2.o boot2.s ld -static -N --gc-sections -nostdlib -Ttext 0x2000 -o boot2.out/build/obj/build/src/sys/boot/i386/boot2/../btx/lib/crt0.o boot2.o sio.o objcopy -S -O binary boot2.out boot2.bin btxld -v -E 0x2000 -f bin -b /build/obj/build/src/sys/boot/i386/boot2/../btx/btx/btx -l boot2.ldr -o boot2.ld -P 1 boot2.bin kernel: ver=1.01 size=7b0 load=9000 entry=9010 map=16M pgctl=1:1 client: fmt=bin size=1581 text=0 data=0 bss=0 entry=0 output: fmt=bin size=1e45 text=114 data=1d31 org=0 entry=0 -69 bytes available *** Error code 1 What can I do to get room for about 70-100 bytes for these changes to make it into the bootloader ? [1] I'm trying to get support for /boot being mounted as a separate FS and as such I would need to have a "self-pointing" symlink (e.g. "boot -> ." ) to easily mask the fact that the boot stuff is now right in the root of that FS. Fortunately the FORTH loader does support symlinks and I do not get problems with it. I know that I can use /boot.kernel as a workaround, but that is not too elegant. How big is boot2? You can compress it with an arithmetic coder, and only put the decoder plus the compressed boot2. There are very tiny arith coders, in assm, with 100-120 bytes of code (even less). One reason that life is complex is that it has a real part and an imaginary part -Andrew Koenig ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Squeezing out some 70 bytes out of the boot2 loader
On Sun, Jan 20, 2008 at 10:39:45PM +0200, Adrian Penisoara wrote: > Hello > > I am trying to hack in some symlink support into the [sys/boot/i386/]boot2 > bootloader (for my project [1]) and I seem to fall short of about 69 bytes: > > as -o boot2.o boot2.s > ld -static -N --gc-sections -nostdlib -Ttext 0x2000 -o > boot2.out/build/obj/build/src/sys/boot/i386/boot2/../btx/lib/crt0.o > boot2.o sio.o > objcopy -S -O binary boot2.out boot2.bin > btxld -v -E 0x2000 -f bin -b > /build/obj/build/src/sys/boot/i386/boot2/../btx/btx/btx -l boot2.ldr -o > boot2.ld -P 1 boot2.bin > kernel: ver=1.01 size=7b0 load=9000 entry=9010 map=16M pgctl=1:1 > client: fmt=bin size=1581 text=0 data=0 bss=0 entry=0 > output: fmt=bin size=1e45 text=114 data=1d31 org=0 entry=0 > -69 bytes available > *** Error code 1 > > What can I do to get room for about 70-100 bytes for these changes to make > it into the bootloader ? > > [1] I'm trying to get support for /boot being mounted as a separate FS and > as such I would need to have a "self-pointing" symlink (e.g. "boot -> ." ) > to easily mask the fact that the boot stuff is now right in the root of that > FS. Fortunately the FORTH loader does support symlinks and I do not get > problems with it. I know that I can use /boot.kernel as a workaround, but > that is not too elegant. The support is already there - at least to some definition. You just need to symlink it the other way, so the kernel sees the symlink and not the bootcode: Mount your boot-FS into /bootdir with a /boot subdir inside. So on ypur running system you have /bootdir/boot. Then symlink /boot on your real /-FS to /bootdir/boot and you are fine with tools expecting /boot on your running system. Fill the directory with the usual content. boot2 and later loader stages will just see it's normal /boot inside with everything in it. This is already published on http://wiki.freebsd.org/ZFSOnRoot for having a non UFS filesystem as /. -- B.Walterhttp://www.bwct.de http://www.fizon.de [EMAIL PROTECTED] [EMAIL PROTECTED][EMAIL PROTECTED] ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Squeezing out some 70 bytes out of the boot2 loader
Adrian Penisoara wrote: Hello I am trying to hack in some symlink support into the [sys/boot/i386/]boot2 bootloader (for my project [1]) and I seem to fall short of about 69 bytes: ... [1] I'm trying to get support for /boot being mounted as a separate FS and as such I would need to have a "self-pointing" symlink (e.g. "boot -> ." ) Just because there is a symlink doesn't mean boot2 has to follow it. I haven't looked at the boot2 code, but I presume there's the equivalent of "chdir boot" in there. What if you just ignored failure (if there's no "boot" entry or "boot" isn't a dir, assume the boot files are in the root of the FS). Wouldn't that work just as well and require less space? Cheers, Tim Kientzle ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Squeezing out some 70 bytes out of the boot2 loader
Hello I am trying to hack in some symlink support into the [sys/boot/i386/]boot2 bootloader (for my project [1]) and I seem to fall short of about 69 bytes: as -o boot2.o boot2.s ld -static -N --gc-sections -nostdlib -Ttext 0x2000 -o boot2.out/build/obj/build/src/sys/boot/i386/boot2/../btx/lib/crt0.o boot2.o sio.o objcopy -S -O binary boot2.out boot2.bin btxld -v -E 0x2000 -f bin -b /build/obj/build/src/sys/boot/i386/boot2/../btx/btx/btx -l boot2.ldr -o boot2.ld -P 1 boot2.bin kernel: ver=1.01 size=7b0 load=9000 entry=9010 map=16M pgctl=1:1 client: fmt=bin size=1581 text=0 data=0 bss=0 entry=0 output: fmt=bin size=1e45 text=114 data=1d31 org=0 entry=0 -69 bytes available *** Error code 1 What can I do to get room for about 70-100 bytes for these changes to make it into the bootloader ? [1] I'm trying to get support for /boot being mounted as a separate FS and as such I would need to have a "self-pointing" symlink (e.g. "boot -> ." ) to easily mask the fact that the boot stuff is now right in the root of that FS. Fortunately the FORTH loader does support symlinks and I do not get problems with it. I know that I can use /boot.kernel as a workaround, but that is not too elegant. Thanks for your time, Adrian Penisoara ady (at) freebsd (dot) ady (dot) ro ROFUG, EnterpriseBSD project ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"