Debian系统支持很多应用软件的安装。使嵌入式用户告别不停的交叉编译操作,直接在板卡上可以通过指令安装应用,数据库,web服务器等,相当于一个PC电脑了。
目前我们放入debian的移植方法,后期我们会发布数据库及webserver安装方法。
1.板卡准备:
CORE9G25:
Corewind提供的基于Atmel at91sam9g25的工业控制板卡,特性如下:
处理器: ARM9 @ 400Mhz Atmel AT91SAM9G25
内存: 128 or 256 MByte DDR2
存储: 256MB Nand Flash
以太网: 板载百兆PHY芯片
USB: 支持3路USB 接口
串口:支持扩展7路串口
I2C: 可扩展2路I2C总线
SPI: 可扩展2路SPI
GPIO:可扩展60路GPIO接口
A/D: 4通道10bit AD
Linux 3.6.9系统支持
Buildroot及Debian文件系统支持
-----------------------------------------------------------------------
一般来讲128MB内存跑debian足够了,不过如果跑大型数据库,还得上256MB 内存。
-------------------------------------------------------------------------
上个产品图片:
========================================================================
2.debian移植方法
Required packages
Install the required packages on your Ubuntu Linux PC (Tested on Ubuntu 13.10):
~$ sudo apt-get install multistrapUse Multistrap to generate the rootfs contents
~$ sudo apt-get install qemu
~$ sudo apt-get install qemu-user-static
~$ sudo apt-get install binfmt-support
~$ sudo apt-get install dpkg-cross
"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]Note that you can install more packages directly on the target using apt-get command.
packages=php5 apache2
source=http://ftp.it.debian.org/debian
suite=wheezy
Create the root filesystem
When your multistrap.conf file is ready launch Multistrap:
~/emdebian$ sudo multistrap -f multistrap.confMultistrap 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/binAt this prompt:
~/emdebian$ sudo LC_ALL=C LANGUAGE=C LANG=C chroot target-rootfs dpkg --configure -a
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.shthen create the target root login password:
~/emdebian$ sudo ./CORE9G25config.sh
~/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 updateIn the same way you add packages:
~/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
~/emdebian$ sudo LC_ALL=C LANGUAGE=C LANG=C chroot target-rootfs apt-get packagenamePlease nore that will be possible to add packages also directly on the target board. In than case the command will be simply:
# apt-get packagenamethen 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-staticthen 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.
------解决思路----------------------
前面有个 android ,又来了个 debian