How to customize LINUX Distro. for Beagle Board

Hi ,
I will be ordering an BB this week. I just need some help from you
all.
The two distro. that i have seen available with are Ubutu and
Angstrong.
My aim ( To order BB ) is to study following things:-
1. How to customize an Linux Distro for BB.( I might favour Fedora )
2. How to customize an UBoot for BB
3. Develop an Toolcahin (Started studing)
4. Interface CAMERA , GPS
I know this is an hell lot of work and will require a long and
dedicated effort.

Also can any one tell me how is the IDA system as far as support is
concerned. They have given me quotation of 14,700 with some
peripherals:-
1. Power adapter 5V ,2 Amp
2. 2 GB SD card
3. HDMI -VGA convertor.

Also is this peripherals specification correct.

So please advice ..........

That will be a HDMI to DVI-D cable not HDMI to VGA in perephrils

what BB are ordering? They all have SD card attached.

HDMI-VGA won’t work anyway, so it’s useless. You need DVI or HDMI display

Fedora is not ported to ARM architecture, so forget.

Develop a Toolchain? Ask CodeSourcery about the complexity of implementing a Toolchain :slight_smile:

2010/11/30 <rakshat@gmail.com>

fedora claims that it is ported and they have xM
instructions here:

https://fedoraproject.org/wiki/Architectures/ARM/BeagleBoardxMSDCard

i'm waiting for my new sd cards before i try it...

Fedora is not ported to ARM architecture, so forget.

Sort of. See http://fedoraproject.org/wiki/Architectures/ARM and
Architectures/ARM/HowToQemu - Fedora Project Wiki

Develop a Toolchain? Ask CodeSourcery about the complexity of
implementing a Toolchain :slight_smile:

Chances are he just needs to put one together. Buildroot and
Crosstool-NG can be used to put together a toolchain for BeagleBoard. I
use the latter. I'm not certain what CodeSourcery is using (might be
their own build). I find Crosstool-NG pretty easy to use, though
picking the right features can be difficult without some practice and
trial & error.

The two distro. that i have seen available with are Ubutu and
Angstrong.

That's about it at the moment. I have BeagleBox [1] working so you can
build your own distro (bootloader, kernel and rudimentary root
filesystem) though I've not tested video output with HDMI yet since I
was trying to get S-Video working. But the build system is setup to
allow you to build your own custom components.

My aim ( To order BB ) is to study following things:-
1. How to customize an Linux Distro for BB.( I might favour Fedora )

I don't recommend a desktop distro for an embedded device. It makes
more sense to roll your own and tools like Buildroot make that pretty
easy.

One thing some people might not grasp when starting:

Ubuntu and Fedora are Linux distributions, with each release targeting
specific platforms. They usually carry lots of tools an embedded system
won't need and don't typically support the requirements of embedded
hardware such as SD cards vs hard disks. But they're familiar to users
and often allow them to skip the lower level board support and jump
right to application development.

Angstrom (and its parent project, OpenEmbedded) and BeagleBox are
metabuilds. Their purpose is to build a Linux distribution of your own
based on configurations and extensions you provide. Angstrom is very
general purpose and supports many devices. BeagleBox is targeted
specifically at the BeagleBoard.

u-boot, the Linux kernel, buildroot and Crosstool-NG are components of
metabuilds that allow generation of specific software used by or within
a Linux distribution. u-boot is a bootloader. Crosstool-NG is a cross
compiler. Buildroot is a swiss army knife for building a cross
compiler, a root file system and even a Linux kernel.

Note: I only talk about BeagleBox because I work on it, but it also
provides an alternative example for that class of development project.

2. How to customize an UBoot for BB

Customization through configuration is simple enough. There is a config
file that can be edited to change some behavior of u-boot. Extending
the code requires some low level coding experience. BeagleBox allows
you to choose a variety of u-boot releases from various repositories but
you still need to understand how to write low level C code, how to
create patches and how to integrate the patches into the metabuild.
Pushing your patches to the upstream (where primary development of
u-boot is done) is encouraged and, if accepted, will eliminate the need
to keep your patches in the metabuild.

3. Develop an Toolcahin (Started studing)

You can put one of these together yourself for use with the BeagleBoard
using Buildroot or Crosstool-NG. BeagleBox will build the Crosstool-NG
version. I don't remember if Angstrom builds a cross compiler (re:
toolchain) for you. I think most people just use the prebuilt toolchain
from CodeSourcery when working with Angstrom.

4. Interface CAMERA , GPS

Once you get all the infrastructure in place (cross compiler,
bootloader, kernel, basic root file system), then this is where you're
system starts to separate itself from everyone elses. It's also where
things get really fun.

