From owner-freebsd-arch@FreeBSD.ORG Wed May 14 13:11:35 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D89E137B401 for ; Wed, 14 May 2003 13:11:35 -0700 (PDT) Received: from kientzle.com (h-66-166-149-50.SNVACAID.covad.net [66.166.149.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 28CE043F85 for ; Wed, 14 May 2003 13:11:35 -0700 (PDT) (envelope-from kientzle@acm.org) Received: from acm.org (big.x.kientzle.com [66.166.149.54]) by kientzle.com (8.12.9/8.12.9) with ESMTP id h4EKBGtJ023942; Wed, 14 May 2003 13:11:16 -0700 (PDT) (envelope-from kientzle@acm.org) Message-ID: <3EC2A344.2030807@acm.org> Date: Wed, 14 May 2003 13:12:52 -0700 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:0.9.6) Gecko/20011206 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gordon Tetlow , imp@bsdimp.com, freebsd-arch@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: PATCH: Dynamic /bin support X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: kientzle@acm.org List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 May 2003 20:11:36 -0000 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: Date: Fri, 15 Nov 2002 11:07:13 +1100 From: Luke Mewburn To: Nate Lawson Cc: Tim Kientzle , 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 (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.