1 (edited by impl 2011-09-12 02:04:53)

Topic: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Newest version: kernel 3.0.x: https://forum.openwrt.org/viewtopic.php?pid=143387#p143387

Greetings all,

I have a kernel that can successfully boot and load a file system from a CF card for the RB600. It *should* also work with netboot + CF root. It's based on the MikroTik patch, but support for other boards is removed and it has been updated to work with Linux 2.6.26.5.

I'll be writing a howto sometime in the next month or so hopefully, but I don't have the time at the moment. Here's the basic steps:

1. Grab http://cynigram.com/~nfontes/rb600/linux-2.6.26.5-rb600.config and http://cynigram.com/~nfontes/rb600/linux-2.6.26.5-rb600.patch as well as the official kernel from kernel.org.
2. Patch the kernel and copy my config over (as .config of course).
3. Build the kernel using the powerpc-cross toolchain (ARCH=powerpc, not ppc!)
4. Grab a CF card and partition it with a small (16MB or so) first partition of type 0x27, and a second partition with a standard ext2/ext3/jffs filesystem with a Linux install.
5.

echo "root=/dev/sdb2" > kernparm.dat

6.

powerpc-linux-gnu-objcopy --add-section kernparm=kernparm.dat vmlinux

7.

dd if=vmlinux of=/dev/sdX1

where X is whatever device your CF card is attached as

Extra:
You might want to add yaffs2 to your kernel if you want to deal with the NAND flash. I couldn't figure out where the init was for RouterOS, but /dev/mtdblock1 should work as a root.

