Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 May 2003 13:12:52 -0700
From:      Tim Kientzle <kientzle@acm.org>
To:        Gordon Tetlow <gordont@gnf.org>, imp@bsdimp.com, freebsd-arch@freebsd.org
Subject:   Re: PATCH: Dynamic /bin support
Message-ID:  <3EC2A344.2030807@acm.org>

next in thread | raw e-mail | index | archive | help
Gordon,

I found this in my mailbox; it's from
Luke Mewburn outlining the steps for
implementing a fully dynamic system.

There may be a few ideas in here that would
help you in your current work...
I know there are plenty of points
here that I had failed to consider.

As I mentioned earlier, I've built
/rescue (the patches are available
for the asking) and am happy to
assist with the rest, though my
time is pretty tight at the
moment.

Tim Kientzle


-------- Original Message --------
Return-Path: <lukem@mewburn.net>
Date: Fri, 15 Nov 2002 11:07:13 +1100
From: Luke Mewburn <lukem@netbsd.org>
To: Nate Lawson <nate@root.org>
Cc: Tim Kientzle <kientzle@acm.org>, lukem@netbsd.org
Subject: Re: Shrinking /(s)bin: A Proposal

On Thu, Nov 14, 2002 at 12:00:27PM -0800, Nate Lawson wrote:
   | > Luke,
   | >
   | > I've been looking carefully at FreeBSD's rather
   | > bloated /bin and /sbin.  I understand that
   | > NetBSD claims to have solved this and wondered
   | > if you'd be willing to discuss your solution with me.
   | >
   | > Tim Kientzle
   |
   | Luke, I contacted you earlier regarding this and now Tim has offered to do
   | some of the work to get FreeBSD dynamic.  We'd both appreciate it if you'd
   | forward us your notes and/or any scripts.  I'll coordinate with Tim to get
   | his work committed.

Hi Guys.

The changes to support "dynamic linking all applications by default"
involved a few changes.  The primary user-visible effects are
described in:
	http://mail-index.netbsd.org/current-users/2002/09/23/0001.html


The order I'd consider making the appropriate changes in FreeBSD
would be something like:

     *	Get /rescue up & running. (Or whatever path you want).
	In summary, this contains a "crunchgen(1)"ed statically
	linked binary which contains all the programs that are
	in /bin and /sbin, which you can tweak to suit.
	This is specifically to counter the people who will
	drag out the "I had a friend on Solaris/Linux/... who screwed
	ld.so and couldn't log in" arguments.  In practice, I've found
	/rescue to be more useful than the old stuff anyway ;-)
	I tweaked the building of programs in /rescue such as
	mount, fsck, and init, to try /rescue before /{,s}bin

     *	Add hooks into the bootloader's -a flag ("ask name")
	to also prompt for the path to init.
	    http://mail-index.netbsd.org/source-changes/2002/08/23/0034.html

     *	Add hooks into the shared library installation magic in
     	<bsd.lib.mk> (etc..) to allow control where the running
	shared libraries are to be installed.  See:
	    http://mail-index.netbsd.org/source-changes/2001/12/28/0003.html
	for some ideas.  (Those files have been tweaked since that
	commit to improve the mechanism).

     *	Add hooks in the building of ld.so (or ld_elf.so or whatever
     	you call it) to allow overriding of the default LD_RUN_PATH
	from just /usr/lib to /somethingelse:/usr/lib.  See:
	    http://mail-index.netbsd.org/source-changes/2001/12/28/0013.html
	    http://mail-index.netbsd.org/source-changes/2001/12/28/0012.html
	(and future commits in that directory)

     *	NetBSD's infrastructure has a make(1) variable to control
	whether programs are built statically or dynamically:
	LDSTATIC.  If it's unset, the default is to build dynamically,
	and {bin,sbin}/Makefile.inc (and a few others used to set
	LDSTATIC?=-static, to force them to be statically linked.
	You'll need to work out how to integrate that portion of the
	change into FreeBSD.

     *	Ensure your top level "make build" (or whatever) target
	builds & installs ld.elf_so (ld.so, ...) after libs but before
	the main programs

     *	Look at the MKDYNAMICROOT stuff I added in:
	    http://mail-index.netbsd.org/source-changes/2002/08/27/0051.html
	    http://mail-index.netbsd.org/source-changes/2002/08/28/0045.html
	This lets you experiment with building a fully dynamic system
	without making it the default.

     *	Once you're happy with everything, change the MKDYNAMICROOT
	default from `no' to `yes':
	    http://mail-index.netbsd.org/source-changes/2002/09/22/0052.html


I hope that helps, or at least, provides you with some pointers in the
right direction.

Luke.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3EC2A344.2030807>