From owner-freebsd-hackers@FreeBSD.ORG Mon Jan 21 00:39:00 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6C7616A41A for ; Mon, 21 Jan 2008 00:39:00 +0000 (UTC) (envelope-from ticso@cicely12.cicely.de) Received: from raven.bwct.de (raven.bwct.de [85.159.14.73]) by mx1.freebsd.org (Postfix) with ESMTP id 492F513C44B for ; Mon, 21 Jan 2008 00:39:00 +0000 (UTC) (envelope-from ticso@cicely12.cicely.de) Received: from cicely5.cicely.de ([10.1.1.7]) by raven.bwct.de (8.13.4/8.13.4) with ESMTP id m0L0cuFR093635; Mon, 21 Jan 2008 01:38:56 +0100 (CET) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (cicely12.cicely.de [10.1.1.14]) by cicely5.cicely.de (8.13.4/8.13.4) with ESMTP id m0L0cm3h031342 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 21 Jan 2008 01:38:49 +0100 (CET) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (localhost [127.0.0.1]) by cicely12.cicely.de (8.13.4/8.13.3) with ESMTP id m0L0cmwG025641; Mon, 21 Jan 2008 01:38:48 +0100 (CET) (envelope-from ticso@cicely12.cicely.de) Received: (from ticso@localhost) by cicely12.cicely.de (8.13.4/8.13.3/Submit) id m0L0cmSD025640; Mon, 21 Jan 2008 01:38:48 +0100 (CET) (envelope-from ticso) Date: Mon, 21 Jan 2008 01:38:48 +0100 From: Bernd Walter To: Adrian Penisoara Message-ID: <20080121003847.GI22192@cicely12.cicely.de> References: <78cb3d3f0801201239x18c339a6sbc6a04d2b5670b81@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <78cb3d3f0801201239x18c339a6sbc6a04d2b5670b81@mail.gmail.com> X-Operating-System: FreeBSD cicely12.cicely.de 5.4-STABLE alpha User-Agent: Mutt/1.5.9i X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED=-1.8, BAYES_00=-2.599 autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on cicely12.cicely.de Cc: freebsd-hackers@freebsd.org Subject: Re: Squeezing out some 70 bytes out of the boot2 loader X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ticso@cicely.de List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jan 2008 00:39:00 -0000 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.Walter http://www.bwct.de http://www.fizon.de bernd@bwct.de info@bwct.de support@fizon.de