diff --git a/README b/README new file mode 100644 index 0000000000000000000000000000000000000000..b01afa017dc14a1c142a9028dde520be3ecf01b3 --- /dev/null +++ b/README @@ -0,0 +1,164 @@ + +This directory hosts the minic and nic drivers for the WR switch. The +minic, together with the underlying vhdl implementation, is work by +Tomasz Wlostowski. The rest and any bug is by Alessandro Rubini, +but Tom helped integrating with the new vhdl and testing stuff. + + Structure of this package + ========================= + +README + This file. + +COPYING + GNU GPL Version 2. This package is copyrighted by CERN and + released as free software. + +Makefile + Used to compile the various drivers. You should set LINUX + in your environment or in the command line of "make". + +wr_vic/ +wr_minic/ + The directories host original work by Tomasz, copied here from svn. + +patches/ + The directory hosts the kernel patches, split by kernel versions. + I have a git tree for that, and the patches here have been + spit out by "git format-patch". See a later section about git. + +nic/ + This is the new driver, for the new logic design. + + + Compiling the kernel + ==================== + +To compile the kernel, you need to retrieve the pristine sources for +2.6.35 and apply the patches for the switch. You can do that using git +or with old-style tar+patch. See the subsection about how to get +the sources. + +Once you have the wrswitch kernel, you should cd to its main directory +and compile in this way. Note that the CROSS_COMPILE prefix may be the +one you built using buildroot or more or less any other cross-gcc. The +CROSS_COMPILE variable must end with the hyphen tha appears before "gcc" +in the name of the actual compiler. + + export ARCH=arm + export CROSS_COMPILE=/path/to/cross/arm-linux- + make wrswitchv2_defconfig + make uImage + +Finally, copy the uImage to your tftp server directory, as the +boot-loader in the switch is preconfigured to get a file called +"uImage" from your tftp server. + + cp arch/arm/boot/uImage /tftpboot + + Using git + --------- + +If you use git, you are expected to already have some copy of Linus' +official tree. Let's say it's in /usr/src/linux-vanilla.git . In that +case, you should first check out 2.6.35 and then fetch the wrswitch +branch. The git tree where I have the stuff is + git://gnudd.com/linux-wrswitchv2/ + +What follows is one possible way, adding branches to the vanilla +tree. (I use different names for the various items to help the +non-expert git user in differentiatine them, a cleaner approach would +be using "wrswtichv2" for all items in the different ocntexts). + + cd /usr/src/linux-vanilla.git + git remote add gnudd git://gnudd.com/linux-wrswitchv2/ + git fetch gnudd + git checkout -b wr-kernel gnudd/wrswitch2-dev + +Af this point, you checkout is a new branch that corresponds to the +"wrswitch2-dev" branch on my gnudd server. + +Another option is creating a different checkout that uses data from +the Linus tree you already have on your system. (Strictly speaking, +you can avoid creating the "linus" remote to fetch it, but I feel this +is clearer). + + export GIT_ALTERNATE_OBJECT_DIRECTORIES=/usr/src/linux-vanilla.git/objects + mkdir /usr/src/linux-wr + cd /usr/src/linux-wr + git init + git remote add linus /usr/src/linux-vanilla.git/objects + git remote add gnudd git://gnudd.com/linux-wrswitchv2/ + git fetch linus + git fetch gnudd + git checkout -b wr-kernel gnudd/wrswitch2-dev + +Please note that if you don't have a local "Linus" tree first, your +fetch from gnudd will take several hours. You should first fetch from +a mainstream server the official kernel to make this operation fast. + +To make the "GIT_ALTERNATE_OBJECT_DIRECTORIES" setting persistent, you +can save it to local repository: + + echo /usr/src/linux-vanilla/objects > .git/objects/info/alternates + + Using tar and patch + ------------------- + +If you are not a git user, you might apply the patches, with this +procedure, using your national mirror instead of ch.kernel.org. +Let's assume your starting current directory is the one where this +README lives. + + DOCDIR=$(/bin/pwd) + cd /usr/src/linux-wr + wget ftp://ftp.ch.kernel.org/pub/linux/kernel/v2.6/linux-2.6.35.tar.bz2 + tar xjf linux-2.6.35.tar.bz2 + mv linux-2.6.35/* linux-2.6.35/.??* . + rmdir linux-2.6.35 + for n in in $DOCDIR/patches/2.6.35/*; do cat $n | patch -p1; done + + + Compiling the modules + ===================== + +To compile the drivers please run "make", after setting up +the proper environment variables: + + LINUX + should point to the kernel directory. For example, + export LINUX=/usr/src/linux-wr + CROSS_COMPILE + should be the same prefix you used to cross-compile the + kernel. If CROSS_COMPILE_ARM is set, it is used as a + default (the name CROSS_COMPILE_ARM is used in wrdev2 scripts) + ARCH + should be "arm", but the Makefile set it if not defined. + +With the variables in place, after "make" you'll have a few kernel +modules, with extension ".ko", that should be copied to the target +system and loaded. Let's assume the target is T=192.168.1.23 + + scp $(find . -name '*.ko') root@$T:/wr/lib/modules + +The previous command assumes you either know the root password of your +private key is authorized in the target system. The latter happens if +you build the filesystem using wrdev2, which copies your public key to +the target. + + Integration with wrdev2 + ======================= + +Tomasz released some scripts, as a standalong "wrdev2.tar.gz" package +and available in the White Rabbit svn under "build_scripts". The svn +version is better as the ramdisk is made using initramfs rather then +ext2.gz. + +This code is replacing part of that material with different +procedures, and integration is currently non-existent. + +You are expected to build the switch system using the other script-set +and then replace the kernel and modules with what is available here. +Over time I plan to integrate better, and possibly replace wrdev2 by +bringing in here all the good material that is found there. +