Installation of debian under arm, ppc and other architectures.

Installation of debian on an embedded system

We can install the debian so simply and quickly that it seems that we don't need any manual. But it could be possible not to remember all of this tomorrow therefore it would be better to save this magical sequence.

Installing debian under arm architecture.

1. Go to the link http://ftp.debian.org/debian/dists/ and see the last version of debian distribution and its name. For example using the file readme we can see that wheezy is the Debian 7.5.

2. Installing debootstrap. We can read about it on wiki debian.

3. We get the initial system of debian. The name of the architectures supported by debian can be seen for example here http://ftp.debian.org/debian/dists/Debian7.5/

sudo debootstrap --verbose --arch armel --variant=minbase --foreign wheezy ./armDeb7 http://ftp.debian.org/debian

4. Further we need the following packages: binfmt-support qemu-arm-static, therefore we should install them in ubuntu. Copy the FS to the debian:

sudo cp /usr/bin/qemu-arm-static ./usr/bin/

Mounting:

mount devpts ./debian7/dev/pts -t devpts
mount -t proc proc ./debian7/proc  

and changing the root catalogue using chroot

sudo chroot ./armDeb7 

If we see the message "I have no name!@hostname:/#" it means that everything is OK and we can proceed to the second stage.

5. Run the debian7 in the file system (after chroot running)

/debootstrap/debootstrap --second-stage

At the end we can see something like this:
I: Base system installed successfully.

6. The root file system is ready. We can run it on the device. But before we should install what is nessesary for proper operation of the system. To exit the chroot we type exit.

Further we edit the file armDeb7/etc/apt/sources.list as follows:

deb http://http.debian.net/debian wheezy main
deb-src http://http.debian.net/debian wheezy main

deb http://http.debian.net/debian wheezy-updates main
deb-src http://http.debian.net/debian wheezy-updates main

deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main

and modify the root file system again:

sudo chroot ./armDeb7 

Running standard Linux utilities to install packages - updating:

# apt-get update

( as a result can be the following message:
Reading package lists... Error!
E: Can't mmap an empty file
W: You may want to run apt-get update to correct these problems
E: Empty package cache

One of the courses could be the fact that there is no bzip2 utility in the directory:
/usr/lib/apt/methods
)

Installing of packages:

# export LANG=C
# apt-get install apt-utils dialog locales module-init-tools udev netbase iproute iputils-ping openssh-server

Exit chroot - exit

For console working we should add a line to the end of the file ./debian7/etc/inittab

T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100

or comment out

# SERIAL CONSOLES
s0:2345:respawn:/sbin/agetty 115200 ttyS0 linux
s1:2345:respawn:/sbin/agetty 115200 ttyS1 linux

Replace the file /etc/shadow from the distribution openwrt. Or to disable the password of user root we should replace the line in shadow as follows:

#root:*:10770:0:::::
root::10770:0:::::

File system of debian is ready, copy it on device and start loading.

Network configuration in debian:

файл etc/network/interfaces
auto eth0
    iface eth0 inet static
    address 192.168.1.100
    netmask 255.255.255.0
    gateway 192.168.1.10

Check, if the package have been installed in debian:

# aptitude show gconf2

Such utilities as aptitude or apt-get are similar shells under the utility dpkg, therefore we can check if the package have been installed by doing as follows:

# dpkg -s gconf2

While gnome installing a package-related error occured gconf2:

Setting up gconf2 (2.28.1-6) ...
Illegal instruction
dpkg: error processing gconf2 (--configure):
 subprocess installed post-installation script returned error exit status 132
dpkg: dependency problems prevent configuration of notification-daemon:
 notification-daemon depends on gconf2 (>= 2.28.1-2); however:
  Package gconf2 is not configured yet.

Using the command dpkg we can check the information about the package:

# dpkg -s gconf2
Package: gconf2
Status: install ok half-configured
Priority: optional
Section: libs

I don't know what it means. I don't know why, but the package has been installed but not configured.

We can check the post-installation script and try to understand why it gave back the error. The script is located in /var/lib/dpkg/info/gconf2.postinst.

We can run it in the debugg mode in the following way:

sh -x /var/lib/dpkg/info/gconf2.postinst

It could sound strage but the message "Illegal instruction" is caused by the line:

NV_MAGICCONST = 4 * _exp(-0.5)/_sqrt(2.0) в файле  /usr/lib/python2.6/random.py.

If we comment out this line, the installing of gconf2 succeeds. It is cool.

Surch/view of available packages for installing:

# apt-cache search gconf2

As a rule, all applications in debian are installed from deb packages using of such utilities as apt-get install or aptitude.

But sometimes we need to install the application from source code, i.e. to run the prebuilding process.

A simple example is to install the programm mc.

Installing using the utility apt-get:

# apt-get install mc

Installation from source codes:

To install the packages from the source code we should install:

apt-get install autoconf automake devscripts libtool autotools-dev dpkg-dev build-essential fakeroot

Go to the folder /home and download the source code there

# cd /home
# apt-get source mc

Install the required dependencies:

apt-get build-dep mc

Build the packet:

# debuild -us -uc

Installation of the graphics (xorg-server) from the source code in debian:

# apt-get source xorg-server
# apt-get build-dep xorg-server
# debuild -us -uc

Here are the uBoot variables needed to download the debian from usb-flash:

set newBootCmd 'set ethact egiga1;tf $(loadaddr) mrv/brd6282/uImage;bootm $(loadaddr)'
set newBootArgs 'set bootargs console=ttyS0,115200 root=/dev/sda1 rootwait rw loglevel=8 init=/sbin/init'
set new_boot 'run newBootArgs; run newBootCmd;'

X configuration:
http://mydebianblog.blogspot.ru/2011/03/debian-debian-gnulinux-in-true-debian.html