Building and Installing custom kernel in FreeBSD-10

This post by Free and Open Source Software Knowledge Base shows us how to build and install a custom kernel in FreeBSD-10.

Go to the kernel source directory which contains the configurations.

cd /usr/src/sys/amd64/conf

Create a folder named kernel in the home directory of root user i.e. /root.

mkdir /root/kernels

Create a soft link in the /usr/src/sys/amd64/conf named “MYKERNEL” which links to /root/kernels/MYKERNEL file.

cp GENERIC /root/kernels/MYKERNEL
ln -s /root/kernels/MYKERNEL

Goto the folder created above.

cd /root/kernels/

Edit the file “MYKERNEL” and make the following change. This line helps us to create the new kernel which is a combination of a generic kernel and the extra features added. The following line includes the features available in a generic kernel

include         GENERIC

The other additional lines specify the features to be added in the kernel to be created.
For Example:

cpu             HAMMER
ident           GENERIC

makeoptions     DEBUG=-g                # Build kernel with gdb(1) debug symbols
makeoptions     WITH_CTF=1              # Run ctfconvert(1) for DTrace support

options         SCHED_ULE               # ULE scheduler
options         PREEMPTION              # Enable kernel thread preemption
options         INET                    # InterNETworking
options         INET6                   # IPv6 communications protocols
options         TCP_OFFLOAD             # TCP offload
options         SCTP                    # Stream Control Transmission Protocol
options         FFS                     # Berkeley Fast Filesystem
options         SOFTUPDATES             # Enable FFS soft updates support
options         UFS_ACL                 # Support for access control lists
options         UFS_DIRHASH             # Improve performance on big directories
options         UFS_GJOURNAL            # Enable gjournal-based UFS journaling
options         QUOTA                   # Enable disk quotas for UFS
options         MD_ROOT                 # MD is a potential root device

To build a file which contains all available options, run the following commands.

cd /usr/src/sys/amd64/conf
make LINT

Goto the main source folder.

cd /usr/src

Build and Install the new kernel with reference from the file “MYKERNEL”.

make buildkernel KERNCONF=MYKERNEL
make installkernel KERNCONF=MYKERNEL

Now reboot the machine to boot into the new kernel you just created now.

Original post: https://fosskb.wordpress.com/2014/11/20/building-and-installing-custom-kernel-in-freebsd-10/

WhatsApp donates 1 Million Dollars to the FreeBSD Foundation

logo_freebsdfoundationJam Koum, CEO and co-founder of WhatsApp–a company well known to deploy FreeBSD on their servers, has recently made a very generous donation of $1,000,000 to the FreeBSD Foundation. This means that their 2014 fundraising goal of $1,000,000 has been surpassed. Congratulations!

whatsapp

A Message from Jan Koum:

Last week, I donated one million dollars to the FreeBSD Foundation, which supports the open source operating system that has helped millions of programmers pursue their passions and bring their ideas to life.
I’m actually one of those people. I started using FreeBSD in the late 90s, when I didn’t have much money and was living in government housing. In a way, FreeBSD helped lift me out of poverty – one of the main reasons I got a job at Yahoo! is because they were using FreeBSD, and it was my operating system of choice. Years later, when Brian and I set out to build WhatsApp, we used FreeBSD to keep our servers running. We still do.
I’m announcing this donation to shine a light on the good work being done by the FreeBSD Foundation, with the hope that others will also help move this project forward. We’ll all benefit if FreeBSD can continue to give people the same opportunity it gave me – if it can lift more immigrant kids out of poverty, and help more startups build something successful, and even transformative.
 –Jan Koum

Official blog post: http://freebsdfoundation.blogspot.com/2014/11/freebsd-foundation-announces-generous.html

FreeBSD 10.1-RELEASE now available

freebsdlogoThe FreeBSD Release Engineering Team is pleased to announce the availability of FreeBSD 10.1-RELEASE. This is the second release of the stable/10 branch, which improves on the stability of FreeBSD 10.0-RELEASE and introduces some new features.

