Creating an ISO Image from source

Hello.

I want to create a custom patched ISO image for FreeBSD 8.4.0, so I followed these steps (I used VirtualBox to do this):
  1. I installed a fresh FreeBSD-8.4.0 system and decompressed sources from CD with # ./install.sh.
  2. I used freebsd-update(8) and updated the system (binary, kernel, sources).
freebsd-update(8) tells me that I'm on -p19. So what I want is to recompile kernel, world, and finally build an ISO image from that, but doing some customizations like compiling PF inside the kernel, not building rescue environments and so on (think of a slim ISO image). So can any one help me providing an optimized src.conf, make.conf or point me to other than to handbook to get more information?

Thanks.
 
So what I want is to recompile kernel, world, and finally build an ISO image from that, but doing some customizations like compiling PF inside the kernel, not building rescue environments and so on (think of a slim ISO image). So can any one help me providing an optimized src.conf, make.conf or point me to other than to handbook to get more information?
Have a look at release(7) and the scripts in /usr/src/release.
 
Thanks! I successfully rebuilt all and made the DVD! But can you recommend a similar article or a place where I can find the article written by Poul-Henning Kamp: http://phk.freebsd.dk/misc/build_options

But this article doesn't exist any more. So I can understand the meaning of different knobs.

Thanks.
 
Also trying to ask similar questions. By following the pointer here, I successfully make release.

Having read the handbook and release(7), I have have two related newbie questions:
1.) Can the source be in the directory other than /usr/src & /usr/obj?
2.) Can the release process be done by non-root user?

Thanks.
 
1.) Can the source be in the directory other than /usr/src & /usr/obj?
Yes, there's no need to set anything for /usr/src/, just cd ${MYSOURCEDIR}/release and work from there. For /usr/obj you can set MAKEOBJDIRPREFIX.

2.) Can the release process be done by non-root user?
Yes, if MAKEOBJDIRPREFIX points to a directory that's writable by the non-root user. If you only want to build release(7) you can skip the installkernel/installworld bit. After building the kernel and world go directly to make release. Obviously DESTDIR needs to be writable by the user too.
 
Yes, there's no need to set anything for /usr/src/, just cd ${MYSOURCEDIR}/release and work from there. For /usr/obj you can set MAKEOBJDIRPREFIX.

You don't have to set any variables in most cases. If your sources are at /some/path/src then the object directory will be located at /usr/obj/some/path/src which won't conflict with other sources located in other directories.
 
Thanks, this is really amazing!
In this way, I can build FreeBSD on one machine and install it on the target machine. No worry to screw up the build machine. This is a production environment to do appliance or embedded system(though this needs cross-compiling tool chain). Will try both ways out tonight.
 
Okay, I downloaded the official file ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/10.1-RELEASE/src.txz and put it in a location other than /usr/src. And tried the following:
  1. Run sh release.sh with non-root user, it failed by reminding this script must be executed by root.
  2. Run sh release.sh using root account, it failed with messages
    Code:
    install -o nobody -g wheel -m 644 /dev/null  /scratch/var/db/locate.database
    install -o root -g wheel -m 644 /scratch/usr/src/etc/minfree  /scratch/var/crash
    cd /scratch/usr/src/etc/..; install -o root -g wheel -m 444  COPYRIGHT /scratch/
    install -o root -g wheel -m 444  /scratch/usr/src/etc/../sys/amd64/conf/GENERIC.hints  /scratch/boot/device.hints
    ELF ldconfig path: /lib /usr/lib /usr/lib/compat
    32-bit compatibility ldconfig path: /usr/lib32
    make: "/usr/ports/Mk/bsd.port.mk" line 1219: UNAME_r (11.0-CURRENT) and OSVERSION (1001000) do not agree on major version number.
    
    root@FS1:/usr/src/release # uname -r
    10.1-RELEASE-p2
    Not sure this is an known issue or sh release.sh isn't the right way.
  3. After searching on this forum, by following Thread 47242 using the command sequence
    Code:
    cd /usr/src
    make buildworld buildkernel
    cd release
    make release
    make install DESTDIR=/var/freebsd-snapshot
    Finally, I succeeded:
    Code:
    root@FS1:/var/log # ls /var/freebsd-snapshot/
    CHECKSUM.MD5
    CHECKSUM.SHA256
    FreeBSD-10.1-RELEASE-amd64-bootonly.iso
    FreeBSD-10.1-RELEASE-amd64-disc1.iso
    FreeBSD-10.1-RELEASE-amd64-memstick.img
    FreeBSD-10.1-RELEASE-amd64-mini-memstick.img
    FreeBSD-10.1-RELEASE-amd64-uefi-bootonly.iso
    FreeBSD-10.1-RELEASE-amd64-uefi-disc1.iso
    FreeBSD-10.1-RELEASE-amd64-uefi-memstick.img
    FreeBSD-10.1-RELEASE-amd64-uefi-mini-memstick.img
  4. I didn't specify MAKEOBJDIRPREFIX, and as what kpa mentioned. Obj files are put in /usr/obj/some/path/src
 
The scripts in the release directory try to do a lot stuff automatically. I've never used them to be honest. I used svn to get the source tree and did the command sequence you found.

Some settings that could be helpful, you can set SRC_CONF to a custom src.conf(5) and MAKE_CONF to a custom make.conf(5). I also use NOPORTS and NODOC as I usually don't need them. The ports tree I always fetch when the system is installed.
 
Thanks SirDice.
After some research, looks I hit issue found in Thread 49295
Like what you said, release.sh will do much more things than make buildworld buildkernel.
It will touch some files or check something in /usr/ports. In my setup, looks /usr/src is out of sync with /usr/ports for some reason. But not sure how can source code becomes 11.0-CURRENT.
Code:
root@FS1:~ # make -C /usr/ports -V OSVERSION
1001000
root@FS1:~ # uname -r
10.1-RELEASE-p2
For now, I will follow your best practice.
 
Back
Top