I know this is an hell lot of work and will require a long and
dedicated effort.

It is, but it's worth the effort to learn all of this. Small devices -
with custom environments, not off-the-shelf desktop distros - are a
booming part of our industry. BeagleBoard is an excellent way to get
familiar with that world.

Also can any one tell me how is the IDA system as far as support is
concerned.

I've never heard of this so can't help here. Sorry.

Good luck!

[1] BeagleBox:
http://www.graphics-muse.org/wiki/pmwiki.php?n=BeagleBox.BeagleBox

Ashish Mishra wrote:

Hi ,
I will be ordering an BB this week. I just need some help from you
all.
The two distro. that i have seen available with are Ubutu and
Angstrong.
My aim ( To order BB ) is to study following things:-
1. How to customize an Linux Distro for BB.( I might favour Fedora )
2. How to customize an UBoot for BB

no need, already done

3. Develop an Toolcahin (Started studing)

no need either

4. Interface CAMERA , GPS
I know this is an hell lot of work and will require a long and
dedicated effort.

Also can any one tell me how is the IDA system as far as support is
concerned. They have given me quotation of 14,700 with some
peripherals:-
1. Power adapter 5V ,2 Amp

OK

2. 2 GB SD card

OK

3. HDMI -VGA convertor.

unless it is an "active" (and expensive) HDMI to VGA connector
it will not work, don't waste that money. The BB can output
either DVI/HDMI or SVIDEO, but not VGA

Hi ,
Thanks ALL for your valuable reply. Michael as you said , can you tell me from where to start to work for DISTRO. Any suggestion will be helpful. I have just found an book ’ LINUX from SCRATCH ".It gives insight as how to build personal version of LINUX. Is this a good starting point…Or can you suggest something else…

Just by curiosity WHY is Fedora not suitable for ARM…SORRY but i am not having much expertise is either…330.gif

Thank You
Ashish

The version's of Fedora available for ARM run just fine on ARM (Fedora
12 is their last release) .. For awhile development their stagnated,
but the current fedora/arm developers are back at it and catching back
up.

Regards,

Well, I use arm-cortex_a8-linux-gnueabi of Crosstool-NG without problems on beagleboard xM.

works very well for me.

my reason for choosing fedora is it's been my desktop disty
forever, since redhat <small digit, 4?> and kernel 0.9 so
i dont have to learn a new distribution. makes development
easier for me.

IDA systems support is good but you just need to follow up them for
dispatch and one major thing: The courier service is too bad
(especially if you are in Pune). So ask them to send via some other
courier else it takes too much of time.

HDMI - VGA converter will be useless as many have advised. I have
myself tried a HDMI to DVI and then DVI to VGA adapter but the
combination did not work as was expected. So better get a DVI display
(about Rs. 6000) or you can also try the X11VNC server to export BB
display to your desktop / laptop.

If you are just starting in this field, my suggestion is better choose
an established distro like ubuntu or angstrom. Later on, try for
customizing a distro and many other things.

Good luck!

As a caveat, desktop distros can be rough on flash (re: SD) cards.
Swapping is likely to happen often and excessive writes will wear the SD
card faster than it would a hard disk. You can disable swap and use a
tmpfs filesystem for temporary writes (like /tmp, /etc/resolv.conf,
and /var) to reduce wear on the flash card. However, embedded devices
often have limited memory compared to a desktop and may not perform as
well without the swap.

I've not looked at either the Fedora ARM distro nor the Ubuntu version
many people appear to be using so can't say if these have been adjusted
to address this issue. They may already be configured for this purpose.

Not that SD cards are particularly pricey, but who wants to reinstall
all the time. And what about your user data? How do you make sure its
not lost when the SD card decides its had enough? Just something to
think about.

Hi ,
Thanks ALL for your valuable reply. Michael as you said , can you tell
me from where to start to work for DISTRO. Any suggestion will be
helpful. I have just found an book ' LINUX from SCRATCH ".It gives
insight as how to build personal version of LINUX. Is this a good
starting point.....Or can you suggest something else.......

