Difference between revisions of "Debian Wheezy Instructions"

From odroid US
Jump to: navigation, search
(Bootstrap Debian with debootstrap)
(Adding an X Display Manager)
 
(106 intermediate revisions by 4 users not shown)
Line 1: Line 1:
  
  
=== Availability ===
+
== Introduction ==
An SD Card image for a Debian system for odroid-u2 is available in the downloads area [http://odroid.us/odroid/odroidu2/debian/ Debian-wheezy]
+
This effort started before HardKernel had a supported Debian image, now they have some.  At this writing the official build comes with the LXDE window manager installed -- depending on odroid board type.
  
The files with the .md5sum extensions give you an easy way to check validity after downloading, using md5sum like this:
+
There are some great full-featured user-contributed images available (GUI, XBMC and so on). For example: [http://forum.odroid.com/viewtopic.php?f=56&t=610 @robroyhall images]
<pre>
+
md5sum -c odroidu2_20130104-debian-wheezy-3.img.xz.md5sum
+
# odroidu2_20130104-debian-wheezy-3.img.xz: OK
+
</pre>
+
  
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.
+
In order to keep this branch relevant, it has been updated to match the Hardkernel setup.  It has the same bootloader, boot scripts, partition layout, kernel version, and kernel modules -- only it is headless, meaning no GUI.  The approach is modular and you can follow the steps to add Gnome or XFCE as you like.
  
The boot partition holds the kernel, initrd and u-boot boot scriptsThese will not exactly track the HK releases.
+
The images have full provenance, you could create the same setup starting from bootstrapping with an emulated ARMThis topic is meant to help teach about embedded Linux.
  
debian-wheezy describes the system. The .img means it is a SD card image and .xz shows the file compression typeI recently dropped the added version number in favor of a date.
+
== Versions ==
 +
*''minimal system'' ('''base''') - headless or server-style. Login with USB-UART kit or using ssh. No GUI.
 +
*''system with visual desktop'' ('''gnome''', '''xfce''') - '''recommended for new users'''
 +
*''root filesystem only'' ('''rootfs''') image - Need special handling[[Updating from Root File System Images|Tutorial: Updating from Root File System Images]]
  
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.
+
For Linux host users, see [[Step-by-step_Ubuntu_SD_Card_Setup|Tutorial: Step-by-step SD-Card setup on Linux host]]
  
=== Revision History ===
+
For Windows users, see [[Debian_Wheezy_SD_Card_prepare_(Windows)|Tutorial: Step-by-step SD-card setup on Windows]]
;debian-wheezy-2
+
:initial release
+
;debian-wheezy-3
+
  
:Added curl package, updated to kernel 3.0.57
 
;debian-wheezy-devel-4
 
:<li>This is setup for native compiling.  linux-3.0.57 is ready to build in /usr/src/linux.
 
:<li>Added prerequsites for building the kernel
 
:<li>Added sudo
 
:<li>Built and installed the kernel per this tutorial: [[Kernel compiling]]
 
  
;odroidu2-20130205-debian-wheezy-devel
+
== Availability ==
:<li>This is setup for native compiling. 
+
:<li>A private kernel build is installed: linux-3.0.61
+
:<li>The kernel source is removed from /usr/src/ in the interest of a smaller image
+
:<li>Fixed locale setup.  Added all locales.
+
:<li>Set the timezone to GMT+8 (USA Pacific)
+
:<li>Added ntpupdate package to update time from network
+
:<li>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 ====
+
Several Debian SD-Card images and root file system images are available for various odroid boards.  This set of links is not completeYou can browse the download area for more.
On first boot, the mac id file is not created, the root file system has not been mounted read/write at that timeMake up your own random mac id and do something like this:
+
<pre>
+
echo A6:2A:DC:0B:56:74 > /etc/smsc95xx_mac_addr
+
</pre>
+
  
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.
+
[[Debian-jessie-armel-odroidxu]]
  
=== Features ===
+
== Download Area ==
Writing an SD-card image and booting will give you a completely pristine, up-to-date, headless Debian 7.0 systemHeadless, meaning only the Linux console is active -- not the HDMI display.
+
'''Note:''' The file arrangement is by hardkernel board namesMake sure to download from the area that matches your board.  
  
The network will come up automatically, using DHCP.
+
The download area is here: [http://odroid.us/odroid/ http://odroid.us/odroid/]
  
The login is: user/password or root/root.  Specifically, this means username: user and password: password will get you in.  
+
== Features ==
Or you can use username: root password: root.  Yes, I do let root log in to the console...
+
Writing the '''base''' SD-card image and booting will give you a complete, headless Debian system. <br/>
 +
Headless, meaning only the Linux console is active -- not the HDMI display.
  
If you log in as user, you can su to become root.
+
The network will come up automatically, using DHCP and the ssh daemon will be started so you can connect from another computer -- even without the USB-UART kit.
  
=== Root Filesystem Images ===
+
== Login ==
The tarball with the -rootfs.tgz suffix is just the content of the rootfs partition of the SD card.   
+
=== Version 7 Credentials ===
 +
As of release 7, the login credentials are odroid/odroid and root/odroid in order to match the official Hardkernel Debian releaseSpecifically, this means username: odroid and password: odroid will get you in.
  
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.
+
Or you can use username: root, password: odroid.
  
See this tutorial for step-by-step instructions: [[Updating from Root File System Images]]
+
If you log in as user, you can use command ''su'' to become root.
  
=== Debian Tips ===
+
=== Version 6 Credentials ===
This page is for Debian Tips [[Debian Tips]]
+
Previous to version 7, the credentials were user/password and root/root
  
=== Image Creation Details ===
+
== Revision History ==
This is where I plan to detail how the image was created, starting with odroidu2_20130104-linaro-ubuntu-desktop-uSDeMMC.img.xz and then using debootstrap.
+
See [http://odroid.us/mediawiki/index.php?title=Debian-wheezy-revision-history here] for a complete revision history of all images
  
 +
The top of the tree for these Debian images is: [http://odroid.us/odroid/ http://odroid.us/odroid/]  Notice the arrangement by hardkernel board names?  Make sure you download from the area that matches your board.
  
==== Bootstrap Debian with debootstrap ====
+
You should use the standard images that support hard-floating point if possible (armhf)They will be faster than the soft-float versions -- yes, even of you are not doing floating point. The additional registers may be used to pass parameters.
To get started, we need a root file system that has all the components needed to boot DebianOnce we have that, we can configure the system and add more packages. This technique uses qemu-system-arm, so qemu needs to be installed.
+
  
For reference, these steps were taken right from the Debian wiki: [http://wiki.debian.org/EmDebian/CrossDebootstrap#QEMU.2Fdebootstrap_approach]
+
Some alternate images using soft floating point are also available (armel)
  
 +
You can't easily mix soft-float compiled and hard-float compiled binaries on the same system.  It is possible, but the general technique is not worked out yet (as far as I know).  The standard hardkernel kernels all built to support hard floating point, and that is a necessary requirement.
  
You might want to install the sudo package and add yourself to the sudoers list if you have not already done itThis next section is optional.
+
== Security Issues and Initialization ==
 
+
When you use an existing image, you pick up some keys that you should change for security reasonsOnce you boot your system the first time do this: (as root)
As root:
+
 
<pre>
 
<pre>
apt-get install sudo
+
rm /etc/ssh/*.pub /etc/ssh/*_key
# You need to add yourself to the "sudoers list", and how exactly that is done depends on the distribution.
+
#images starting at debian-wheezy-base-6.1 should have openssh-server installed
# This hack works for Debian Wheezy
+
# re-generate the host ssh keys
# as root, add normal user (named user) to adm group
+
dpkg-reconfigure openssh-server
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
+
</pre>
+
You need to logout/login after making the change to the sudoers list in order for it to take effect
+
  
Do the following steps as root, if you don't want to use sudo
 
<pre>
 
sudo apt-get update
 
sudo apt-get install binfmt-support qemu qemu-user-static debootstrap
 
 
</pre>
 
</pre>
  
 +
It is best to set a unique persistent MACID.  This script will do it:
 
<pre>
 
<pre>
# Go to a convenient directory
+
echo $( ifconfig | grep HWaddr | awk '{ print $5 }' ) >/etc/smsc95xx_mac_addr
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... ( 5m30s for me with local aptcached packages )
+
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
+
</pre>
+
  
 
NOTE: THIS SECTION IS UNDER DEVELOPMENT -- NOT COMPLETE/TESTED
 
 
We use qemu to bring up the system
 
<pre>
 
sudo cp $(which qemu-arm-static) armhf/usr/bin
 
 
</pre>
 
</pre>
  
Run debian second stageThis step is known to fail on QEMU PC emulator version 0.12.5It might work on newer versions.   
+
== Adding Native Compiler and Tools ==
Check the "Building QEMU" section in this tutorial if you need an updated version:
+
The base, xfce and gnome images do not include tools required to build the kernel or other compile other packagesHere are steps you can do to add that capability: (as root)We get some (but not all) recommended packages tooAll recommended packages add over 1GiB to the flash footprint
[http://odroid.us/mediawiki/index.php?title=Step-by-step_Using_qemu_to_Boot_an_Emulated_Odroid Building QEMU]
+
  
If you do have to build an updated qemu, then you need to copy the updated qemu-system-arm to the debian root file system, like this:
 
 
<pre>
 
<pre>
sudo cp $(which qemu-arm-static) armhf/usr/bin
+
apt-get install build-essential ncurses-dev
</pre>
+
apt-get install gcc-4.6-locales debian-keyring libstdc++6-4.6-dbg autoconf automake1.9 libtool flex bison gdb libmudflap0-4.6-dev
 +
apt-get install libgcc1-dbg libgomp1-dbg libmudflap0-dbg binutils-gold ed p7zip-full
  
<pre>
 
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true  LC_ALL=C LANGUAGE=C LANG=C sudo chroot armhf /debootstrap/debootstrap --second-stage
 
 
</pre>
 
</pre>
  
Trigger post-install scripts
+
== Adding an X Display Manager ==
<pre>
+
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
+
LC_ALL=C LANGUAGE=C LANG=C chroot debian_armel_wheezy dpkg --configure -a
+
</pre>
+
  
 +
[[ X Display Manager for odroidu2 ]]
  
cp /usr/bin/qemu-arm-static debian_armel_wheezy/usr/bin
+
[[ X Display Manager for odroidxu ]]
  
Fixup inittab
+
== Debian Tips ==
<pre>
+
This page is for Debian Tips [[Debian Tips]]
  
</pre>
+
== Image Creation Details ==
  
 
+
You can completely re-create any of these Debian root filesystem images own your own. All the instructions are here: [[Custom_Debian_Root_Filesystem_Image]].
 
+
 
+
 
+
Link: [http://wiki.debian.org/EmDebian/CrossDebootstrap#QEMU.2Fdebootstrap_approach]
+
 
+
 
+
Convert the root file system to a filesystem image (optional to launch with qemu)
+
<pre>
+
qemu-img create rootfs-wheezy.ext4 4G
+
mkfs.ext4 rootfs-wheezy.ext4
+
# 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, plus the device nodes we inserted
+
</pre>
+

Latest revision as of 22:07, 20 January 2014


Introduction

This effort started before HardKernel had a supported Debian image, now they have some. At this writing the official build comes with the LXDE window manager installed -- depending on odroid board type.

There are some great full-featured user-contributed images available (GUI, XBMC and so on). For example: @robroyhall images

In order to keep this branch relevant, it has been updated to match the Hardkernel setup. It has the same bootloader, boot scripts, partition layout, kernel version, and kernel modules -- only it is headless, meaning no GUI. The approach is modular and you can follow the steps to add Gnome or XFCE as you like.

The images have full provenance, you could create the same setup starting from bootstrapping with an emulated ARM. This topic is meant to help teach about embedded Linux.

Versions

  • minimal system (base) - headless or server-style. Login with USB-UART kit or using ssh. No GUI.
  • system with visual desktop (gnome, xfce) - recommended for new users
  • root filesystem only (rootfs) image - Need special handling. Tutorial: Updating from Root File System Images

For Linux host users, see Tutorial: Step-by-step SD-Card setup on Linux host

For Windows users, see Tutorial: Step-by-step SD-card setup on Windows


Availability

Several Debian SD-Card images and root file system images are available for various odroid boards. This set of links is not complete. You can browse the download area for more.

Debian-jessie-armel-odroidxu

Download Area

Note: The file arrangement is by hardkernel board names. Make sure to download from the area that matches your board.

The download area is here: http://odroid.us/odroid/

Features

Writing the base SD-card image and booting will give you a complete, headless Debian system.
Headless, meaning only the Linux console is active -- not the HDMI display.

The network will come up automatically, using DHCP and the ssh daemon will be started so you can connect from another computer -- even without the USB-UART kit.

Login

Version 7 Credentials

As of release 7, the login credentials are odroid/odroid and root/odroid in order to match the official Hardkernel Debian release. Specifically, this means username: odroid and password: odroid will get you in.

Or you can use username: root, password: odroid.

If you log in as user, you can use command su to become root.

Version 6 Credentials

Previous to version 7, the credentials were user/password and root/root

Revision History

See here for a complete revision history of all images

The top of the tree for these Debian images is: http://odroid.us/odroid/ Notice the arrangement by hardkernel board names? Make sure you download from the area that matches your board.

You should use the standard images that support hard-floating point if possible (armhf). They will be faster than the soft-float versions -- yes, even of you are not doing floating point. The additional registers may be used to pass parameters.

Some alternate images using soft floating point are also available (armel)

You can't easily mix soft-float compiled and hard-float compiled binaries on the same system. It is possible, but the general technique is not worked out yet (as far as I know). The standard hardkernel kernels all built to support hard floating point, and that is a necessary requirement.

Security Issues and Initialization

When you use an existing image, you pick up some keys that you should change for security reasons. Once you boot your system the first time do this: (as root)

rm /etc/ssh/*.pub /etc/ssh/*_key
#images starting at debian-wheezy-base-6.1 should have openssh-server installed
# re-generate the host ssh keys
dpkg-reconfigure openssh-server

It is best to set a unique persistent MACID. This script will do it:

echo $( ifconfig | grep HWaddr | awk '{ print $5 }' ) >/etc/smsc95xx_mac_addr

Adding Native Compiler and Tools

The base, xfce and gnome images do not include tools required to build the kernel or other compile other packages. Here are steps you can do to add that capability: (as root). We get some (but not all) recommended packages too. All recommended packages add over 1GiB to the flash footprint

apt-get install build-essential ncurses-dev
apt-get install gcc-4.6-locales debian-keyring libstdc++6-4.6-dbg autoconf automake1.9 libtool flex bison gdb libmudflap0-4.6-dev 
apt-get install libgcc1-dbg libgomp1-dbg libmudflap0-dbg binutils-gold ed p7zip-full

Adding an X Display Manager

X Display Manager for odroidu2

X Display Manager for odroidxu

Debian Tips

This page is for Debian Tips Debian Tips

Image Creation Details

You can completely re-create any of these Debian root filesystem images own your own. All the instructions are here: Custom_Debian_Root_Filesystem_Image.