Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I extract some of the folders of a stock FreeBSD install from the ISO without actually installing FreeBSD?

I am trying to build a number of cross-compilers for various major versions of FreeBSD and need to get the libc and some includes and would like to be able to extract /usr/include and /usr/lib or rather parts of them ...

Edit: given the first response I feel I have to elaborate a bit. It is trivial to mount an ISO file and I know how to do that on a number of platforms (e.g. on my Linux box: mount -o loop FreeBSD-7.0-RELEASE-amd64-disc1.iso freebsd7/). However, when you mount the installation ISOs for FreeBSD you will notice that they don't contain a folder usr as can be easily seen from the output of find -type d -name usr while inside the folder in which the ISO is mounted. Evidently the files are stored away in some format and I need to be able to parse whatever meta-information exists to find what file is the archive that contains the stuff I need to extract and then extract it.

share|improve this question
    
The files from e.g. ftp.fr.freebsd.org/pub/FreeBSD/releases/amd64/8.2-RELEASE/base are extracted with: cat base.?? | tar --unlink -xpzf - (not sure if the archive in base/ has the /usr you seek) –  hhaamu Feb 15 '12 at 21:25
    
@hhaamu's hint is good, there's a file called base.mtree that gives some insight, i.e. lists what's in the base.?? files -- and it does mention gcc. –  sr_ Feb 16 '12 at 13:07
    
@hhaamu: can you write that up as an answer, please? ... –  0xC0000022L Feb 16 '12 at 14:28

2 Answers 2

up vote 1 down vote accepted

If you download the files from e.g. ftp://ftp.fr.freebsd.org/pub/FreeBSD/releases/amd64/8.2-RELEASE/base/ (you can probably find them on your ISO, too), you can extract them with this:

cat base.?? | tar --unlink -xpzf -

(taken from the install.sh in the same directory)

In addition, the base.mtree file describes the contents of the archive.

There are other archives to be found, too. For example, manpages which contains the manual pages to be put in /usr/share/man/, kernels which contains the kernel modules, and dict which contain wordlists to be put in /usr/share/dict/

share|improve this answer

You should be able to do this (at least with the FreeBSD-9.0-RELEASE-i386-disc1.iso image) by mounting the ISO image to some location and them perform the file operations from there. Something like:

# mkdir /mnt/freebsd
# mount -t auto /path/to/install_image.iso /mnt/freebsd
# cp -r /mnt/freebsd/usr/include /some/other/location
  ...
# umount /mnt/freebsd

No need to install anything. So after you have everything, simply unmount the ISO and continue hacking. This seems to be the simplest way I can think of.

share|improve this answer
    
Okay, I had to use mount -o loop because I'm on Linux. So I have a FreeBSD 7 ISO mounted. However, find -type d -name usr gives me an empty set. I would not have asked the question if it was that trivial as I knew how to mount it. The problem is how to find the files that are apparently packed up in some way. I edited my question. –  0xC0000022L Feb 15 '12 at 16:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.