Embeded Debian ARMEL RootFS

Started by uMinded, March 11, 2013, 06:45:32 PM

Previous topic - Next topic

uMinded

I just want to share my bare bones root filesystem setup with everyone. This will give you the bare minimum system but will the full power of apt and the squeeze armel packages available. I chose to use uDev just because I have never set up a /dev/ by hand, it wouldn't be to hard to figure out what is needed and write a script to do it all but uDev has such a minimal performance penalty I didn't mind.

The reason I did this when their are full featured root filesystems already out there is I use the micro and wanted as much ram and disk space available for my own code. The second main reason is I need to build a package natively due to a cross compile bug in autotools. With an EMDebian setup like below a simple apt-get install build-essential give you the same set of tools as on your desktop!

Here is our unofficial a13-OLinuxINO Wiki


=== Commands Info ===
$ = Commands on host system 
# = Commands in chroot 
> = Commands on the olinuxino



=== Dependencies:  ===

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



*multistrap.conf*

[General]
noauth=true
unpack=true
debootstrap=Squeeze
aptsources=Squeeze
cleanup=true
arch=armel
directory=/media/a13-olinuxino/

[Squeeze]
packages=wpasupplicant wireless-tools udev apt apt-utils nano dialog module-init-tools
source=http://ftp.ca.debian.org/debian
keyring=debian-archive-keyring
components=main non-free
suite=squeeze


Note that you can put any apt package name under packages and it will automatically install so if you know you want things like dhcp3-client, emacs, build-essential, etc you can put it in here. Its just as easy to apt-get later on but it is quicker this way.


=== Step One ===

$ sudo multistrap -f multistrap.conf 
$ sudo cp /usr/bin/qemu-arm-static /media/a13-olinuxino/usr/bin/ 
$ sudo chroot /media/a13-olinuxino/ 



=== Step Two ===

# export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true 
# export LC_ALL=C LANGUAGE=C LANG=C 
# /var/lib/dpkg/info/dash.preinst install 
# dpkg --configure -a 
# passwd root 
# mknod -m 660 /dev/ttyS0 c 4 64 
# chown root:root /dev/ttyS0 
# nano /etc/inittab: (Add to the bottom) 
  T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100 
# exit 



At this point you can choose to keep installing things via the chroot   
or to boot the sd card on the hardware and continue with step three. 


Install Software (Do this block whenever you need to install via chroot) 

$ sudo cp /etc/hosts /media/a13-olinuxino/etc/ 
$ sudo chroot /media/a13-olinuxino/ 
# export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true 
# export LC_ALL=C LANGUAGE=C LANG=C 
# apt-get update   
# apt-get install <whatever you want> 
# exit 


=== Step Three ===
(Networking - On The Hardware)
[code]
> date -s "9 MAR 2013 03:00:00" (Do this or tar says everything is from the future lol)
> nano /etc/network/interfaces: 
  auto lo 
  iface lo inet loopback 

> nano /etc/hostname: 
  a13-olinuxino 

> nano /etc/resolv.conf: 
  nameserver 172.16.1.254 

> /etc/init.d networking restart 
> ifconfig (make sure your eth0 or wlan0 has an IP) 
> apt-get update (should resolve the addresses and work now)   


Alternatively you can use ntp for network time sync.

> apt-get install ntp
> dpkg-reconfigure tzdata
 


My program recommendations:
apt-file (so you can find other things like apt-file search ping so you can figure out what package to install) 
perl-base 
python 
stress 
openssh-server 
build-essential 


NOTES:
If you want to use DHCP then when you are still in the chroot do: 

# apt-get install dhcp3-client 


Or else you will need to set a static IP in /etc/network/interfaces to use apt-get on the hardware.


==== EXTRA ====
I installed samba so that I can work on code files on my dual monitor workstation. All I do is save to network location and in a terminal via ssh issue the make commands.


> apt-get install samba samba-client
> smbpasswd -a uminded
> nano /etc/samba/smb.conf

[uMinded]
comment = Home Directory
path = /home/uminded
browseable = yes
writable = yes
create mask = 0700
directory mask = 0771
force user = uminded
force group = users
guest ok = Yes

