Sunday, August 19, 2012

Rebuilding World and Kernel on FreeBSD

Building the world and kernel on FreeBSD is just few steps procedure. The Handbook explains everything in great details. Here is short version.
  1. Synchronize the OS source code (see here).
  2. Configure make.conf.
  3. Optional. Configure world options (file /etc/src.conf):
    WITHOUT_AMD=
    WITHOUT_ASSERT_DEBUG=
    # Need only few utilities from bind
    WITHOUT_BIND_DNSSEC=
    WITHOUT_BIND_ETC=
    WITHOUT_BIND_LIBS_LWRES=
    WITHOUT_BIND_MTREE=
    WITHOUT_BIND_NAMED=
    WITHOUT_BLUETOOTH=
    # This saves build time twice
    WITHOUT_CLANG=
    WITHOUT_FLOPPY=
    WITHOUT_FREEBSD_UPDATE=
    WITHOUT_GAMES=
    WITHOUT_GDB=
    WITHOUT_HTML=
    WITHOUT_INET6=
    WITHOUT_IPX=
    # On amd64, set to not build 32-bit library set
    #WITHOUT_LIB32=
    WITHOUT_LPR=
    WITHOUT_NCP=
    WITHOUT_NDIS=
    WITHOUT_PROFILE=
    WITHOUT_RCS=
    WITHOUT_SYSINSTALL=
    WITHOUT_TELNET=
    WITHOUT_WIRELESS=
    WITHOUT_WPA_SUPPLICANT_EAPOL=
    WITHOUT_ZFS=
    # If you are building world for jail
    WITHOUT_ACPI=
    WITHOUT_APM=
    WITHOUT_ATM=
    WITHOUT_AUTHPF=
    WITHOUT_BLUETOOTH=
    WITHOUT_BOOT=
    WITHOUT_CDDL=
    WITHOUT_DICT=
    WITHOUT_EXAMPLES=
    WITHOUT_FORTH=
    WITHOUT_GAMES=
    WITHOUT_GPIB=
    #WITHOUT_INFO=
    WITHOUT_IPFILTER=
    WITHOUT_IPFW=
    WITHOUT_IPX=
    WITHOUT_JAIL=
    WITHOUT_LEGACY_CONSOLE=
    #WITHOUT_MAN=
    #WITH_MAN_UTILS=
    WITHOUT_NETGRAPH=
    WITHOUT_NIS=
    WITHOUT_NTP=
    WITHOUT_PF=
    WITHOUT_PMC=
    WITHOUT_PPP=
    WITHOUT_PROFILE=
    WITHOUT_RESCUE=
    WITHOUT_ROUTED=
    WITHOUT_SHAREDOCS=
    WITHOUT_USB=
    
  4. Configure Kernel:
    cd /usr/src/sys/i386/conf
    cp GENERIC /root/kernels/STABLE
    ln -s /root/kernels/STABLE
    
    Ensure the following (file /root/kernels/STABLE):
    #cpu            I486_CPU
    #cpu            I586_CPU
    cpu             I686_CPU
    ident           STABLE
    #makeoptions    DEBUG=-g
    
    Comment out other options that you find reasonable, e.g. INET6, etc. In order to narrow the device list to just one specific to your hardware try the following (where device_name is ahci, eisa, etc):
    dmesg | grep device_name 
    
    If the above does not return anything for your hardware go ahead and comment that device.
  5. Build World and Kernel (this is time consuming and may take 50 and 15 mins accordingly):
    cd /usr/src/
    time make -sj4 buildworld
    time make -sj4 buildkernel KERNCONF=STABLE
    
  6. Reboot to Single User Mode:
    shutdown now
    
  7. Install Kernel and World:
    mount -u /
    mount -a -t ufs
    swapon -a
    cd /usr/src/
    make installkernel KERNCONF=STABLE
    make installworld
    
  8. Update configuration files (automatically install any files that do not exist in the destination directory, attempt to auto upgrade files that have not been user modified):
    mergemaster -Ui
    
  9. Clean up
    cd /usr/obj
    chflags -R noschg *
    rm -rf *
    
Reboot your system. You should have now system installed from source.

No comments :

Post a Comment