Problems:
* RTC doesn't work/isn't detected, so the system gets reset to 1970 every boot
* VIA Velocity (third gigabit port) driver does not work -- causes an oops. Same for Atheros wireless driver:
[    8.929511] VIA Networking Velocity Family Gigabit Ethernet Adapter Driver Ver. 1.14
[    8.937317] Copyright (c) 2002, 2003 VIA Networking Technologies, Inc.
[    8.943875] Copyright (c) 2004 Red Hat Inc.
[    8.948120] via-velocity: mac_wol_reset: STICKHW_SWPTAG -> offMachine check in kernel mode.
[    8.956590] Caused by (from SRR1=49030): Transfer error ack signal
[    8.962801] Oops: Machine check, sig: 7 [#1]
[    8.967079] RB333/RB600
[    8.969528] Modules linked in: via_velocity(+)
[    8.973996] NIP: ca08d598 LR: ca08d590 CTR: c0238ac0
[    8.978976] REGS: c6fe3c30 TRAP: 0200   Not tainted  (2.6.26.3-chapelhill0)
[    8.985954] MSR: 00049030 <EE,ME,IR,DR>  CR: 22004422  XER: 20000000
[    8.992369] TASK = c6f07570[844] 'modprobe' THREAD: c6fe2000
[    8.997868] GPR00: 00000003 c6fe3ce0 c6f07570 00000044 00000001 00000005 c023bd04 00008000
[    9.006290] GPR08: 00000001 c05c0000 00004201 c9004500 82004424 1001ec04 00000021 ca08a19c
[    9.014712] GPR16: c6e23e40 ca087b44 00000000 000000e2 000000e2 ca0874e6 ca090000 c987a000
[    9.023135] GPR24: ca094c44 c7811450 ca094cc8 c640e000 c987a000 c987a083 c7811400 c640e380
[    9.031738] NIP [ca08d598] mac_wol_reset+0x2c/0x120 [via_velocity]
[    9.037967] LR [ca08d590] mac_wol_reset+0x24/0x120 [via_velocity]
[    9.044095] Call Trace:
[    9.046546] [c6fe3ce0] [ca08d590] mac_wol_reset+0x24/0x120 [via_velocity] (unreliable)
[    9.054514] [c6fe3d00] [ca091a34] velocity_found1+0x248/0x668 [via_velocity]
[    9.061606] [c6fe3d40] [c02111f8] pci_device_probe+0x84/0xbc
[    9.067304] [c6fe3d60] [c0240de8] driver_probe_device+0xe4/0x204
[    9.073348] [c6fe3d80] [c0240f8c] __driver_attach+0x84/0x88
[    9.078949] [c6fe3da0] [c02402b4] bus_for_each_dev+0x5c/0x98
[    9.084638] [c6fe3dd0] [c0240bc4] driver_attach+0x24/0x34
[    9.090065] [c6fe3de0] [c02407fc] bus_add_driver+0xc8/0x25c
[    9.095665] [c6fe3e10] [c024119c] driver_register+0x5c/0x158
[    9.101353] [c6fe3e30] [c021146c] __pci_register_driver+0x4c/0xac
[    9.107478] [c6fe3e50] [c9878038] velocity_init_module+0x38/0xa8 [via_velocity]
[    9.114832] [c6fe3e70] [c0048924] sys_init_module+0x134/0x17a4
[    9.120711] [c6fe3f40] [c000fe54] ret_from_syscall+0x0/0x38
[    9.126322] --- Exception: c01 at 0xff6cdc8
[    9.130522]     LR = 0x10003c50
[    9.133667] Instruction dump:
[    9.136646] 4bfffe58 9421ffe0 7c0802a6 bf810010 7c7c1b78 3c60ca09 386328e8 90010024
[    9.144456] 3bbc0083 48004a4d 7c0004ac 881c0083 <0c000000> 4c00012c 700000ef 7c0004ac
[    9.152445] ---[ end trace 677587851d8cc389 ]---

Regards and have fun!

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Hi all.

I was trying to cross-compile this kernel for RB600A, but I am stuck on building a cross-compiling GCC.

I am following these 2 how-to's.

http://www.digitalhermit.com/linux/Kernel-Build-HOWTO.html

http://psas.pdx.edu/DebianCrossCompilerHowto/

While getting library packages, i had to get some extra beside those mentioned in the tutorial.
Finally i have... (note that there are gcc-4.0 and gcc-4.1 due to an error I had with gcc-4.1 in the next step)

compiler:/usr/src/cross-toolchain# ls
binutils-2.17
binutils_2.17-3.diff.gz
binutils_2.17-3.dsc
binutils_2.17.orig.tar.gz
binutils.build
binutils-powerpc-linux-gnu_2.17-3_i386.deb
gcc-4.0-4.0.3ds1
gcc-4.0_4.0.3ds1-9.diff.gz
gcc-4.0_4.0.3ds1-9.dsc
gcc-4.0_4.0.3ds1.orig.tar.gz
gcc-4.1-4.1.1ds2
gcc-4.1_4.1.1ds2-21.diff.gz
gcc-4.1_4.1.1ds2-21.dsc
gcc-4.1_4.1.1ds2.orig.tar.gz
gcc.build
libc6_2.7-13_powerpc.deb
libc6-dev_2.7-13_powerpc.deb
libc6-dev-powerpc-cross_2.7-13_all.deb
libc6-powerpc-cross_2.7-13_all.deb
libgcc1_4.1.1-21_powerpc.deb
libgcc1-powerpc-cross_4.1.1-21_all.deb
linux-kernel-headers_2.6.18-7_powerpc.deb
linux-kernel-headers-powerpc-cross_2.6.18-7_all.deb
linux-libc-dev_2.6.26-5_powerpc.deb
linux-libc-dev-powerpc-cross_2.6.26-5_all.deb

---------------------------------------------------------------------

I got to this step... and I am stuck...

Build GCC

Now that you have all the necessary prerequisites, you can build a cross-compiling GCC.

cd gcc-VERSION
export GCC_TARGET=powerpc
debian/rules control
dpkg-buildpackage -us -uc -rfakeroot -b > ../gcc.build 2>&1 || echo 'Build error'

---------------------------------------------------------------------

First I tried GCC 4.1, but got some error while compiling it.
Then I tried GCC 4.0 and it seams it works. But...

This is my output...

compiler:/usr/src/cross-toolchain/gcc-4.0-4.0.3ds1# debian/rules control
...
... // Cut //
...
fs=`echo debian/*-BV* debian/*GCJ* debian/*CXX* debian/*LC*|sort -u`; \
        for f in $fs; do \
          [ -f $f ] || echo "CANNOT FIND $f"; \
          [ -f $f ] || continue; \
          f2=$(echo $f | sed 's/BV/4.0/;s/PV/2.1/;s/CXX/6/;s/GCJ/6/;s/LC/1/;s/FFI/4/'); \
          sed -e 's/@BV@/4.0/g' \
              -e 's/@PV@/2.1/g' \
              -e 's/@CXX@/6/g' \
              -e 's/@GCJ@/6/g' \
              -e 's/@LC@/1/g' \
              -e 's/@FFI@/4/g' \
              -e 's/@GFDL@/#/g' \
            $f > $f2; \
          touch -r $f $f2; \
        done
make[1]: Leaving directory `/usr/src/cross-toolchain/gcc-4.0-4.0.3ds1'
compiler:/usr/src/cross-toolchain/gcc-4.0-4.0.3ds1# ls
bin  debian  gcc-4.0.3-dfsg.tar.bz2  src  stamps
compiler:/usr/src/cross-toolchain/gcc-4.0-4.0.3ds1# dpkg-buildpackage -us -uc -rfakeroot -b > ../gcc.build 2>&1 || echo 'Build error'
Build error
compiler:/usr/src/cross-toolchain/gcc-4.0-4.0.3ds1#

And this is my gcc.build file

dpkg-buildpackage: source package is gcc-4.0
dpkg-buildpackage: source version is 4.0.3ds1-9
dpkg-buildpackage: source changed by Matthias Klose <doko@debian.org>
dpkg-buildpackage: host architecture i386
dpkg-buildpackage: source version without epoch 4.0.3ds1-9
fakeroot debian/rules clean
rm -rf stamps
rm -rf gcc-4.0.3 gpc-20030830 p
/usr/bin/make -f debian/rules2 clean
make[1]: Entering directory `/usr/src/cross-toolchain/gcc-4.0-4.0.3ds1'
dh_testdir
rm -f pxxx status
rm -f *-summary *-protocol testsuite-comparision summary-diff
if [ -f /usr/src/cross-toolchain/gcc-4.0-4.0.3ds1/src/gcc/p/config-lang.in.debian ]; then \
          mv -f /usr/src/cross-toolchain/gcc-4.0-4.0.3ds1/src/gcc/p/config-lang.in.debian /usr$
        else true; fi
rm -f /usr/src/cross-toolchain/gcc-4.0-4.0.3ds1/src/gcc/po/*.gmo
rm -f debian/lib{ffi,g2c,gcc,gcj,objc,stdc++}{-v3,[0-9]}*.{{pre,post}{inst,rm},shlibs}
fs=`echo debian/*-BV* debian/*GCJ* debian/*CXX* debian/*LC*|sort -u`; \
        for f in $fs; do \
          [ -f $f ] || continue; \
          f2=$(echo $f | sed 's/BV/4.0/;s/PV/2.1/;s/CXX/6/;s/GCJ/6/;s/LC/1/;s/FFI/4/'); \
          rm -f $f2; \
        done
rm -f debian/shlibs.local debian/substvars.local
rm -f debian/*.debhelper
[ -d debian/bugs ] && /usr/bin/make -C debian/bugs clean
make[1]: [clean] Error 1 (ignored)
rm -f debian/README.libstdc++-baseline
rm -rf bin locales
rm -rf check-inst
dh_clean
make[1]: Leaving directory `/usr/src/cross-toolchain/gcc-4.0-4.0.3ds1'
rm -rf /usr/src/cross-toolchain/gcc-4.0-4.0.3ds1/src /usr/src/cross-toolchain/gcc-4.0-4.0.3ds1$
rm -f bootstrap-* first-move-stamp
rm -f debian/*.tmp
find debian -name '.#*' | xargs rm -f
find debian/patches -name '*.dpatch' -type f ! -perm 644 | xargs chmod 644
dh_clean
debian/rules build
The package is not built anymore for powerpc
make: *** [pre-build] Error 42

Thx for help.

3 (edited by impl 2008-10-04 06:54:57)

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Hey,

You can grab an already-built powerpc toolchain from the Emdebian Project: http://www.emdebian.org/

Just follow their instructions to set up the repository, and then install the following packages:

apt-get install binutils-powerpc-linux-gnu cpp-4.2-powerpc-linux-gnu gcc-4.2-powerpc-linux-gnu-base gcc-4.2-powerpc-linux-gnu libc6-dev-powerpc-cross libc6-powerpc-cross libgcc1-powerpc-cross linux-libc-dev-powerpc-cross

You should then be able to jump straight to building the new kernel a la:

linux-2.6.26.5$ make ARCH="powerpc" CROSS_COMPILE="powerpc-linux-gnu-"

I'll consolidate some stuff and provide a binary image when I get a chance, too.

G'luck!

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Thx for info. I got the kernel.

Just minor update (sintax error in last post from impl):

apt-get install binutils-powerpc-linux-gnu cpp-4.2-powerpc-linux-gnu gcc-4.2-powerpc-linux-gnu-base gcc-4.2-powerpc-linux-gnu libc6-dev-powerpc-cross libc6-powerpc-cross libgcc1-powerpc-cross linux-libc-dev-powerpc-cross

Now I wait to get a RB600A somehow. hmm

5 (edited by impl 2008-10-07 00:26:31)

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Hi all,

Quick update: I have updated the .config and patch above. The PCI bus is now working correctly -- it turns out that the device tree that RouterBOOT feeds the kernel is utter crap, and doesn't provide a map of IO/memory ranges for the PHB. I've made a (dangerous) assumption in assuming that the RB600 ranges are identical to those on the Freescale MPC8343_MDS test board and totally hacked support in. I have no idea whether this is true or not.

For your convenience, I've also uploaded a complete vmlinux image, prior to being objcopy'd with kernel parameters: http://cynigram.com/~nfontes/rb600/vmlinux-2.6.26.5-rb600 (7.1MB).

Here's a complete dmesg with a bit of debug output:

[    0.000000] Using Mikrotik RouterBOARD RB333/RB600 machine description
[    0.000000] Linux version 2.6.26.5-chapelhill0 (nfontes@mizuho) (gcc version 4.2.4 (Debian 4.2.4-3)) #35 Sat Oct 4 01:26:12 EDT 2008
[    0.000000] Found legacy serial port 0 for /soc8343@e0000000/serial@4500
[    0.000000]   mem=e0004500, taddr=e0004500, irq=0, clk=266664000, speed=0
[    0.000000] console [udbg0] enabled
[    0.000000] Entering add_active_range(0, 0, 32768) 0 entries of 256 used
[    0.000000] RB333/RB600: rbppc_pci_add_bridge(/soc8343@e0000000/pci@8500): Adding PCI host bridge
[    0.000000] Found RB333/RB600 PCI host bridge at 0x00000000e0008500. Firmware bus number: 0->0
[    0.000000]   Hose at 0xc05fe000 (cfg_addr=0xfdffd300, cfg_data=0xfdffd304)
[    0.000000]   Ranges:
[    0.000000]     IO: 0x0000000000000000..0x00000000e20fffff -> 0x0000000000000000
[    0.000000]     Memory: 0x0000000090000000..0x000000009fffffff -> 0x0000000090000000
[    0.000000]     Memory (prefetch): 0x0000000080000000..0x000000008fffffff -> 0x0000000080000000
[    0.000000] Top of RAM: 0x8000000, Total RAM: 0x8000000
[    0.000000] Memory hole size: 0MB
[    0.000000] Zone PFN ranges:
[    0.000000]   DMA             0 ->    32768
[    0.000000]   Normal      32768 ->    32768
[    0.000000] Movable zone start PFN for each node
[    0.000000] early_node_map[1] active PFN ranges
[    0.000000]     0:        0 ->    32768
[    0.000000] On node 0 totalpages: 32768
[    0.000000]   DMA zone: 256 pages used for memmap
[    0.000000]   DMA zone: 0 pages reserved
[    0.000000]   DMA zone: 32512 pages, LIFO batch:7
[    0.000000]   Normal zone: 0 pages used for memmap
[    0.000000]   Movable zone: 0 pages used for memmap
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: root=/dev/sdb2 debug earlyprintk=serial,ttyS0,keep loglevel=7 console=ttyS0,115200 board=mpc8343 boot=1
[    0.000000] IPIC (128 IRQ sources) at fdefc700
[    0.000000] PID hash table entries: 512 (order: 9, 2048 bytes)
[    0.000000] time_init: decrementer frequency = 66.666000 MHz
[    0.000000] time_init: processor frequency   = 399.996000 MHz
[    0.000009] clocksource: timebase mult[3c00275] shift[22] registered
[    0.006244] clockevent: decrementer mult[1111] shift[16] cpu[0]
[    0.006764] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.014337] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.035706] Memory: 123632k/131072k available (5612k kernel code, 7284k reserved, 180k data, 289k bss, 204k init)
[    0.045983] SLUB: Genslabs=12, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.053503] Calibrating delay loop... 133.12 BogoMIPS (lpj=266240)
[    0.145714] Security Framework initialized
[    0.149685] Capability LSM initialized
[    0.153411] Mount-cache hash table entries: 512
[    0.159388] Initializing cgroup subsys ns
[    0.163294] Initializing cgroup subsys cpuacct
[    0.168993] net_namespace: 652 bytes
[    0.173612] NET: Registered protocol family 16
[    0.181622] PCI: Probing PCI hardware
[    0.185590] PCI: Scanning bus 0000:00
[    0.185641] PCI: Found 0000:00:00.0 [1957/0087] 000b20 00
[    0.185684] pci 0000:00:00.0: calling <7>pci 0000:00:00.0: calling <7>PCI: Found 0000:00:0b.0 [1106/3119] 000200 00
[    0.185771] pci 0000:00:0b.0: calling <7>PCI: Found 0000:00:0c.0 [168c/0013] 000200 00
[    0.185839] pci 0000:00:0c.0: calling <7>PCI: Fixups for bus 0000:00
[    0.186005] PCI: Bus scan for 0000:00 returning with max=00
[    0.187164]   got res [90000000:9000ffff] bus [90000000:9000ffff] flags 20020200 for BAR 0 of 0000:00:0c.0
[    0.187199] PCI: moved device 0000:00:0c.0 resource 0 (20200) to 90000000
[    0.187220]   got res [1000:10ff] bus [1000:10ff] flags 20020101 for BAR 0 of 0000:00:0b.0
[    0.187240] PCI: moved device 0000:00:0b.0 resource 0 (20101) to 1000
[    0.187260]   got res [90010000:900100ff] bus [90010000:900100ff] flags 20020200 for BAR 1 of 0000:00:0b.0
[    0.187282] PCI: moved device 0000:00:0b.0 resource 1 (20200) to 90010000
[    0.187301] Registering qe_ic with sysfs...
[    0.187818] Registering ipic with sysfs...
[    0.203845] SCSI subsystem initialized
[    0.207704] libata version 3.00 loaded.
[    0.210035] i2c-core: driver [dummy] registered
[    0.239125] NET: Registered protocol family 2
[    0.243388] Switched to high resolution mode on CPU 0
[    0.283627] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.291405] TCP established hash table entries: 4096 (order: 3, 32768 bytes)
[    0.298577] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
[    0.305037] TCP: Hash tables configured (established 4096 bind 4096)
[    0.311243] TCP reno registered
[    0.323651] NET: Registered protocol family 1
[    0.330685] prom_parse: Bad cell count for /soc8343@e0000000/mdio@24520/ethernet-phy@0
[    0.338893] prom_parse: Bad cell count for /soc8343@e0000000/mdio@24520/ethernet-phy@1
[    0.351268] audit: initializing netlink socket (disabled)
[    0.356619] type=2000 audit(0.313:1): initialized
[    0.382087] VFS: Disk quotas dquot_6.5.1
[    0.386232] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.394709] DLM (built Sep 21 2008 19:30:26) installed
[    0.404506] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    0.413354] JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    0.420963] fuse init (API version 7.9)
[    0.426109] msgmni has been set to 241
[    0.431107] io scheduler noop registered
[    0.434934] io scheduler anticipatory registered
[    0.439556] io scheduler deadline registered
[    0.443952] io scheduler cfq registered (default)
[    0.448531] pci 0000:00:00.0: calling <7>pci 0000:00:00.0: calling <7>pci 0000:00:0b.0: calling <7>pci 0000:00:0b.0: calling <7>pci 0000:00:0c.0: calling <7>pci 0000:00:0c.0: calling <6>Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
[    0.452077] serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16) is a 16550A
[    0.458809] console handover: boot [udbg0] -> real [ttyS0]
[    0.476875] brd: module loaded
[    0.486170] loop: module loaded
[    0.490772] nbd: registered device at major 43
[    0.513511] Gianfar MII Bus: probed
[    0.518756] eth0: Gianfar Ethernet Controller Version 1.2, 00:0c:42:20:1e:15
[    0.525991] eth0: Running with NAPI enabled
[    0.530201] eth0: 256/256 RX/TX BD ring size
[    0.536051] eth1: Gianfar Ethernet Controller Version 1.2, 00:0c:42:20:1e:16
[    0.543184] eth1: Running with NAPI enabled
[    0.547397] eth1: 256/256 RX/TX BD ring size
[    0.552123] VIA Networking Velocity Family Gigabit Ethernet Adapter Driver Ver. 1.14
[    0.559957] Copyright (c) 2002, 2003 VIA Networking Technologies, Inc.
[    0.566530] Copyright (c) 2004 Red Hat Inc.
[    0.570761] via-velocity 0000:00:0b.0: calling <6>eth2: VIA Networking Velocity Family Gigabit Ethernet Adapter
[    0.572616] eth2: Ethernet Address: 00:0C:42:20:1E:17
[    0.593156] PPP generic driver version 2.4.2
[    0.598128] PPP Deflate Compression module registered
[    0.603255] PPP BSD Compression module registered
[    0.608612] PPP MPPE Compression module registered
[    0.613484] NET: Registered protocol family 24
[    0.618018] PPPoL2TP kernel driver, V1.0
[    0.621973] SLIP: version 0.8.4-NET3.019-NEWTTY (dynamic channels, max=256) (6 bit encapsulation enabled).
[    0.631672] CSLIP: code copyright 1989 Regents of the University of California.
[    0.639012] SLIP linefill/keepalive option.
[    0.648095] tun: Universal TUN/TAP device driver, 1.6
[    0.653225] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[    0.659810] HDLC support module revision 1.22
[    0.664256] DLCI driver v0.35, 4 Jan 1997, mike.mclagan@linux.org.
[    0.670585] ath5k_pci 0000:00:0c.0: enabling device (0000 -> 0002)
[    0.676831] PCI: Enabling bus mastering for device 0000:00:0c.0
[    0.676909] ath5k_pci 0000:00:0c.0: registered as 'phy0'
[    0.772135] phy0: Selected rate control algorithm 'pid'
[    0.774179] ath5k phy0: Atheros AR5414 chip found (MAC: 0xa5, PHY: 0x61)
[    0.784163] Loading iSCSI transport class v2.0-869.
[    0.792925] iscsi: registered transport (tcp)
[    0.797765] Driver 'sd' needs updating - please use bus_type methods
[    0.872255] scsi0 : scsi_debug, version 1.81 [20070104], dev_size_mb=8, opts=0x0
[    0.881780] scsi 0:0:0:0: Direct-Access     Linux    scsi_debug       0004 PQ: 0 ANSI: 5
[    0.890815] MikroTik RouterBoard RB333/RB600 CompactFlash PATA driver, version 0.0.1
[    0.898747] CF: using Local-Bus clock 66666 kHz 15000 ps
[    0.904102] CF: irq level 0
[    0.908377] scsi1 : pata_rb_ppc
[    0.911888] sd 0:0:0:0: [sda] 16384 512-byte hardware sectors (8 MB)
[    0.918698] ata1: PATA max PIO6 irq 20
[    0.922697] CF PIO mode changed to 0
[    0.926445] sd 0:0:0:0: [sda] Write Protect is off
[    0.931286] sd 0:0:0:0: [sda] Mode Sense: 73 00 10 08
[    0.939426] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
[    0.951442] sd 0:0:0:0: [sda] 16384 512-byte hardware sectors (8 MB)
[    0.959424] sd 0:0:0:0: [sda] Write Protect is off
[    0.964273] sd 0:0:0:0: [sda] Mode Sense: 73 00 10 08
[    0.971424] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
[    0.980033]  sda: unknown partition table
[    0.994625] sd 0:0:0:0: [sda] Attached SCSI disk
[    1.000092] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    1.079814] ata1.00: CFA: SanDisk SDCFX3-4096, HDX 4.31, max MWDMA2
[    1.086156] ata1.00: 8027712 sectors, multi 0: LBA
[    1.091653] ata1.00: configured for PIO6
[    1.095723] blk_queue_max_hw_segments: set to minimum 1
[    1.101422] scsi 1:0:0:0: Direct-Access     ATA      SanDisk SDCFX3-4 HDX  PQ: 0 ANSI: 5
[    1.110720] sd 1:0:0:0: [sdb] 8027712 512-byte hardware sectors (4110 MB)
[    1.117763] sd 1:0:0:0: [sdb] Write Protect is off
[    1.122634] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[    1.122912] sd 1:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[    1.133073] sd 1:0:0:0: [sdb] 8027712 512-byte hardware sectors (4110 MB)
[    1.140114] sd 1:0:0:0: [sdb] Write Protect is off
[    1.144985] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[    1.145263] sd 1:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[    1.154509]  sdb: sdb1 sdb2
[    1.160871] sd 1:0:0:0: [sdb] Attached SCSI removable disk
[    1.167192] sd 1:0:0:0: Attached scsi generic sg1 type 0
[    1.172646] MikroTik RouterBoard RB333/RB600 CompactFlash PATA driver, version 0.0.1
[    1.180473] CF: irq level 0
[    1.183639] scsi2 : pata_rb_ppc
[    1.187300] ata2: PATA max PIO6 irq 22
[    1.355565] NFTL driver: nftlcore.c $Revision: 1.98 $, nftlmount.c $Revision: 1.41 $
[    1.363583] INFTL: inftlcore.c $Revision: 1.19 $, inftlmount.c $Revision: 1.18 $
[    1.371391] SSFDC read-only Flash Translation layer
[    1.376487] slram: not enough parameters.
[    1.380553] block2mtd: version $Revision: 1.30 $
[    1.385662] MikroTik RouterBoard RB333/RB600 NAND driver
[    1.391147] NAND device: Manufacturer ID: 0xad, Chip ID: 0x76 (Hynix NAND 64MiB 3,3V 8-bit)
[    1.399581] Scanning device for bad blocks
[    1.404261] Bad eraseblock 9 at 0x00024000
[    1.409037] Bad eraseblock 21 at 0x00054000
[    1.439506] Bad eraseblock 481 at 0x00784000
[    1.453033] Bad eraseblock 643 at 0x00a0c000
[    1.470102] Bad eraseblock 867 at 0x00d8c000
[    1.486602] Bad eraseblock 1081 at 0x010e4000
[    1.491364] Bad eraseblock 1088 at 0x01100000
[    1.502973] Bad eraseblock 1215 at 0x012fc000
[    1.518402] Bad eraseblock 1409 at 0x01604000
[    1.527329] Bad eraseblock 1489 at 0x01744000
[    1.538713] Bad eraseblock 1612 at 0x01930000
[    1.543962] Bad eraseblock 1627 at 0x0196c000
[    1.548427] Bad eraseblock 1629 at 0x01974000
[    1.554205] Bad eraseblock 1654 at 0x019d8000
[    1.561703] Bad eraseblock 1709 at 0x01ab4000
[    1.577718] Bad eraseblock 1913 at 0x01de4000
[    1.585846] Bad eraseblock 1979 at 0x01eec000
[    1.590939] Bad eraseblock 1992 at 0x01f20000
[    1.628890] Bad eraseblock 2580 at 0x02850000
[    1.698273] Bad eraseblock 3718 at 0x03a18000
[    1.724207] Creating 2 MTD partitions on "NAND 64MiB 3,3V 8-bit":
[    1.730339] 0x00000000-0x00400000 : "RouterBoard NAND Boot"
[    1.738631] 0x00400000-0x04000000 : "RouterBoard NAND Main"
[    1.751218] ftl_cs: FTL header not found.
[    1.760541] aoe: AoE v47 initialised.
[    1.765451] i2c-core: driver [rtc-ds1374] registered
[    1.765474] i2c /dev entries driver
[    1.769619] i2c-core: driver [dev_driver] registered
[    1.770213] i2c-core: driver [lm87] registered
[    1.770649] WDT driver for MPC83xx initialized. mode:reset timeout=65535 (-65536 seconds)
[    1.780097] device-mapper: uevent: version 1.0.3
[    1.785986] device-mapper: ioctl: 4.13.0-ioctl (2007-10-18) initialised: dm-devel@redhat.com
[    1.795043] device-mapper: multipath: version 1.0.5 loaded
[    1.800630] device-mapper: multipath round-robin: version 1.0.0 loaded
[    1.807193] device-mapper: multipath emc: version 0.0.3 loaded
[    1.813058] device-mapper: multipath hp-sw: version 1.0.0 loaded
[    1.819213] device-mapper: multipath rdac: rdac: version 0.4 loaded
[    1.827167] Netfilter messages via NETLINK v0.30.
[    1.832175] nf_conntrack version 0.5.0 (2048 buckets, 8192 max)
[    1.842524] IPv4 over IPv4 tunneling driver
[    1.849046] GRE over IPv4 tunneling driver
[    1.857647] ip_tables: (C) 2000-2006 Netfilter Core Team
[    1.863186] ClusterIP Version 0.8 loaded successfully
[    1.868379] arp_tables: (C) 2002 David S. Miller
[    1.873108] TCP cubic registered
[    1.876373] Initializing XFRM netlink socket
[    1.881051] NET: Registered protocol family 10
[    1.889385] lo: Disabled Privacy Extensions
[    1.914896] tunl0: Disabled Privacy Extensions
[    1.927562] Mobile IPv6
[    1.930091] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    1.936121] IPv6 over IPv4 tunneling driver
[    1.944958] sit0: Disabled Privacy Extensions
[    1.958135] ip6tnl0: Disabled Privacy Extensions
[    1.967148] NET: Registered protocol family 17
[    1.971693] NET: Registered protocol family 15
[    1.976945] Bridge firewalling registered
[    1.982612] RPC: Registered udp transport module.
[    1.987405] RPC: Registered tcp transport module.
[    1.992200] 802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
[    1.999031] All bugs added by David S. Miller <davem@redhat.com>
[    2.005881] SCTP: Hash tables configured (established 4096 bind 8192)
[    2.041221] registered taskstats version 1
[    2.045641] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    2.064217] VFS: Mounted root (ext2 filesystem) readonly.
[    2.069834] Freeing unused kernel memory: 204k init

Other good news: The ath5k developers have just added support for AP mode to the driver. I suspect kernel 2.6.27 or .28 will have full support for it, and you can already compile it as a working module if you want (make sure you remove the built-in ath5k from the kernel first!).

Enjoy!

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Just another short update.

It turns out the PCI host bridge node in the device tree does have a node representing the ranges, but the kernel won't read it for some reason (maybe #address-cells is wrong). However, it does provide the necessary values, so I've incorporated them into the patch.

I've also cleaned up a bit of the code as I saw fit, and have updated the .config, kernel patch, and vmlinux image.

http://cynigram.com/~nfontes/rb600/linux-2.6.26.5-rb600.config
http://cynigram.com/~nfontes/rb600/linux-2.6.26.5-rb600.patch
http://cynigram.com/~nfontes/rb600/vmlinux-2.6.26.5-rb600

This *should* be stable, but I'm going to give it a week or so to make sure nothing funny happens.

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Hi, it's me again smile

I got some problems with compiling the kernel with your new patch & config.

I used the same 2.6.26.5 kernel, applied your patch and copied your config as ".config".
Then I just hit " make ARCH="powerpc" CROSS_COMPILE="powerpc-linux-gnu-" "

 
  HOSTCC  arch/powerpc/boot/dtc-src/flattree.o
  HOSTCC  arch/powerpc/boot/dtc-src/fstree.o
  HOSTCC  arch/powerpc/boot/dtc-src/livetree.o
  HOSTCC  arch/powerpc/boot/dtc-src/srcpos.o
  HOSTCC  arch/powerpc/boot/dtc-src/treesource.o
  HOSTLD  arch/powerpc/boot/dtc
  WRAP    arch/powerpc/boot/uImage
ahome/dajhard/src/linux-2.6.26.5-rb600/arch/powerpc/boot/wrapper: line 239: mkimage: command not found
make[1]: *** [arch/powerpc/boot/uImage] Error 127
make: *** [zImage] Error 2
dajhard@compiler:~/src/linux-2.6.26.5-rb600$ pwd
/home/dajhard/src/linux-2.6.26.5-rb600
dajhard@compiler:~/src/linux-2.6.26.5-rb600$ uname -r
2.6.26-1-686
dajhard@compiler:~/src/linux-2.6.26.5-rb600$

So, got any help on that?
Thx

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Oops, sorry -- you need the uboot-mkimage package. I forgot I switched that.

apt-get install uboot-mkimage

smile

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Nice to see this work.  I've also got an RB333 on the shelve. it went there when kaloz dropped his efforts to port openwrt for it, and then Mikrotik dropped it as a product.  I think Mikrotik only promote RB6xx series now days. it will be nice to see openwrt powering this platform!

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

I'm back with some problems again...

I got the kernel, copied it to /dev/sdc1 (CF card reader on my box).
Then I downloaded the image from http://ftp.ee.debian.org/debian/dists/l … /hd-media/
Unzipped the boot.img.gz to my box.
Made partition on /dev/sdc2, mounted it.
Mounted the boot.img and then copied files from it to /dev/sdc2.
It's my first time doing this, so I am not shure if this is correct. The most unsure I am about the bootloader and the initrd... but ... will try the error&retry method cause of lack of knowledge.

The one sub-question is... why did you say "echo "root=/dev/sdb2" > kernparm.dat"... why not /dev/cfa2 ?? While putting openwrt on RB532 if I remember correctly, it used /dev/cfa notation.

The second thing is another bigger problem.
My brand new RB600A boots from NAND to Tik. Working OK.
BUT !! When I insert a CF card, it doesn't boot at all. I only get 1 simbol on my console (the weird question mark character). And then nothing happens. I tried both CF slots. But, without a CF insertet, it boots just fine.

miniPCI slots are empty, and i tried with both 24V and 48V adapter.

sad sad sad

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Found the problem...

we have tested that

      - Sansisk Ultra II
      - Sandisk Extreme III,
      - Apacer Photo Steno III 133x (but not Steno IV 300x)
      - A-Data Speedy 8Gb
      - A-Data Speedy 16Gb
      - Seagate ST1.2 microdrives

all work very well. The Kingston and Transcend flashes seem to have some compatibility problem, so it's easier just to use the mentioned ones.

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

I had no success trying to netboot impl's image on an RB333 :-(

RouterBOOT booter 2.16

RouterBoard 333

CPU frequency: 333 MHz
  Memory size:  64 MB

Press any key within 2 seconds to enter setup..
trying bootp protocol... OK
Got IP address: 192.168.1.50
resolved mac address 00:1C:C0:70:8E:8A
Gateway: 192.168.1.79
transfer started ........................................ transfer ok, time=1.3s
setting up elf image... OK
jumping to kernel code

has anyone made an openwrt tree for further testing?

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Yeah, I don't think this has much chance of working on an RB333. I actually took out the RB333 code because I didn't trust my ability to make it work without a device to test it on.

It shouldn't be *too* hard to modify to work on an RB333 -- at least I don't think -- but you'll have to go back and copy some changes out of the original patch and maybe undo some of the things I put into the nand/cf/etc. files.

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Hi,

I just want to thank *impl* for his work. I have got my RB600 running with current Debian/Lenny quite quickly. :-)

The basic steps are (summarized):

* partition the CF card with first partition of size 16 MB and id 27
* dd the kernel image from *impl* to the card (do not forget to set the kernel params)
* format second partition and mount it on /mnt
* cdebootstrap --verbose --arch=powerpc --foreign lenny /mnt/ http://ftp.de.debian.org/debian/
* place CF card into RB600 and enjoy rest of bootstrap process
* for own kernel:
** fetch kernel
** apply patch from *impl* and copy config from *impl* to .config
** add to /etc/apt/sources.list: deb http://www.emdebian.org/debian/ unstable main
** apt-get install binutils-powerpc-linux-gnu ... (see above)
** make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- oldconfig
** make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- menuconfig
** make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu-

Only one question remains:

Why is the throughput not as high as expected?

If I do a simple speed-test with netcat and dd between two computers, I get sth. like 50 MByte/s. If I put the RB600 between them with a very simple forward (just ip_forward and proxy_arp), without any iptables entries, I get only around 17 MByte/s. This would mean a throughput of about 150 Mbit/s, which is not that much.

Has anyone an idea? Are there further optimizations possible?

Thanks and regards,

Chris

15 (edited by acoul 2008-11-06 03:03:45)

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

impl wrote:

It shouldn't be *too* hard to modify to work on an RB333 -- at least I don't think -- but you'll have to go back and copy some changes out of the original patch and maybe undo some of the things I put into the nand/cf/etc. files.

are you talking about the 2.6.22 kernel patches MikroTik released some time ago or are there any more resent and complete patches for the RB333? RB333 is end of life from day one but it would be interesting to see openwrt running on it ...

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

acoul: Yeah, I based my patch on the old one MikroTik released for 2.6.22. I don't think there's been a release since then.

cfish: I would imagine that further optimizations are definitely possible. I took all the MikroTik patches to the networking out of the kernel for stability reasons while I was trying to get the kernel to initially work. I'm not sure what difference they make, if any. It might be something that needs to be done to the Gianfar kernel drivers.

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Hi all!

I'm happy to release an updated version of the RB600 patch for the 2.6.28.2 kernel.

This fixes the following output from the kernel's OF parser:

[    0.330685] prom_parse: Bad cell count for /soc8343@e0000000/mdio@24520/ethernet-phy@0
[    0.338893] prom_parse: Bad cell count for /soc8343@e0000000/mdio@24520/ethernet-phy@1

and makes PHY negotiation work again in the kernel. It's also updated to support the PPC and PowerPC branch merge.

Since ath5k isn't yet ready for usage as an AP, I disabled it in the kernel config. I'm using an SVN copy of madwifi (compiled on the device itself, although that's not strictly necessary) with hostapd and it's working brilliantly at the moment, as is bridging between the wireless card and the ethernet ports.

This leaves two outstanding issues:
* The RTC still doesn't work, but I have had no issues using ntpd to take care of the time
* The LEDs on the box don't work (or I don't know how to use them), with the exception of the blue power LED

both of which are pretty minimal. If someone wants to create an OpenWRT branch for this, I'll be happy to lend a hand in some of the development/testing. I can also work on getting a patch together for the RB333 if someone wants to send one my way.

You can get the relevant files here:
http://cynigram.com/~nfontes/rb600/linux-2.6.28.2-rb600.config
http://cynigram.com/~nfontes/rb600/linux-2.6.28.2-rb600.patch
http://cynigram.com/~nfontes/rb600/vmlinux-2.6.28.2-rb600 (7.3MB)

Remember that the kernel parameters have not been added yet to the vmlinux image.

Please let me know if something doesn't work or fails unexpectedly.

Have fun!

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Am interested in your work.
Can u give some quick help for running the image u posted here?

Got a RB600 at home with 2 Atheros cards in it doing nothing sad
Would like to try it out agains my RB433AH.

Thx

19 (edited by impl 2009-01-29 23:03:39)

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Hi again!

This image should be installable in exactly the same way as the previous ones, as outlined in my first posts as well as the excellent post by cfish. For installing madwifi, I did have to hack a bit, but here's what I did on the device:

1. Grab a copy of the kernel source code and my patch on the device itself, then apply the patch
2. In the kernel directory, run make prepare && make scripts
3. svn co https://svn.madwifi-project.org/madwifi/branches/madwifi-0.9.4
4. Edit madwifi-0.9.4/scripts/get_arch.mk and set ARCH-$(CONFIG_PPC) to powerpc:

ARCH-$(CONFIG_PPC) = powerpc

5. In the madwifi-0.9.4 directory, run make KERNELPATH=/path/to/the/kernel
6. Run make KERNELPATH=/path/to/the/kernel install

You should then be able to modprobe the ath_pci module as it shows.

I would suggest just patching madwifi into your kernel and cross-compiling. smile

G'luck!

20 (edited by Marlow 2009-02-10 17:18:38)

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

I've run cdebootstrap, moved the microdrive (which it is in my case) over to the board, finalized that, moved it back and created /etc/fstab, since it was complainting about that.

Also inittab has to be modified with:

T0:23:respawn:/sbin/getty -L console 115200 vt100

After that, all is working. Thanks lads.

I did some tests (on 2.6.28.2) and it's reaching max 184 mbit/s

Here are the iperf results:

[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec    176 MBytes    147 Mbits/sec
[  5]  0.0-60.0 sec  1.19 GBytes    170 Mbits/sec
[  4]  0.0-60.0 sec  1.29 GBytes    184 Mbits/sec
[  5]  0.0-60.0 sec  1.07 GBytes    153 Mbits/sec
[  4]  0.0-60.0 sec  1.08 GBytes    155 Mbits/sec
[  5]  0.0-60.0 sec  1.24 GBytes    178 Mbits/sec
[  4]  0.0-60.0 sec  1.27 GBytes    183 Mbits/sec
[  5]  0.0-120.0 sec  2.16 GBytes    154 Mbits/sec
[  4]  0.0-120.0 sec  2.10 GBytes    150 Mbits/sec
[  5]  0.0-600.0 sec  12.4 GBytes    177 Mbits/sec
[  4]  0.0-120.0 sec  2.29 GBytes    164 Mbits/sec
[  5]  0.0-120.0 sec  2.41 GBytes    173 Mbits/sec
[  4]  0.0-120.0 sec  2.04 GBytes    146 Mbits/sec

I'll do some tests using mtik on those boards tomorrow. If they run faster, it'd love to know, what they've done to do it.

I've stuck a simple howto together on http://doc.thewan.net/wiki/index.php/Debian_On_Routerboard , which i hope to grow over time.

/M

Communication is the beginning of understanding
-- AT&T

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Howdy,

I finally finished my speed tests. The results can be found here: http://www.marlow.dk/wiki/index.php/RouterboardPPC#Performance

And the way it looks, the results cfish was seeing are correct. They aren't better using RouterOS either, so the network patches were not optimization related.

/M

Communication is the beginning of understanding
-- AT&T

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

Hi Marlow!

I really want to thank you for the work you've put into this -- the tutorial should really help people who want to use this get started. And the benchmarks make me happy, at least smile. It's all quite awesome!

Thanks again!

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

I prefer a semi-install Linux. The automatic does not always appear correct option. In the manual for a long time and do not always have the patience to install. Semi-installation is ideal. There is a search engine for rapidshare  (http://rapid4me.com) enter the name of the application and see the results of all three types of installation

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

blense wrote:

I prefer a semi-install Linux. The automatic does not always appear correct option. In the manual for a long time and do not always have the patience to install. Semi-installation is ideal. There is a search engine for rapidshare  (http://rapid4me.com) enter the name of the application and see the results of all three types of installation

I'm not sure, what you are talking about. All cdebootstrap or debootstrap does, is installing a minimal set of applications on your board. After that, you will need to install the packages that you need for your purposes.

If this just is an ad for rapidshare, you're in the wrong forum. And you won't need rapidshare to dowload OpenWRT, nor Debian, it's all easy to find locally on mirrors and free.

/M

Communication is the beginning of understanding
-- AT&T

25 (edited by Marlow 2009-02-13 12:43:04)

Re: Linux on MikroTik Routerboard RB600 (and maybe RB333)

impl wrote:

Hi Marlow!

I really want to thank you for the work you've put into this -- the tutorial should really help people who want to use this get started. And the benchmarks make me happy, at least smile. It's all quite awesome!

Thanks again!

I've got a set of the precompiled kernel-package, that I will stick online today. Two differences to yours: I included reiserfs (my choice for a filesystem on harddrives) in the kernel and the TCP-MD5 option, which is used for BGP sometimes. I have 3 boxes on my desk here, that I build and installed during the making of the document and 2 of them will be on an Internet Exchange as of Saturday night. That way, I might stick some graphs on the howto, as I go on, from some real-life experience with'em.

But yes, the performance test at least shows, that the way you prepared the patch hasn't inflicted on performance and I find, that 250 mbit/s througput is quite acceptible for a PPC 533 MHz.

Mind you, and i've not tested this fully, once you add a wireless card, the throughput will decrease drastically, because a lot of CPU ressources are used for the wireless.

Oh, and there is a reason, I increased the kernel-partition to 20 MB. I found, that if it only was 16MB, sometimes it would corrupt the partitions behind it. I'd say it can be rectified with the correct dd parameters, but I just took the lazy attempt, since I have 8 GB to play with.

/M

Communication is the beginning of understanding
-- AT&T