Part1 - Recompiling Linux Core 4.7.7 for Equal-cost Routes

The article describes steps to recompile Core Linux 4.7.7 with the kernel 3.0.21 in order to have redundant multiple equal-cost routes presented in a kernel routing table.

The following two points must be accomplished to get it working.

1. Quagga routing suite

Quagga must to be compiled with parameter --enable-multipath=ARG to allow to copy multiple equal-cost routes to the kernel routing table. Parameter ARG determines maximum number of equal routes. When ARG equals 0, the number of routes is unlimited.

2. Kernel have to be compiled with following options enabled.

CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_ROUTE_VERBOSE=y

These parameters are set in default Core kernel config file.

CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
# CONFIG_IP_ROUTE_MULTIPATH is not set
# CONFIG_IP_ROUTE_VERBOSE is not set

As you can see Core kernel had not been compiled with MULTIPATH option enabled. For this reason we have to enable it and recompile kernel. If you do not do it, even multiple cost-equal routes are presented in running-config file of Quagga but not presented in the kernel routing table.

1. Start Core Linux

Assuming you have your Core already installed, start it.

qemu-kvm -no-acpi -boot c linux-microcore-4.7.7-clean.img -m 1G

2. Download and untar Linux kernel 3.0.21 patched for Core Linux

$ sudo su

# mkdir /usr/src/
# cd /tmp

# wget http://distro.ibiblio.org/tinycorelinux/4.x/x86/release/src/kernel/linux-3.0.21-patched.txz

# tar xvf linux-3.0.21-patched.tar.xz
# rm linux-3.0.21-patched.tar.xz

# sudo mv ./linux-3.0.21/ /usr/src

Note: If you want to keep kernel persistently in /usr/src/, you must edit /opt/.filetool.lst and add /usr/src/ to the list of after-restart kept files.

/usr/bin/filetool -b

3. Install tools for compiling and download an original .config kernel file

tce-load -wi compiletc.tcz ncurses-dev perl5

Note: Perl is needed by make command.

cd /usr/src/

Download the kernel config file.

sudo wget tp://distro.ibiblio.org/tinycorelinux/4.x/x86/release/src/kernel/config-3.0.21-tinycore

Create a symbolic link /usr/src/linux pointing to /usr/src/linux-3.0.21 and copy config file to /usr/src/linux.

# sudo ln -sf linux-3.0.21/ linux
# sudo cp ./config-3.0.21-tinycore ./linux/.config/

4. Enable MULTIPATH support in kernel config file, and build the new kernel

# sudo su
# cd /usr/src/linux/

# sudo make oldconfig
# make menuconfig

Navigate to:

Networking support-> Networking Options

Enter Y to include both options - IP: equal cost multipath and IP: verbose route monitoring. Exit and select Yes. Configuration will be saved to the file  /usr/src/linux/.config.

Build the kernel.

make bzImage

In the end, your new kernel bzImage is saved to /usr/src/linux/arch/x86/boot/. Replace old kernel with the new one and reboot.

mv /usr/src/linux/arch/x86/boot/bzImage /mnt/sda1/boot/vmlinuz

After boot, check if the new kernel is loaded. Use uname -ra command.

References
http://pontus.ullgren.com/view/multiple_interfaces_on_the_same_subnet
http://www.linfo.org/vmlinuz.html

5 thoughts on “Part1 - Recompiling Linux Core 4.7.7 for Equal-cost Routes

  1. Thank you.
    I find it a more detailed explanation of the recompiling Microcore, than on the official wiki. But I have a problem, I get an error when doing "make oldconfig":

    /usr/src/linux-3.0.3# make oldconfig
    make: *** No rule to make target `oldconfig`. Stop.
    /usr/src/linux-3.0.3#

    Where can I find it rule?

Leave a comment

Your email address will not be published. Required fields are marked *