Follow on from 01 Oct 08 APNIC Box - Linux on a Mikrotik 532a, Part 2
The device runs a 2.4.30 kernel on a debian woody (mipsel) environment. If anyone can contribute anything for 2.6.x and debian etch, that would be great.
In this part, I’m going to provide a download link to a prebuilt image which you can write directly onto your own CF card with dd or similar tool. I’m also going to provide a step by step to installing debian yourself without my prebuilt disk image.
Prebuilt image is here:
The prebuilt image also contains a number of scripts and tools that I’ll comment on and come to in later parts.
Now installation instructions:
#Build boot kernel
#Download linux-2.4.30
#Download http://www.routerboard.com/files/linux-2.4.30-yaffs2.patch.gz
#Apply patch
nano -w Makefile
#Change kgcc to gcc
make ARCH=mips CROSS_COMPILE=mipsel-linux- dep
make ARCH=mips CROSS_COMPILE=mipsel-linux- vmlinux
cp vmlinux linuxrc
echo “root=/dev/ram0 ramdisk_size=8192″ >kernel.params
echo “root=/dev/cfa2″ >kernel.params
mipsel-linux-objcopy –add-section kernparm=kernel.params vmlinux
mipsel-linux-objcopy –add-section initrd=initrd.gz linuxrc
mipsel-linux-strip vmlinux
mkdir /rb/
cp vmlinux linuxrc /rb/
#Prepare your initrd
mkdir test
cd test
dd if=/dev/zero of=initrd bs=1024 count=8192
/sbin/mke2fs -F -b 1024 initrd
mkdir mnt
mount initrd -o loop ./mnt
cd mnt
wget http://archive.debian.org/debian-archive/dists/woody/main/disks-mipsel/current/root.tar.gz
tar -xzf root.tar.gz
mv debian-mipsel-root/* .
rm -f debian-mipsel-root
rm linuxrcmknod dev/cfa b 13 0
mknod dev/cfa1 b 13 1
mknod dev/cfa2 b 13 2
mknod dev/cfa3 b 13 3
mknod dev/cfa4 b 13 4
sed -e s/delo// usr/lib/debootstrap/scripts/woodycd ..
umount mnt
gzip initrd
mv initrd.gz /rb/
Prepare dhcpd and tftpd on your host machine so that the routerboard can network boot it’s setup
>>subnet 192.168.0.0 netmask 255.255.255.0 {
>> option subnet-mask 255.255.255.0;
>> next-server 192.168.0.2; #tftp server ip
>> option broadcast-address 192.168.0.255;
>> option routers 192.168.0.1;
>>}
apt-get install atftpd
remove atftpd from /etc/inetd.conf
killall -HUP inetd
atftp –daemon /rb/
Set your machine up for masquerading so the device has network access for setup.
At this point, you’re ready to start your routerboard and begin the setup. You have an initrd (initrd.gz) and a kernel (linuxrc), as well as the host serving these via DHCPD/TFTPD. Connect your RB via serial console and ensure that the it is set to Ethernet boot. The vmlinux that you made will be used after setup. You can use gtkterm/minicom on Linux, or PuTTY/Hyper Terminal on Windows. If you’re seeing nothing or a load of junk output to your console, a) make sure that the cable is correct and connected, b) Make sure your connection settings are: 57600 8N1
For the installation process via your serial terminal:
Run through installer
Create 4M partition on /dev/cfa1 (0×27)
Create 475M linux partition on /dev/cfa2 (ext3)
Allocate remaining space to /dev/cfa3 (swap)
* Perform install
Once install is complete of base system, execute a shell.
Generate a new kernel on the host machine
* wget this vmlinux onto the routerboard
dd if=./vmlinux of=/dev/cfa1
Edit /target/etc/inittab with nano-tiny
Add:
t0:23:respawn:/sbin/getty -L console 115200 vt100
cd /target/
mknod dev/cfa b 13 0
mknod dev/cfa1 b 13 1
mknod dev/cfa2 b 13 2
mknod dev/cfa3 b 13 3
mknod dev/cfa4 b 13 4
reboot
* Configure setup options and root password
And you’re done. ![]()
These are the notes that I took and corrected throughout my own installation process. I’m sure that there are corrections and a number of explainations required - please do contribute or comment. Thanks!
Tags: 532a, apnicbox, apt-get, atftpd, CF, compile, cross compile, Custom Kernel, dd, debian, dhcpd, dhcpd.conf installer, forward, initrd, initrd.gz, iptables, ip_forward, kernel, Linux, linuxrc, masquerade, mikrotik, mipsel, mkfs, mknod, mount, partition, prebuild image, routerboard, routerboard 532a, scripts, sed, tftpd, vmlinux, wget
I can not remember all but I have the same box running with etch, 2.6 and ispconfig.
The only thing I can remember is it did it with qemu.
[...] Follow On From: 05 Oct 08 APNIC Box - Linux on a Mikrotik 532a, Part 3 - Installing Debian, Prebuilt… [...]