Debian Wheezy Instructions
Contents
Availability
An SD Card image for a Debian system for odroid-u2 is available in the downloads area Debian-wheezy
The files with the .md5sum extensions give you an easy way to check validity after downloading, using md5sum like this:
md5sum -c odroidu2_20130104-debian-wheezy-3.img.xz.md5sum # odroidu2_20130104-debian-wheezy-3.img.xz: OK
The non-filesystem area, including the bootloader(s) generally follow the HardKernel ubuntu images, like odroidu2_20130125-linaro-ubuntu-desktop-uSDeMMC.img.xz. The partition layout is the same, the bootloaders are the same.
The boot partition holds the kernel, initrd and u-boot boot scripts. These will not exactly track the HK releases.
debian-wheezy describes the system. The .img means it is a SD card image and .xz shows the file compression type. I recently dropped the added version number in favor of a date.
There are two versions, one is a minimal system and the other is a larger development version. The development version includes a native gcc compiler, and all locales.
Revision History
- debian-wheezy-2
- initial release
- debian-wheezy-3
- Added curl package, updated to kernel 3.0.57
- debian-wheezy-devel-4
- This is setup for native compiling. linux-3.0.57 is ready to build in /usr/src/linux.
- Added prerequsites for building the kernel
- Added sudo
- Built and installed the kernel per this tutorial: Kernel compiling
- odroidu2-20130205-debian-wheezy-devel
- This is setup for native compiling.
- A private kernel build is installed: linux-3.0.61
- The kernel source is removed from /usr/src/ in the interest of a smaller image
- Fixed locale setup. Added all locales.
- Set the timezone to GMT+8 (USA Pacific)
- Added ntpupdate package to update time from network
- The MAC ID is chosen randomly on first boot, but stored persistently in /etc/smsc95xx_mac_addr. For example the expected file contents would be like: A6:2A:DC:0B:56:74. You can edit the file to set the MAC ID if you need a specific one.
Issues
On first boot, the mac id file is not created, the root file system has not been mounted read/write at that time. Make up your own random mac id and do something like this:
echo A6:2A:DC:0B:56:74 > /etc/smsc95xx_mac_addr
You will see a message like: FATAL: Could not load /lib/modules/3.0.61/modules.dep: No such file or directory. This is not actually fatal, it is coming from the initrd -- which does not have a set of kernel modules matching the kernel, 3.0.61.
Features
Writing an SD-card image and booting will give you a completely pristine, up-to-date, headless Debian 7.0 system. Headless, meaning only the Linux console is active -- not the HDMI display.
The network will come up automatically, using DHCP.
The login is: user/password or root/root. Specifically, this means username: user and password: password will get you in. Or you can use username: root password: root. Yes, I do let root log in to the console...
If you log in as user, you can su to become root.
Root Filesystem Images
The tarball with the -rootfs.tgz suffix is just the content of the rootfs partition of the SD card.
If you have flashed the Ubuntu SD-Card image and want to try the Debian system, you can just mount the partition, delete all the files and then extract the tarball onto the SD card.
See this tutorial for step-by-step instructions: Updating from Root File System Images
Debian Tips
This page is for Debian Tips Debian Tips
Image Creation Details
This section details how a Debian root file system for the odroid can be created. Following the steps will not give you exactly the same results as in the prepared images because packages are periodically updated.
Debian is Debian. If you have any Debian system, it can be updated or upgraded -- without having to go through your own bootstrap process. It can be difficult to go through a bootstrap for a number of reasons including:
- Crossing processor architectures is always an issue. If you are building for x86, no problem. Most utilities work. But, most people are not faced with building custom x86 distros
- Debian has been around a long time. Tools and approaches are always changing. Googling is helpful, but you get a lot of information that is dated.
- If you are bringing up a new platform, you don't have a known-good starting point. For example, to do a network install, you need to have a root file system of some sort and you need a working network connection.
I did not invent any of this stuff, I just put it together and tested it specifically for use on and odroid target.
The bootstrap approach I show was tested on a clean Debian 6 machine, a VMWare virtual machine. You can find your own copy here: Debian6t VM VMWare Player is free as well: VMWare Player.
Bootstrap Debian with debootstrap
To get started, we need a root file system that has all the components needed to boot Debian. Once we have that, we can configure the system and add more packages. This technique uses qemu-system-arm, so qemu (quick emulator) needs to be installed.
You might want to install the sudo package and add yourself to the sudoers list if you have not already done it. This section is optional, but if you object to using sudo, there are commands you need to run as root.
As root:
apt-get install sudo # You need to add yourself to the "sudoers list", and how exactly that is done depends on the distribution. # This hack works for Debian Wheezy # as root, add normal user (named user) to adm group adduser user adm # configure the adm group to have no restrictions echo "%adm ALL=(ALL) ALL" >> /etc/sudoers # sudo will complain if it cannot resolve the hostname echo "127.0.0.1 $(hostname )" >> /etc/hosts
You need to logout/login after making the change to the sudoers list in order for it to take effect
sudo apt-get update sudo apt-get install binfmt-support qemu qemu-user-static debootstrap
We must have the qemu-arm-static binary to bring up the system. qemu version 0.12.5 is known to fail. As of this writing, qemu 1.4.0 is current and is known to work. Interim versions might work.
If it helps, you might be able to use one of the binaries I built, posted here: http://odroid.us/odroid/users/osterluk/debian-armhf/ The -i386 version will probably run on and x86 Linux host, but only because it is statically linked. Just rename it to qemu-arm-static. The x86_64 will not run on a 32-bit host.
Check the "Building QEMU" section of this tutorial if you need to build an updated qemu-arm-static binary: Building QEMU
# Go to a convenient directory cd $HOME # make a place to work mkdir debian-bootstrap # and go there cd debian-bootstrap # Create the root file system, this can take some time... sudo debootstrap --verbose --arch armhf --foreign wheezy $PWD/armhf http://ftp.at.debian.org/debian # Now the directory $HOME/debian-bootstrap/armhf holds a wheezy root file system, built from binary packages
We are going to chroot into the the armhf directory and we need qemu-arm-static available to be able to run the bootstrap script while hiding the rest of the host files from the process. qemu-arm-static knows how to run armhf binaries on our x86 machine -- cool when you think about it. Quite a nice piece of work.
Find qemu-arm-static:
$(which qemu-arm-static)
/usr/local/bin/qemu-arm-static
Make a local copy, for clarity: (copy from your downloads folder, if you plan to use the pre-built binary)
sudo cp /usr/local/bin/qemu-arm-static .
copy qemu-arm-static into what will be the chroot jail:
sudo cp qemu-arm-static armhf/usr/bin
Run debian second stage: (this is the place where a downlevel qemu-arm-static will fail)
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ LC_ALL=C LANGUAGE=C LANG=C sudo chroot armhf /debootstrap/debootstrap --second-stage
Trigger post-install scripts:
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ LC_ALL=C LANGUAGE=C LANG=C sudo chroot armhf dpkg --configure -a
Fixup inittab to put a getty on the default console -- and also to boot to root shell (I don't know the default username/password) In armhf/etc/inittab, change:
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
to
T0:23:respawn:/sbin/getty -L ttySAC0 9600 vt100
In armhf/etc/inittab, change:
id:2:initdefault:
to
id:1:initdefault:
Drop in some device nodes to let us run the root file system with qemu or real hardware
sudo mknod armhf/dev/ttyAMA0 c 204 64 sudo mknod armhf/dev/ttySAC0 c 204 64
Convert the root file system to a filesystem image (optional to launch with qemu-system-arm)
qemu-img create rootfs-wheezy.ext4 500M sudo mkfs.ext4 rootfs-wheezy.ext4
And the second step:
# We are going to need a mount point mkdir mnt sudo mount -o loop rootfs-wheezy.ext4 mnt sudo cp -a armhf/* mnt sync sudo umount mnt # Now rootfs-wheezy.ext4 has the same contents as the bootstrapped Debian