> /etc/init.d/samba restart

jwischka

Quote from: uMinded on March 11, 2013, 06:45:32 PM
I just want to share my bare bones root filesystem setup with everyone. This will give you the bare minimum system but will the full power of apt and the squeeze armel packages available. I chose to use uDev just because I have never set up a /dev/ by hand, it wouldn't be to hard to figure out what is needed and write a script to do it all but uDev has such a minimal performance penalty I didn't mind.

Just curious, but why armel instead of armhf?

uMinded

Quote from: jwischka on March 11, 2013, 08:36:45 PM
Just curious, but why armel instead of armhf?

Embeded Debain is currently in sync with Squeeze 6.0.7 I believe which only has native support for GCC 4.4 which does not have the hard float built-in. Of course you can build your own armhf system but I found this to be extremely simple and no packages need to be compiled as everything in the grip repo is armel compiled. My kernel is armhf and my intensive applications are armhf though.

jwischka

Quote from: uMinded on March 11, 2013, 10:57:34 PM
Quote from: jwischka on March 11, 2013, 08:36:45 PM
Just curious, but why armel instead of armhf?

Embeded Debain is currently in sync with Squeeze 6.0.7 I believe which only has native support for GCC 4.4 which does not have the hard float built-in. Of course you can build your own armhf system but I found this to be extremely simple and no packages need to be compiled as everything in the grip repo is armel compiled. My kernel is armhf and my intensive applications are armhf though.

I have made my own armhf image :), and it's posted here. :)

It just seems that, particularly if you're concerned about performance (and it would seem you are, running an RT build) that hf would make a lot more sense, given the performance differential.

Like I said, just curious.

uMinded

#4
Quote from: jwischka on March 11, 2013, 11:14:34 PM
I have made my own armhf image :), and it's posted here. :)

It just seems that, particularly if you're concerned about performance (and it would seem you are, running an RT build) that hf would make a lot more sense, given the performance differential.

We all thank you for your builds BTW, I used them myself in the beginning when I thought I had a hardware error. (It turned out to be a compiler compatibility issue thought giving void pointer locations)

The majority if programs running in userland are so small that their would be no performance gain running them in armhf mode. Things like uDev just don't need it. That being said if you want an uber-rootfs then check out our wiki on Buildroot. Then you can have a root filesystem where every byte it compiled for our architecture. I however wanted a full featured apt base instead of dealing with sources as well as your own projects.

For ARMHF support:

arch=armhf
suite=Wheezy


Replace that in the config file and you can use the "Testing" distro of Debian. But I advise against developing on it as when you spend hours tracking down a bug and find out its an incompatible compiler issue or something it is infuriating. Hopefully Wheezy becomes the new stable soon then we can run armhf without any though.

jwischka

Quote from: uMinded on March 12, 2013, 01:07:30 PM
Replace that in the config file and you can use the "Testing" distro of Debian. But I advise against developing on it as when you spend hours tracking down a bug and find out its an incompatible compiler issue or something it is infuriating. Hopefully Wheezy becomes the new stable soon then we can run armhf without any though.

Yeah... since armhf is a supported architecture going forward and armel is not, I suspect that change will happen soon. More to the point, hopefully we can start getting broad ARM support in mainline, and things will "just work" - as much as anything ever just works.

uMinded

The whole Debian movement seems to be in the direction of multiarch support which is quite fascinating. Currently Embedded Debian is being merged into standard Debian and should be availible in Wheezy if not Sid is supposed to have 100% multiarch compatibility.

It will be interesting to have a binary compatible multiarch as you could load android via qemu and run with a negligible performance penalty as your desktop will obviously be faster than the original ARM.

gboluk

Hi uMinded,
I developed new Armel RootFS as your suggestions. After I copy that directory "/media/a13-olinuxino/" to sdcard /dev/sdb2 partition. Copy command is "cp -Rfv media/a13-olinuxino/* /mnt/." Is this method true?
My problem is, when I boot system on development board, I can't use usb keyboards.

thanks.