This chapter introduce the method to build the Embedian system for CORE9G25, if you only want to use it, you can find the debian system image on the MicroSD card repository chapter.

Embedded Debian (Emdebian) is essentially a standard Debian distribution optimised for size. This article illustrates how to build an Emdebian Wheezy Grip 3.0 (based on Debian 7.2 "wheezy") root filesystem for the CORE9G25 boards.

Embedded Debian is available in different flavours. Embebian/Grip is one of these, read these articles to know more about them:

Required packages

Install the required packages on your Ubuntu Linux PC (Tested on Ubuntu 13.10):

~$ sudo apt-get install multistrap
~$ sudo apt-get install qemu
~$ sudo apt-get install qemu-user-static
~$ sudo apt-get install binfmt-support
~$ sudo apt-get install dpkg-cross

Use Multistrap to generate the rootfs contents

"Multistrap is a tool that automates the creation of complete, bootable, root filesystems. It can merge packages from different repositories to make the rootfs. Extra packages are added to the rootfs simply by listing them - all dependencies are taken care of. Current development in multistrap is to support user-specified scripts being added as hooks during the unpacking phase to add customised startup scripts and configure things like device nodes".

Create a working directory

~$ mkdir emdebian
~$ cd emdebian
~/emdebian$

Create or download a file called multistrap.conf with the following contents:

[General]
arch=armel
directory=target-rootfs
cleanup=true
noauth=true
unpack=true
debootstrap=Emdebian Net Utils Python
aptsources=Emdebian 

[Emdebian]
packages=apt
source=http://www.emdebian.org/grip
keyring=emdebian-archive-keyring
suite=wheezy-grip

[Net]
#Basic packages to enable the networking
packages=netbase net-tools ethtool udev iproute iputils-ping ifupdown isc-dhcp-client ssh 
source=http://www.emdebian.org/grip

[Utils]
#General purpose utilities
packages=locales adduser nano less wget vim rsyslog dialog
source=http://www.emdebian.org/grip

#Python language
[Python]
packages=python python-serial
source=http://www.emdebian.org/grip

Read Multistrap man page to understand each directive meanings.

Adding packages

You can add or remove packages changing the "packages=" or adding new sections on "debootstrap=" line.

For example if you need to install the Apache http server and the PHP language add this section in multistrap.conf:

[Php]
packages=php5 apache2
source=http://www.emdebian.org/grip

and add the new section on this line:

debootstrap=Emdebian Net Utils Python Php

In this example we are using the Italian Debian repository http://ftp.it.debian.org/debian so to use your local Debian repository change .it. with your country ISO code (for example .uk., etc).

Note that not all the packages are available in the Emdebian-Grip repository so you need to download them from the standard Wheezy Debian repository in this case the section will become something like this:

[Php]
packages=php5 apache2
source=http://ftp.it.debian.org/debian
suite=wheezy

Note that you can install more packages directly on the target using apt-get command.

Create the root filesystem

When your multistrap.conf file is ready launch Multistrap:

~/emdebian$ sudo multistrap -f multistrap.conf
...
Multistrap system installed successfully in /home/.../emdebian/target_rootfs/.

At the end of this procedure the directory target-rootfs directory will contents the whole rootfs tree to be moved into the second partition of an CORE9G25 board bootable microSD.

Configure now the EmDebian packages using the armel CPU emulator QEMU and chroot to create a jail where dpkg will see the target-rootfs as its root (/) directory.

~/emdebian$ sudo cp /usr/bin/qemu-arm-static target-rootfs/usr/bin
~/emdebian$ sudo LC_ALL=C LANGUAGE=C LANG=C chroot target-rootfs dpkg --configure -a

At this prompt:

Reply with < No >.

Some other prompt will appear during the configuration. Reply to them as you like.

When finished the target rootfs will be almost ready to be moved on the target microSD but it still needs some last extra configuration before using it.

Create a command file like this:

#!/bin/sh
#Target directory where will be createt the next target
#rootfs
TARGET_ROOTFS_DIR="target-rootfs"

