Vnx-rootfs-uml-kernel
How to create a User-Mode-Linux Kernel for VNX
Creating a Linux 3.X kernel
This document describes how to create a 32 bits UML kernel to be used with VNX. The procedure has been mainly tested for version 3.3.8, although it should work with minor changes with previous 3.X versions (it does not with 3.4 version).
This procedure has been tested over a system with Ubuntu 10.04.4 32 bits. Although the procedure should work over a 64 bits system (installing gcc-multilib and using the SUBARCH variable should do the work), we had some problems trying to compile the 32 bits kernel over a 64 bits system (mainly when linking some libraries, for example, VDE ones).
- Download and uncompress kernel sources:
wget http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.3.8.tar.gz tar xfvz linux-3.3.8.tar.gz cd linux-3.3.8
wget http://vnx.dit.upm.es/vnx/kernels/mconsole-exec-3.3.8.patch
patch -p1 < mconsole-exec-3.3.8.patch
make defconfig ARCH=um SUBARCH=i386 make menuconfig ARCH=um SUBARCH=i386
make ARCH=um SUBARCH=i386 strip linux
./linux --version ./linux --showconfig
./linux ubda=rootfs mem=128M
Note: change 'rootfs' by the root filesystem filename you will use to test the kernel.
mkdir linux-um-3.3.8-src cp linux linux-um-3.3.8-src/linux-um-3.3.8 mkdir linux-um-3.3.8-src/modules make modules_install INSTALL_MOD_PATH=linux-um-3.3.8-src/modules/ ARCH=um SUBARCH=i386 cd linux-um-3.3.8-src/modules/lib/modules/ tar cfv modules-3.3.8.tar 3.3.8 mv modules-3.3.8.tar ../../../ cd ../../../ rm -rf modules vi README-linux-um-3.3.8 cp ../.config config-linux-um-3.3.8 cd .. tar cfvz linux-um-3.3.8.tgz linux-um-3.3.8-src
Compiling old Linux 2.6.28 kernel
Recipe contributed by Markus Gegenfurtner (mgegenfu at hm.edu, mgegenfurtner at gmail.com)
Global Requirments: gcc-4.4 or below (using gcc-4.5 or higher will not work) libc6-dev-i386 ncurses-dev
Requirements for 64bit Hostsystem build a 32bit kernel: gcc-4.4-multilib
This is the receipt for building the 32bit Kernel on a 64bit Machine (this is not verbatim from actually executed commands, so be careful with possible typos!)
- Download an untar vanilla kernel:
cd /usr/local/src wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.28.10.tar.bz2 tar xfj linux-2.6.28.10.tar.bz2 cd linux-2.6.28.10
patch -p1 < mconsole-exec-2.6.28.patch
/usr/share/vnx/kernels/linux-2.6.18.10-1m --showconfig > .config vi .config (and set CONFIG_LOCALVERSION="-Xm") make menuconfig ARCH=um SUBARCH=i386 CC=gcc-4.4 # Select "Load Other Config" # Load .config # Edit Kernel using menu as you need # Exit and save
nano arch/um/os-Linux/mem.c add "#include <sys/stat.h>" to the Header (e.g. after #include <sys/param.h>) make ARCH=um SUBARCH=i386 CC=gcc-4.4 strip linux
mkdir /mnt/uml/ mount /usr/share/vnx/filesystems/vnx_rootfs_uml-debian-6.0-v022 /mnt/uml/ -o loop make modules_install ARCH=um SUBARCH=i386 CC=gcc-4.4 INSTALL_MOD_PATH=/mnt/uml/ ls /mnt/uml/lib/modules -> There should be a folder called: 2.6.28.10-Xm according to you CONFIG_LOCALVERSION umount /mnt/uml/ rm -rf /mnt/uml/
make modules_install ARCH=um SUBARCH=i386 CC=gcc-4.4 cd /lib/modules/ tar cfv modules-2.6.28.10-Xm.tar 2.6.28.10-Xm/ rm -rf /lib/modules/2.6.28.10-Xm (you don't need the modules in the host)
mv /lib/modules/modules-2.6.28.10-Xm.tar /usr/share/vnx/kernels cp /usr/local/src/linux-2.6.28.10/linux /usr/share/vnx/kernels/linux-2.6.28.10-Xm cp /usr/local/src/linux-2.6.28.10/.config /usr/share/vnx/kernels/config-2.6.28.10-Xm
cd /usr/share/vnx/kernels/ ./linux-2.6.28.10-Xm ubda=/usr/share/vnx/filesystems/vnx_rootfs_uml-debian-6.0-v022 mem=256M # Check out for errors