Learning how to build a distro from scratch is useful. I did that a
while back. You can get step by step instructions on how to do this at
www.linuxfromscratch.org. It does teach you about what you need to even
begin to compile the programs you need. You can use these steps to
create your own build system - re: your own metabuild or personal
version of Angstrom (though I find it easier to start with "make" rather
than "bitbake", but that's personal preference).

But building your own distro is actually easier using Buildroot
(http://buildroot.uclibc.org/). You select the packages you want and
supply some target (hardware) info and it builds a root file system for
you. If you use Buildroot it's actually easy to build a metabuild
system on top of it that you can add additional applications to.

If you want to get started this way, just use the bootloader (u-boot)
and kernel image from the validation images (probably came with the SD
card when you got your board, if you got an SD card - I didn't) and work
at creating your own root file system with Buildroot. You can use the
Code Sourcery cross toolchain in this case. The idea is that you're
learning the bits and pieces starting with what's familiar first - the
root file system files are probably more familiar than cross compilers
and bootloaders.

Anyway, that's a starting point.

Just by curiosity WHY is Fedora not suitable for ARM........SORRY but
i am not having much expertise is either......

It's not that it's not suitable. It just wasn't, until relatively
recently, available for ARM systems.

two issues here; fedora too big and flash too brittle

As a caveat, desktop distros can be rough on flash (re: SD) cards.

i wouldn't call fedora for arm a desktop distro, it's pretty sparse;
(but not busybox sparse). the feature is you have the ability of installing
whatever rpms you want. the repositories aren't complete yet but
something has built a fire under the fedora people (probably the
coming wave of android tablets) and there seems
to be lots of manpower behind catching the arm disto up to the rest.

i also haven't seen hard evidence for the 'flash is delicate' idea.
i suspect urban myth. wear leveling alorithms are many years mature now.

Swapping is likely to happen often

this applies to any bb/distro where you need more memory than you have; not
just fedora.

whatever your application, if you have insufficient memory
then you have to consider swap. same for all distros.

we could set up a little contest to see if fedora writes more than
other distros. that would be fun...

and excessive writes will wear the SD
card faster than it would a hard disk.

i would love to see some hard numbers.

You can disable swap and use a
tmpfs filesystem for temporary writes (like /tmp, /etc/resolv.conf,
and /var) to reduce wear on the flash card.

i still think this is distro independent. it depends on what apps/rpms
are installed. and those tend to be identical between distros.

resolv.conf?

I've not looked at either the Fedora ARM distro nor the Ubuntu version
many people appear to be using so can't say if these have been adjusted
to address this issue. They may already be configured for this purpose.

i would say fedora is.

Not that SD cards are particularly pricey, but who wants to reinstall
all the time. And what about your user data? How do you make sure its
not lost when the SD card decides its had enough? Just something to
think about.

i would need some hard data before i worried about this. the specs for
the cards say otherwise.

here's a test someone did 2 years ago.

http://www.bress.net/blog/archives/114-How-Long-Does-a-Flash-Drive-Last.html

doesn't go far enough though.
he didn't try to repair the filesystem (or didn't report it).
i wonder if fsck and badblocks would resurrect writability for the drive?
i also don't think TRIM support was in the extfs code back then.
(trim tells the flash device that certain blocks no longer have
useful data on them so it is free to use them as destinations for
wear leveling).

interesting timing info though; i wouldn't have thought to measure that...

i have a small pile of class 2 2G flash cards now. i should try to
destroy one...

> As a caveat, desktop distros can be rough on flash (re: SD) cards.

i wouldn't call fedora for arm a desktop distro, it's pretty sparse;
(but not busybox sparse). the feature is you have the ability of
installing
whatever rpms you want.

That's definitely a benefit. Buildroot offers RPM support but I haven't
tried it yet.

i also haven't seen hard evidence for the 'flash is delicate' idea.
i suspect urban myth. wear leveling alorithms are many years mature now.

I got it from a number of places when writing a proposal for an SD/SSD
based system for the government. One place that spells it out plainly
(without backup references, however) is on D. Woodhouse's site for the
Linux-MTD support:

Last entry discusses the differences between block and flash devices
with respect to wear out times. Information appears to be from early
2009. Not sure if things have changed much since then.

> Swapping is likely to happen often
this applies to any bb/distro where you need more memory than you have;
not
just fedora.

Not picking on Fedora (it's the only distro I use on desktops - really
don't like Ubuntu as a developer). But desktop distros are general
purpose and have lots of utilities running that are not required for
most embedded products.

whatever your application, if you have insufficient memory
then you have to consider swap. same for all distros.

True, but only to a point. An embedded distro is (at least to this
point in history) more likely to run without swap because it doesn't
have long term storage (the SD card is a relatively recent feature in
the grand scheme of things). If you build a system that has but one
purpose - an alarm system, a set top box, a mobile recorder, etc. - you
can avoid swap. Also, swap is slower than running from memory.
Embedded systems tend to lean toward snappy response by intent. General
purpose distros lean toward full user experience, and can trade off
responsiveness if needed.

Note that one of the first thing CONFIG_PREEMPT_RT suggests is to avoid
swapping in applications by calling mlocakall() (see
RT PREEMPT HOWTO - RTwiki). If you want snappy response in your RT embedded box, you don't swap.

we could set up a little contest to see if fedora writes more than
other distros. that would be fun...

Doubt there is much difference. Many of them provide common system
features running as daemons, such as system logging (which generates
lots of writes). System logging might be different between distros and
that could affect the number of writes each does, I suppose.

> and excessive writes will wear the SD
> card faster than it would a hard disk.
i would love to see some hard numbers.

Again, start with David Woodhouse's info. He gives a rough estimate of
10^3 writes for MLC NAND and 10^5 writes for SLC NAND. Don't know which
type SD's use but I think it's SLC.

> You can disable swap and use a
> tmpfs filesystem for temporary writes (like /tmp, /etc/resolv.conf,
> and /var) to reduce wear on the flash card.

i still think this is distro independent. it depends on what apps/rpms
are installed. and those tend to be identical between distros.

Identical between desktop distros. Not between general purpose distros
and embedded platform distros.

resolv.conf?

DHCP on boot of an embedded device updates resolv.conf. A single write
to the SD card that can update far more of the card (due to erase/write
sizes in flash) than is necessary considering what is being updated.
Not to mention that resolv.conf doesn't need to be stored between boots
since DHCP will just update it the next time the board boots.

If you have a static network configuration then this isn't an issue.

i would need some hard data before i worried about this. the specs for
the cards say otherwise.

Maybe they've gotten better recently. Still, given they way they
function, they have a shelf life that is measurable and significantly
less than what is measurable for hard drives. And it's not particularly
hard to work around that in the boot sequence.

here's a test someone did 2 years ago.
http://www.bress.net/blog/archives/114-How-Long-Does-a-Flash-Drive-Last.html

Nicely done.

doesn't go far enough though.
he didn't try to repair the filesystem (or didn't report it).
i wonder if fsck and badblocks would resurrect writability for the
drive?

As Woodhouse says: Bad eraseblocks are not hidden and should be dealt
with in software

There is nothing the flash device does to help with bad blocks. That
support comes from higher level chip and/or software support.

i also don't think TRIM support was in the extfs code back then.
(trim tells the flash device that certain blocks no longer have
useful data on them so it is free to use them as destinations for
wear leveling).

Wear leveling helps, but it is a mitigator of the issue, not a
resolution. The fact remains that NAND flash operates differently than
a hard disk and in such a way that the lifespan of the flash is less
than the disk.

i have a small pile of class 2 2G flash cards now. i should try to
destroy one.

I do so many rootfs dd's to mine right now I keep expecting it to puke.
They last longer than I expected. If it lasts longer than 6 months I'll
be pleasantly surprised. But 6 months is not sufficient for an embedded
consumer device. It needs to run for years without failure and excess
writing to an SD card may make that problematic. Since it's an easy
issue to work around in the distro, there is no reason not to do so.

Of course all this is dependent on the target application of the device.
If you're building the world's tiniest, lowest power, mobile desktop,
then a desktop distro is probably what you want. If you're building an
application specific device like a set top box, then you probably want a
custom distro.

http://www.linux-mtd.infradead.org/faq/general.html#L_mtd_vs_hdd

good page - thanks

But desktop distros are general
purpose and have lots of utilities running that are not required for
most embedded products.

fedora arm seems pretty tight.

it might be oversimplified to think only desktop and embedded, the
flash based netbooks are creating a third category.

i agree that many beagleboard products should use ram filesystems.

i would still try doing development for such a product on flash rootfs
fedora and then porting. i think i could work faster and save myself
some frustration. i could be wrong.

we agree on swap

DHCP on boot of an embedded device updates resolv.conf. A single write
to the SD card that can update far more of the card (due to erase/write
sizes in flash) than is necessary considering what is being updated.

IIUC it updates one erase block. maybe not the same one each time if
wear leveling works. it's true we have no idea how well that works.

Ted T'so makes the argument that sd cards have FAT filesystems
in most applications and the file allocation table is always
updated each file create and is always logically in the same place
so wear leveling would have to get that right or it wouldn't be very useful.
it's not proof but with closed source sd card firmware all we could
do to improve our understanding is test a statistically
relevant sample to destruction and see what kind of numbers we get.

There is nothing the flash device does to help with bad blocks. That
support comes from higher level chip and/or software support.

i meant software support in the form of filesystem bad block handling.
you can map out blocks with extfs. i was wishing the fellow who got the 90M writes
would have tried to resurrect the device using badblocks(8).

thanks for your email. good food for thought.

that won't work because wear leveling can move sectors.
darn.