#Directories used to mount some microSD partitions 
echo "Create mount directories"
mkdir $TARGET_ROOTFS_DIR/media/mmc_p1
mkdir $TARGET_ROOTFS_DIR/media/data

#Set the target board hostname
filename=$TARGET_ROOTFS_DIR/etc/hostname
echo Creating $filename
echo CORE9G25 > $filename

#Set the defalt name server
filename=$TARGET_ROOTFS_DIR/etc/resolv.conf
echo Creating $filename
echo nameserver 8.8.8.8 > $filename
echo nameserver 8.8.4.4 >> $filename

#Set the default network interfaces
filename=$TARGET_ROOTFS_DIR/etc/network/interfaces
echo Updating $filename
echo allow-hotplug eth0 >> $filename
echo iface eth0 inet dhcp >> $filename

#Set the eth0 interface MAC address
echo hwaddress ether 00:04:25:12:34:56 >> $filename

#Set a terminal to the debug port
filename=$TARGET_ROOTFS_DIR/etc/inittab
echo Updating $filename
echo T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 >> $filename

#Set how to mount the microSD partitions
filename=$TARGET_ROOTFS_DIR/etc/fstab
echo Creating $filename
echo /dev/mmcblk0p1 /media/mmc_p1 vfat noatime 0 1 > $filename
echo /dev/mmcblk0p2 / ext4 noatime 0 1 >> $filename
echo /dev/mmcblk0p3 /media/data ext4 noatime 0 1 >> $filename
echo proc /proc proc defaults 0 0 >> $filename

#Add the standard Debian repositories. In this way it is possible
#to install packages not included in the Emdebian/Grip repositories
filename=$TARGET_ROOTFS_DIR/etc/apt/sources.list
echo Creating $filename
echo deb http://ftp.it.debian.org/debian wheezy main  > $filename                     
echo deb http://security.debian.org/ wheezy/updates main  >> $filename

#Add the standard Debian non-free repositories useful to load
#closed source firmware (i.e. WiFi dongle firmware)
echo deb http://http.debian.net/debian/ wheezy main contrib non-free >> $filename
 

or copy it from our CD:/debian/code/acmeconfig.sh. This file contains some initial setup for you new environment.

~/emdebian$ sudo chmod +x CORE9G25config.sh
~/emdebian$ sudo ./CORE9G25config.sh

then create the target root login password:

~/emdebian$ sudo chroot target-rootfs passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Ugrade the system and install new package

At this point you can upgrade Debian to the latest version (7.2) by typing:

~/emdebian$ sudo LC_ALL=C LANGUAGE=C LANG=C chroot target-rootfs apt-get update
~/emdebian$ sudo LC_ALL=C LANGUAGE=C LANG=C chroot target-rootfs apt-get upgrade
~/emdebian$ sudo LC_ALL=C LANGUAGE=C LANG=C chroot target-rootfs apt-get clean

In the same way you add packages:

~/emdebian$ sudo LC_ALL=C LANGUAGE=C LANG=C chroot target-rootfs apt-get packagename

Please nore that will be possible to add packages also directly on the target board. In than case the command will be simply:

# apt-get packagename

then remove the qemu-arm-static executable:

Copy the rootfs contents on microSD

Remove this file from the rootfs contents:

~/emdebian$ sudo rm target-rootfs/usr/bin/qemu-arm-static

then format a new microSD.

Mount the microSD on your Ubuntu Linux PC and copy all the target-rootfs contents in the second microSD partition mounted on /media/$USER/rootfs.

~/emdebian$ sudo rsync -axHAX --progress target-rootfs/ /media/$USER/rootfs/

If you are using an Ubuntu release older than 13.10 remove $USER in the path

Unmount the microSD, insert it in your board, insert the Debug serial cable to see the Kernel bootstrap messages and boot.

Related links

Documentation Terms of Use
The Acme Systems srl provides this Debian system development and user manual.
The origin of these doc came from the website: http://www.acmesystems.it
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Creative Commons License

关注我们: 微博

销售邮箱:market@armdevs.com
技术支持: support@armdevs.com
销售电话: +86-755-29638421


核风在线支持>
在线时间:09:00-18:00
Copyright @ 2014 to 2020 - 核风智能技术有限公司