Some of the highlights:

  • The new console driver, vt(4), has been added.
  • Support for FreeBSD/i386 guests has been added to bhyve(4).
  • The bhyve(4) hypervisor now supports booting from a zfs(8) filesystem.
  • Support for SMP was added to the armv6 kernels and enabled by default in the configuration files for all platforms that contain multi-core CPUs.
  • Initial support for UEFI boot has been added for the FreeBSD/amd64 architecture.
  • Support has been added to cache geli(8) passphrases during system boot.
  • Support for the UDP-Lite protocol (RFC 3828) has been added to the IPv4 and IPv6 stacks.
  • The new filesystem automount facility, autofs(5), has been added.
  • The sshd(8) rc.d(8) startup script now generates ED25519 sshd(8) host keys if keys do not already exist when ssh_keygen_alg() is invoked.
  • OpenSSH has been updated to version 6.6p1.
  • The nc(1) utility has been updated to match the version in OpenBSD 5.5.
  • Sendmail has been updated to 8.14.9.
  • The unbound(8) caching resolver and ldns have been updated to version 1.4.22.
  • OpenPAM has been updated to Ourouparia (20140912).
  • OpenSSL has been updated to version 1.0.1j.
  • The pkg(8) package management utility has been updated to version 1.3.8.

For a complete list of new features and known problems, please see the online release notes and errata list, available at:

Download the ISO/image file from here: ftp://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/10.1/

Full announcement: https://www.freebsd.org/releases/10.1R/announce.html

Mount a harddisk, change password, and set default gateway in FreeBSD

How to mount a harddisk in FreeBSD

We want to access the data from a harddisk drive or an USB memory. Then we need to mount it on FreeBSD. This is done by mount the device onto an empty directory. After that is done we should be able to see what’s on that drive inside of that directory after the mount process.

First step is to create an empty directory. So imagen that user foo wants to mount the harddisk on a new folder named photos. First he need to create an directory inside of hes home directory.

1
2
3
# creates a new directory
mkdir /home/foo/photos

Next step is to mount the harddisk on the mounting point. All devices on your system can be found under /dev/ directory. In my case, I want to mount my device /dev/da1 on /home/foo/photos/ directory. So then I use this command.

1
mount /dev/da1 /home/foo/photos

You should now be able to see all the files in /home/foo/photos

How to mount other filesystems

In case we are having an USB memory device with Fat32 filesystem, we are in a situation when we have to tell FreeBSD to use a foreign filesystem. Here you have the mount command for fat/fat32.

So when I mount my usbmemory onto the /home/foo/photos/ directory I do like this.

1
mount -t msdosfs /dev/da1s1 /home/foo/photos/

For more information about which foreign filesystems are being supported by FreeBSD project, visit FreeBSD website by clicking here

How to unmount a filesystem

Let’s say that you want to remove the mounting of an device. This could be for several reasons, the most common is that you might want to erase a disk or move it over to another mount point. In case of un mounting an device do as this.

1
umount /home/foo/photos/

Make sure you are not standing inside the directory you try to unmount else it wont work.

In case you wish to mount drives on startup then we need to alter the /etc/fstab file.

http://bsdtutorial.org/freebsd/mount-a-harddisk

———————————————–

Set default gateway in FreeBSD – IPv4

The default gateway is the address to the first gateway (router) you will reach in your network from your machine. In case you’ve set IP and DNS correct but your packages cannot reach, it might be because you’ve not set the default gateway address which means that your packages don’t know where to be sent from the machine to the first router.

So let’s set the default gateway in /etc/rc.conf so it remains after every reboot of the machine. Then edit the /etc/rc.conf file and add this line.

1
defaultrouter="192.168.0.1"

And thats it, after a reboot your machine will have that address as default router.

How to remove default router and add a new one

1
2
route delete default
route add default 192.168.0.1

http://bsdtutorial.org/freebsd/set-default-gateway 

————————————————

How to change password in FreeBSD

There are two type of users, root and normal users. The user root is able to change the password on normal users and the normal users can only change their own password.

If you are logged in as root and want to change password on user flouken then do like this.

1
passwd flouken

After that command you will be asked to enter a new password for the user.

In case you’re a normal user and want to change your own password then do like this.

1
passwd

And you will be asked to enter a new password.

http://bsdtutorial.org/freebsd/change-password

BSDFan, a simple fan control utility for ThinkPads

FreeBSD user clod89 created a utility to control your ThinkPad’s fan:

If you’ve ever used FreeBSD (or any other BSD for that matter) on a ThinkPad you might have noticed the loud and erratic behavior of the fan. I’ve written a small utility as per title to manage the fan and improve silence, coolness and battery life. If anyone finds it useful I’ll make a port for it.

Be careful when playing with fan levels and temperatures.

Have fun.

https://github.com/darklightclod/bsdfan

Check out the original post here: https://forums.freebsd.org/threads/bsdfan-a-simple-fan-control-utility-for-thinkpads.48836/