/contrib/famzah

Enthusiasm never stops

Running Debian on Bifferboard

35 Comments

There are three major steps in installing Debian on your Bifferboard:

  1. Kernel boot command line.
  2. Kernel installation on the Bifferboard.
  3. Rootfs installation on a USB device or an SD/MMC card.

Kernel boot command line

Since Biffboot v3.3, dated 19.July.2010, the kernel boot command line no longer specifies an external block device for the root file system. As a result of this, you need to update the boot configuration before you can boot from a USB device or an SD/MMC card. You have two options to configure the boot command line:

You need to set the kernel boot command line (“Kernel cmndline”) to:

console=uart,io,0x3f8 root=/dev/sda1 rootwait

Kernel installation on the Bifferboard

Download a pre-built kernel binary image:

The kernel is compiled with (almost) all possible modules, so your Bifferboard should be able to easily use any device supported on Debian. Once you have downloaded the kernel image, you can then upload it to the Bifferboard, as advised at the Biffboot Wiki page. You have two options to upload the kernel – via the serial port or over the ethernet. Both work well.

Example: Assuming that you have the Bifferboard SVN repository checked out in “~/biffer/svn“, you have downloaded the “vmlinuz-2.6.30.5-bifferboard-ipipe” kernel image in “/tmp“, your Bifferboard has a MAC address of “00:B3:F6:00:37:A9“, and you have connected it on the Ethernet port “eth0” of your computer, here are the commands that you would need to use:

cd ~/biffer/svn/utils
sudo ./bb_eth_upload.py eth0 00:B3:F6:00:37:A9 /tmp/vmlinuz-2.6.30.5-bifferboard-ipipe

Rootfs installation on a USB device or an SD/MMC card

Once you have the kernel “installed” on the Bifferboard and ready to boot, you need to prepare a rootfs media. This is where your Debian installation is stored and booted from. Download one of the following pre-built rootfs images (default root password is “biffroot”):

The “developer” version adds the following packages: build-essential, perl, links, manpages, manpages-dev, man-db, mc, vim. Note that for each image you will need at least 100MB more free on the rootfs media.

In order to populate the rootfs media, you have to do the following:

  1. Create one primary partition, format it as “ext3” and then mount the USB device or SD/MMC card.
  2. Extract the archive in the mounted directory.
  3. Unmount the directory.

Example: Assuming that you have the Bifferboard SVN repository checked out in “~/biffer/svn“, you have downloaded the “minimal” rootfs image in “/tmp“, and you are using an SD/MMC card under the device name “/dev/mmcblk0“, here are the commands that you would need to use:

sudo bash
mkdir /mnt/rootfs
cd ~/biffer/svn/debian/rootfs
./format-and-mount.sh /dev/mmcblk0 /mnt/rootfs
tar -jxf /tmp/debian-lenny-bifferboard-rootfs-minimal.tar.bz2 -C /mnt/rootfs
umount /mnt/rootfs
# CHANGE THE DEFAULT ROOT PASSWORD!

When you have the USB device or SD/MMC card ready and populated with the customized Debian rootfs, plug it in Bifferboard, attach a serial cable to Bifferboard, if you have one, and boot it up.

That’s it. Enjoy your Bifferboard running Debian.

Update: As already mentioned in the comments below, you would probably need to set up swap too. Here is my recipe:

# change "128" (MBytes) below to a number which suits your needs
dd if=/dev/zero of=/swapfile bs=1M count=128
mkswap /swapfile
swapon /swapfile # enables swap right away; disable with "swapoff -a"
echo '/swapfile none swap sw 0 0' >> /etc/fstab # enables swap at system boot

Using a file for swap on a 2.6 Linux kernel has the same performances as using a separate swap partition as discussed at LKML.

Update 2: As announced by Debian, Debian 5.0 (lenny) has been superseded by Debian 6.0 (squeeze). Security updates have been discontinued as of February 6th, 2012. Thus by downloading and installing the images provided here, you’re using an obsolete Debian release. If that’s not a problem for you, read on. You need to change the file “/etc/apt/sources.list” to the following using your favorite text editor:

deb http://archive.debian.org/debian lenny main contrib non-free
deb-src http://archive.debian.org/debian lenny main contrib non-free
deb http://archive.debian.org/debian-security/ lenny/updates main contrib non-free
deb-src http://archive.debian.org/debian-security/ lenny/updates main contrib non-free

P.S. If you want to build your own customized Debian rootfs image for Bifferboard – checkout the Bifferboard SVN repository and review the instructions in “debian/rootfs/images.txt“.

References:

Author: Ivan Zahariev

An experienced Linux & IT enthusiast, Engineer by heart, Systems architect & developer.

35 thoughts on “Running Debian on Bifferboard

  1. Pingback: Secure NAS on Bifferboard running Debian « /contrib/famzah

  2. it’s very important to create a swap partition for debian, otherwise your kernel will keep killing programs because 32 Megs of RAM is not very much.
    HowTo:
    Resize sda1 on ANOTHER Linux machine using a program of you choice (gparted, parted, whatever)
    Create a swap partition sda2
    Boot up debian, execute swapon /dev/sda2
    To make sure the swap partition is mounted after a reboot, add this to your /etc/fstab :
    /dev/sda2 none swap sw 0 0

  3. Hi all,

    has anyone tried to run Java on a bifferboard? Are there any expierence? Does debian lenny already contain a java installation?

    Best regards
    Andreas

    • You can install Java runtime on your Debian very easily by executing the following:

      apt-get install sun-java6-bin sun-java6-jre

      You already started a thread about Java at the Bifferboard mailing list and as suggested there, you can also try JamVM, which is a lighter Java runtime implementation, by executing:

      apt-get install jamvm

      P.S. Please post support inquiries about Debian at the mailing list. I didn’t reply in this current thread, because it wasn’t about Debian, nor was asked for this OS.

  4. Hi,

    I tried to install the minimal and the developer rootfs on the USB Stick and received the following error during the decompression:

    tar: Springe zum nächsten Kopfteil (jumping to the next header)

    bzip2: Data Integrity error when decompressing
    input file = (stdin), output file = (stdout)

    I downloaded the files twice from the webpage.

    I am jusing knoppix 6.2

    Any idea?

    Regards & many thanks
    Andreas

    • I’ve added the MD5 checksums of the files for download. Once you’ve downloaded a file, you can verify its integrity before decompressing it by executing the following in your console:

      md5sum debian-lenny-bifferboard-rootfs-minimal.tar.bz2

      If the MD5 checksum differs from what you see on this web page, then something with the download went wrong – this isn’t something which I can help with, as it’s more a network problem on your side. If the checksum is right and you still get the error, then there’s something really weird – you should check if your hardware is OK, probably RAM, etc.

  5. Hi,

    sorry, it is me again….

    I now flashed the kernel (113 chunks written) and installed the developper root FS.

    Then I turned everything on (USB-Bifferbard connected to LAN): After a couple of seconds the LED at the USB Stick is flashing (so, thing is happening): but after some time, it stops, it seems that no IP Adresses has been assigned to the bifferbard….

    The Router indicates that an device is connected to the LAN port…

    Do you have an idea what to do? I thought that no adaptation of the rootfs is required (manuel config of the net mask etc…). Since I do not have an serial adapter, I have idea which messages are generated during the boot process…

    Many thanks in advance & regards
    Andreas

    • No adaptation is required, the Debian installation gets an IP address via DHCP by default.

      I can’t help without the output on the console, which is available through a serial cable…

      P.S. Please post support inquiries about Debian at the mailing list.

  6. Hi,
    I’m busy installing Debian now, but I suppose the python instruction is missing from this line:

    sudo ./bb_eth_upload.py eth0 00:B3:F6:00:37:A9 /tmp/vmlinuz-2.6.30.5-bifferboard-ipipe

    It works on my BifferBoard with
    sudo ./python bb_eth_upload.py eth0 00:B3:F6:00:37:A9 /tmp/vmlinuz-2.6.30.5-bifferboard-ipipe

    Regards,

    Ben

    • Actually, it’s not missing. The interpreter path is specified in the very first line of “bb_eth_upload.py”:

      #!/usr/bin/env python

      You either don’t have “/usr/bin/env” on your system, or “python” is not in the PATH.

  7. Hello,
    i recieved my BB today and I was prepared to upload the kernel an the rootfs. I’ve got an 8MB BB, so i used the bb_eth_upload8.py command. But i bricked it :-/ After some tries i managed to flash the original firmware (http://sites.google.com/site/bifferboard/Home/factory-firmware) again but i was not able to get your debian running. Is it possible that your kernel does not work with 8MB devices?
    Regards,
    Martin

    • It works on 8MB boards, I’m currently using it mainly on such ones.
      For further assistance, please post a thread at the Bifferboard mailing list where more people can troubleshoot the problem.

      • Hello,
        i’ve got debian working on my 8MB Bifferboard. All I had to do was to set the correct kernel commandline in Biffboot. I had to connect with a serial cabel, intercept the boot process with hitting in the right moment and enter “usbroot -> save”. That’s it. Lurch stated in that post that it is possible to set it via ethernet – but i didn’t test this…
        Regards,
        Martin

        PS: I took your howto and translated it into german: http://www.m8in.de/?p=423 😉

  8. Pingback: Debian auf dem Bifferboard « M8IN.DE

  9. Why the kernel has only ext3 module compiled in? This is not the best file system for USB flash devices. As ext2 is as a module, bifferboard is not able to boot with ext2 or anything without journal.

    • If we have both ext2 and ext3 compiled in, the kernel image gets too big. Ext3 is used by most users, that’s why it’s compiled in. There are detailed instructions on how to recompile the kernel with the options you specifically need.

      • OK I understand. Just that it is possible to boot ext3 fs with ext2 module, but is impossible to boot ext2 fs with ext3 module.

  10. Awesome tutorial.

    One little problem, when I try and use iptables e.g.

    “iptables -t nat -A PREROUTING -p tcp –dport 80 -j REDIRECT”

    I get the error:

    “iptables: No chain/target/match by that name”

    Does anyone have a fix for it?

    • Thanks 🙂
      Try to load the required modules first by executing: /sbin/modprobe iptable_nat
      The following article provides further details: http://www.aboutdebian.com/proxy.htm

      • Thanks for helping but I’ve tried executing the following in a shell script:

        /sbin/depmod -a
        /sbin/modprobe iptable_nat
        /sbin/modprobe ip_tables
        /sbin/modprobe ip_conntrack
        /sbin/modprobe iptable_filter
        /sbin/modprobe iptable_mangle
        /sbin/modprobe ipt_LOG
        /sbin/modprobe ipt_limit
        /sbin/modprobe ipt_state
        /sbin/modprobe ipt_owner
        /sbin/modprobe ipt_REJECT
        /sbin/modprobe ipt_MASQUERADE
        /sbin/modprobe ip_conntrack_ftp
        /sbin/modprobe ip_conntrack_irc
        /sbin/modprobe ip_nat_ftp
        /sbin/modprobe ip_nat_irc

        And I still get the same error message…

      • I’ve investigated this more thouroughly. The REDIRECT target module is missing. In order to have it, you’d need to recompile the kernel. The compile option which I missed to enable is:

        Networking support -> Networking options -> Network packet filtering framework (Netfilter) -> Advanced netfilter configuration [CONFIG_NETFILTER_ADVANCED]

        Then you can enable the REDIRECT target:

        Networking support -> Networking options -> Network packet filtering framework (Netfilter) -> IP: Netfilter Configuration -> REDIRECT target support [CONFIG_IP_NF_TARGET_REDIRECT]

        Long story, short — if you’re going to use the SVN scripts to re-compile the kernel, you’d need to add the following two kernel options there:

        CONFIG_NETFILTER_ADVANCED=y
        CONFIG_IP_NF_TARGET_REDIRECT=m

        Note that you can try to use the DNAT rule, which is already available, in order to achieve the same effect as REDIRECT:

        iptables -t nat -A PREROUTING -d 127.0.0.1 -p tcp --dport 80 -j DNAT --to-destination 127.0.0.1:80
        iptables -t nat -A PREROUTING -d ! 127.0.0.1 -p tcp --dport 80 -j DNAT --to-destination $IP:80

        The variable “$IP” must hold the primary IP address of the incoming interface (eth0).

  11. Thanks for your help, it is very much appreciated.

    I’ve compiled the kernel (2.6.30.5) with the 2 extra lines and everything seems to go OK, although the ‘vmlinuz’ file turns out smaller than the one you have compiled (900.3KB). When I flash this kernel to the board it does not boot from the USB drive.

    Do I have to do anything with the generated .deb files??

    • Make sure you’re using a 32-bit Debian “lenny” system for the kernel build.

      The “.deb” files need to be installed in the rootfs (the USB drive). The easiest way to do this is to copy them to the USB drive, mount “proc” and “dev” there, chroot() there and then use “dpkg -i” to install them. I suggest that you have a serial debug cable connected to the Bifferboard if you’re about to tweak the kernel, so that you can see what failed where.

      If I were you, I’d go with the two iptables lines which I suggested — they do practically the same, and you’d have forgotten that you set up them by now, instead of having to recompile kernels, etc.

  12. Has anyone been able to install debian on the new version of this device (3rd generation)? http://www.addonics.com/products/nas/NAS30U2.asp
    This unit sounds beefy, sporting gigabit ethernet and usb 3!

  13. Thanks for sharing your prepared images. This made me jump-start into Debian. While I tried before without luck, this time was an almost instant success. +1 for mentioning the proper kernel command line – that’s what I had to fix to get it finally working.

  14. I have followed settings but keep getting this

    Linux version 2.6.32.20 (biff@fonzi) (gcc version 4.1.2) #5 Mon Feb 7 23:21:40 1
    Linux version 2.6.32.20 (biff@fonzi) (gcc version 4.1.2) #5 Mon Feb 7 23:21:40 1
    Linux version 2.6.32.20 (biff@fonzi) (gcc version 4.1.2) #5 Mon Feb 7 23:21:40 1
    Linux version 2.6.32.20 (biff@fonzi) (gcc version 4.1.2) #5 Mon Feb 7 23:21:40 1
    Linux version 2.6.32.20 (biff@fonzi) (gcc version 4.1.2) #5 Mon Feb 7 23:21:40 1
    Linux version 2.6.32.20 (biff@fonzi) (gcc version 4.1.2) #5 Mon Feb 7 23:21:40 1
    Linux version 2.6.32.20 (biff@fonzi) (gcc version 4.1.2) #5 Mon Feb 7 23:21:40 1

    Any idea how can get it to boot from usb?

    Thank you

  15. nice How-To!!!

    I did i like written in this How-To but have Problem with booting. Usind Putty or minicom for Serial Console works fine. While booting USB-Stick is flickering.

    Here is what Putty says to me:

    Hope someone could help me… have no more idea what to do.

    Greetings JoJo (from Germany/Augsburg)

    • The kernel boot seems OK. What happens if you mount /dev/sda1 (your Usb Flash Drive) on a desktop machine? Do you see a regular file-system structure there, having /etc, /bin, etc. folders and the respective files there?

      • That seems to be the problem. I do not see a regualr file-system on my flash drive. Only the lost+found folder apears…
        I’m trying to solve this problem. Thank you for your hint. 😉

  16. Solved the problem. Debian is working now. Thank you!!! Only problem is that I do not know the login name and password.
    in the terminal I can see following output:

    bifferboard.localdomain login:

    please help with this!

  17. I found it by myself. If anyone else needs the information.
    in
    http://bifferboard.svn.sourceforge.net/viewvc/bifferboard/debian/rootfs/images.txt
    you can find
    # root password: biffroot

Leave a comment