Obtain kernel source from ISO file

I'm running FreeBSD release 9.2 as guest OS on Virtualbox in Windows. I need to "install the emulators/virtualbox-ose-additions package" as it says in the website manual . When I try to do that I get an error saying that virtualbox-ose-additions requires kernel source. Now I only have the ISO file available, and I can't write it to a DVD, and actually wouldn't really like to do so. And also I prefer not having to download them, if I ever have that option as a solution. So, is there a simple workaround using only the ISO file? I already mentioned I am running FreeBSD on VirtualBox, in case that make any difference.
 
Just mount the ISO on the 'virtual' CD/DVD drive VirtualBox gives to your guest. Mount the CD in FreeBSD: mount /cdrom. Then simply untar /cdrom/usr/freebsd-dist/src.txz.

You can also 'mount' the ISO on an md(4) device inside FreeBSD: mount -a -t vnode -f /path/to/ISO and mount whatever md(4) device gets created on /cdrom or /mnt.
 
Thank you, but, to start with, mount /cdrom won't work, I get
Code:
 mount: cdrom: unknown special file or file system
That aside, I managed to copy the src.txz to disk but when I tried to untar it, I got the error
Code:
Lzma library error: Corrupted input data
I'm not sure if it's possible that the files on the ISO are corrupted while I successfully installed FreeBSD using it. Anyway, I just removed the machine to reinstall it hoping that there will be an option to copy the source files during the install. But in case that doesn't work, and if I ever managed to get a working copy of the extracted src.txz, what am I supposed to do with it?
 
To skip the process with the loopback mount (maybe you are a "user" and can not do that), BSD tar is able to extract .iso files as if they were tar archives.
 
arsaKasra said:
That aside, I managed to copy the src.txz to disk but when I tried to untar it, I got the error
Code:
Lzma library error: Corrupted input data
What command did you try to unpack the archive?

My guess is that you forgot to use the -J ("--xz") option. These archives aren't common tarballs (which are usually compressed with either gzip or bzip2) but instead it uses xz (see the xz(1) manualpage for more information on that).
 
ShelLuser said:
What command did you try to unpack the archive?

My guess is that you forgot to use the -J ("--xz") option. These archives aren't common tarballs (which are usually compressed with either gzip or bzip2) but instead it uses xz (see the xz(1) manualpage for more information on that).

Well, honestly I can't remember if I did use the J option, but when I tried reinstalling with sources included, I again got an error about the src.txz being corrupted, apart from that, I tried extracting with 7-zip in Windows, same result. Whatever the matter was with that, I have downloaded the file and it worked fine.
 
Back
Top