https://elinux.org/api.php?action=feedcontributions&user=Kamondelious&feedformat=atomeLinux.org - User contributions [en]2024-03-28T15:03:26ZUser contributionsMediaWiki 1.31.0https://elinux.org/index.php?title=BeagleBoardAndOpenEmbeddedGit&diff=14439BeagleBoardAndOpenEmbeddedGit2009-10-29T16:53:42Z<p>Kamondelious: /* Booting */</p>
<hr />
<div>[[Category: Linux]]<br />
[[Category: OMAP]]<br />
[[Category:Development Boards]]<br />
[[Category: BeagleBoard]]<br />
<br />
'''NOTE:''' These instructions are unofficial and their correctness can not be guaranteed. The '''only''' site that has up-to-date official instructions is [http://www.angstrom-distribution.org/building-angstrom http://www.angstrom-distribution.org/building-angstrom]. Before making any support requests be sure that you have followed those instructions precisely.<br />
<br />
This guide briefly describes the steps that need to be taken in order to create an [http://www.openembedded.org/ OpenEmbedded] (OE) based image for the [[BeagleBoard]].<br />
It was created while performing an install on ubuntu804jeos (a minimal console only vmware appliance). This guide differs from the official guide in that we focus on the [[BeagleBoard]] as target and Ubuntu as host platform.<br />
<br />
The first step is to get a working Open Embedded installation. This can seam a daunting task at first but the rewards are great so here we go. This guide tries to be self containing. We therefore will not push you to use Google or read the other manuals.<br />
<br />
=== Prerequisites ===<br />
Disk Space<br />
<br />
Although OpenEmbedded images for the devices are usually quite small, the development system needs significant space. Take this into account, especially when using OE within a virtual machine.<br />
<br />
* Minimum requirement: 12 GB (e.g. omap3-console-image for Gumstix Overo and BeagleBoard)<br />
* Standard requirement: 30 GB (e.g. omap3-desktop-image)<br />
* Maximum requirement: 35 GB (for full OE build, bitbake world)<br />
<br />
So the minimum free disk space is about 15 GB (no desktop images), standard would be 35 GB and a safe size is 45 GB.<br />
<br />
RAM<br />
<br />
At least 512MB.<br />
<br />
OE tries to be as self supporting as possible. OE will both compile the cross compiler and the tools needed to compile a whole system. Still some dependencies are to be met using the "host" system. During the install we will be able to run almost all the commands as normal user but right now we will install the basic set of packages that are required to make OE to be happy.<br />
<br />
Fedora 11 - Needed Packages<br />
<pre><br />
su -c "yum install python m4 make wget curl ftp cvs subversion tar bzip2 gzip unzip python-psyco ccache perl"<br />
su -c "yum install texinfo texi2html diffstat openjade docbook-style-dsssl docbook-style-xsl docbook-dtds"<br />
su -c "yum install docbook-utils sed bison bc glibc-devel glibc-static gcc binutils pcre pcre-devel git"<br />
su -c "yum install quilt groff linuxdoc-tools patch linuxdoc-tools gcc gcc-c++ help2man perl-ExtUtils-MakeMaker"<br />
</pre><br />
<br />
Host tools to install:<br />
sudo apt-get update<br />
<br />
sudo apt-get upgrade<br />
<br />
sudo apt-get install ccache sed wget cvs subversion git-core coreutils unzip texi2html texinfo libsdl1.2-dev \<br />
docbook-utils gawk help2man diffstat gtk-doc-tools file g++ python-psyco minicom build-essential \<br />
libncurses5-dev python-dev python-pysqlite2 quilt<br />
<br />
OE and many tools and scripts that are used contain bashisms. We therefore want to change the default "/bin/sh" to point to bash.<br />
sudo dpkg-reconfigure dash<br />
#and select no<br />
<br />
Ubuntu 8.04 (and ealier)<br />
An other change need need to perform as root is to change some default settings of the kernel.<br />
sudo vi /etc/sysctl.conf<br />
vm.vdso_enabled = 0<br />
vm.mmap_min_addr = 0<br />
<br />
Run<br />
sudo sysctl -p<br />
<br />
Ubuntu 8.10 (and later)<br />
Add settings to config directory (Prefix 60-* ensures that it overrides all other settings). <br />
<br />
sudo -s<br />
echo -e "vm.vdso_enabled = 0\nvm.mmap_min_addr = 0" > /etc/sysctl.d/60-oe-settings.conf<br />
exit<br />
<br />
And then run<br />
sudo invoke-rc.d procps start<br />
<br />
If your host system is amd64 based the vm.vdso_enabled flag is not supported (at least at runtime) you therefore will need to add a boot parameter called vdso32=0<br />
<br />
== The effective install ==<br />
We are going install the OpenEmbedded system under the user's home directory in a directory called "oe". We will need about 10 gig of free disk space. Under that we will be putting the different components of the OE system. Those components are [http://bitbake.berlios.de/manual/ Bitbake], the OpenEmbedded meta-data and the beagle configuration. The Bitbake task executor will be put under "opt". The OpenEmbedded meta-data ( Bitbake recipes ), classes ( Bitbake extentions) and configuration (machine and arch setup) will be located under the "openembedded" directory. The BeagleBoard configuration will be placed under "beagleboard" directory.<br />
<br />
=== OpenEmbedded and Bitbake install ===<br />
This part really is not that difficult after all. It will checkout the OpenEmbedded<br />
meta-data repository including the BitBake task executor.<br />
<br />
<br />
Set the dir where everything will be done<br />
export OE_HOME=$HOME/oe<br />
<br />
Install the OpenEmbedded meta-data using git<br />
cd $OE_HOME<br />
git clone git://git.openembedded.net/openembedded<br />
#or if you are behind a firewall<br />
git clone http://repo.or.cz/r/openembedded.git<br />
<br />
Create a new git branch tracking the stable branch<br />
cd openembedded<br />
git checkout origin/stable/2009 -b stable/2009<br />
<br />
From now on "git pull" can be used to update your repository.<br />
<br />
=== Creating the BeagleBoard configuration and profile ===<br />
We now need to tweak OpenEmbedded to fit our Beagle needs. We create a profile script that we can run whenever we feel like playing with beagle. This script will perform a few tasks. It will add bitbake to our PATH so we can run the bitbake command from anywhere. It will then export the BBPATH and BBFILES. This tells bitbake where to find it's meta-data. BBPATH will both point to our own beagleboard files and openembedded.<br />
<br />
But first we create a local.conf containing the most important choices we need to make. Change at least the MACHINE to beagleboard. Select angstrom-2008.1 as distro. <br />
<br />
'''NOTE:''' There are some issues with the gcc version of ubuntu 8.10 and later please visit: [http://wiki.openembedded.net/index.php/Gcc_issues_in_Intrepid_and_later OpenEmbedded Issue]<br />
<br />
mkdir -p $OE_HOME/beagleboard/beagleboard/conf<br />
cat > $OE_HOME/beagleboard/beagleboard/conf/local.conf <<_EOF<br />
DISTRO = "angstrom-2008.1"<br />
BBFILES = "$OE_HOME/openembedded/recipes/*/*.bb"<br />
TMPDIR = "$OE_HOME/tmp"<br />
MACHINE = "beagleboard"<br />
ENABLE_BINARY_LOCALE_GENERATION = "0"<br />
_EOF<br />
<br />
If you have a multicore machine, you can also add these two variables to speed up things (a value of 2 is safe in most cases), see [http://dev.openbossa.org/trac/mamona/wiki/SpeedUp here]:<br />
<br />
BB_NUMBER_THREADS = "2" # Depends on your machine<br />
PARALLEL_MAKE = "-j 2" # Depends on your cluster<br />
<br />
Now we create our profile. There are TWO CHOICES here.<br />
<br />
'''NOTE''': In the recented version BitBake, it will remove all of the environment variables, unless they are trustly declared in BitBake whitelist(BB_ENV_EXTRAWHITE), therefore, you should list the env vars you need in the BitBake whitelist and export it. This is already done when creating the profile bellow using the BB_ENV_EXTRAWHITE environment variable.<br />
<br />
CHOICE 1) If you are going to operate directly connected to the internet (i.e. NO Proxy Firewall), then do:<br />
<br />
cd $OE_HOME<br />
cat > $OE_HOME/beagleboard/beagleboard/profile.sh <<_EOF<br />
export OE_HOME=\$HOME/oe<br />
export MY_OE_CONF="beagleboard"<br />
export BBPATH=\$OE_HOME/beagleboard/:\$OE_HOME/beagleboard/\$MY_OE_CONF:\$OE_HOME/openembedded<br />
export BBFILES="\$OE_HOME/openembedded/recipes/*/*.bb"<br />
export BB_ENV_EXTRAWHITE="MACHINE DISTRO ANGSTROM_MODE ANGSTROMLIBC OE_HOME"<br />
export PATH=\$OE_HOME/openembedded/bitbake/bin:\$PATH<br />
if [ "\$PS1" ]; then<br />
if [ "\$BASH" ]; then<br />
export PS1="\[\033[01;32m\]OE:\$MY_OE_CONF\[\033[00m\] \${PS1}"<br />
fi<br />
fi<br />
_EOF<br />
<br />
CHOICE 2) If you will be operating from behind a Proxy Firewall, then do:<br />
<br />
cd $OE_HOME<br />
cat > $OE_HOME/beagleboard/beagleboard/profile.sh <<_EOF<br />
export OE_HOME=\$HOME/oe<br />
export MY_OE_CONF="beagleboard"<br />
export BBPATH=\$OE_HOME/beagleboard/:\$OE_HOME/beagleboard/\$MY_OE_CONF:\$OE_HOME/openembedded<br />
export BBFILES="\$OE_HOME/openembedded/recipes/*/*.bb"<br />
export BB_ENV_EXTRAWHITE="MACHINE DISTRO ANGSTROM_MODE ANGSTROMLIBC OE_HOME"<br />
export PATH=\$OE_HOME/openembedded/bitbake/bin:\$PATH<br />
export CVS_TARBALL_STASH="http://oesources.org/sources/current/"<br />
if [ "\$PS1" ]; then<br />
if [ "\$BASH" ]; then<br />
export PS1="\[\033[01;32m\]OE:\$MY_OE_CONF\[\033[00m\] \${PS1}"<br />
fi<br />
fi<br />
_EOF<br />
<br />
Now make the profile executable:<br />
<br />
chmod +x $OE_HOME/beagleboard/beagleboard/profile.sh<br />
<br />
== Running ==<br />
We now have finished the installation. If everything goes well we can now create images for the BeagleBoard<br />
<br />
source $OE_HOME/beagleboard/beagleboard/profile.sh<br />
<br />
Pull down any changes from the stable/2009 git tree. <br />
<br />
cd $OE_HOME/openembedded<br />
git checkout origin/stable/2009 -b stable/2009<br />
git pull<br />
<br />
Now build the console image.<br />
<br />
cd $OE_HOME<br />
bitbake console-image<br />
<br />
<br />
*If this goes well your computer will be compiling for a long time. A long time can be several hours. Once this works try using the x11-image target (bitbake x11-image) this will give you a more complete distribution<br />
<br />
*If you receive an error of the form "ERROR: Unable to open conf/bitbake.conf" check that your profile.sh created earlier has the correct BBPATH setting (copy/pasting from this page may cause a line-break between the export command and the BBPATH var).<br />
<br />
*if you receive an error with module-init-utils-cross and you are running fedora 11, the glibc-static rpm has not been installed, see the list of fedora 11 packages that need to be installed above.<br />
<br />
== Preparing the system for booting ==<br />
The output of the bitbake command will ultimately be found under the $OE_HOME/tmp/deploy/glibc/images/beagleboard. In there you can find at least 3 interesting files:<br />
* console-image-beagleboard.tar<br />
* console-image-beagleboard.jffs2 and <br />
* uImage-beagleboard.bin<br />
<br />
The console images are representations of a full and self containing file system *including* a kernel. The uImage is a linux kernel image that is suitable to be loaded by the U-boot bootloader. The difference between the tar file and the jffs2 image is that the later is better suited to directly put on a raw partition. <br />
<br />
We are going to use the U-boot that is already provided in the NAND flash of the beagleboard as that one already support the MMC can load kernel images from a fat file system.<br />
What we will do is to format a SD-card to hold both a fat and an ext2 file system. We will put the kernel in the fat file system as U-boot failed to load the image from a ext2 file system. We will unpack the console-image under the ext2 file system.<br />
<br />
===Create partitions and format the SD-card ===<br />
We usually create two partitions, the first one has a FAT partition type and the second one a Linux file system type . We then format them and put content on them.<br />
We are not going the describe the formating other then briefly because it just if to easy to format the wrong partition. There are a few reasons for having a first partition as FAT but his is not the scope of this document ( Think of U-boot, windows , mass-storage ). Instruction for formatting the SD-card correctly can be found at: [http://code.google.com/p/beagleboard/wiki/LinuxBootDiskFormat Boot Disk Format]<br />
<br />
Here is the output of the fdisk -l command after creating the new partitions.<br />
Disk /dev/mmcblk0: 2032 MB, 2032664576 bytes<br />
1 heads, 16 sectors/track, 248128 cylinders<br />
Units = cylinders of 16 * 512 = 8192 bytes<br />
Disk identifier: 0x2f3dffc4<br />
<br />
Device Boot Start End Blocks Id System<br />
/dev/mmcblk0p1 2 12209 97664 b W95 FAT32<br />
/dev/mmcblk0p2 12210 248128 1887352 83 Linux<br />
<br />
We now format the file systems ext2 file system under /mnt. Some system will perform a automount of the newly created file system. Try to disable this automount feature if possible (it is not easy) or use gparted <br />
mkfs.vfat /dev/mmcblk0p1<br />
mkfs.ext2 /dev/mmcblk0p2<br />
<br />
Mount the ext2 file system and unpack the archive. Do not forget the -C option.<br />
mount /dev/mmcblk0p2 /mnt<br />
tar xvf system/angstrom/deploy/glibc/images/beagleboard/console-image-beagleboard.tar -C /mnt<br />
umount /mnt<br />
<br />
Mount the fat file system and copy the kernel image to there.<br />
mount /dev/mmcblk0p1 /mnt<br />
cp system/angstrom/deploy/glibc/images/beagleboard/uImage-beagleboard.bin /mnt/uImage<br />
umount /mnt<br />
<br />
== Booting ==<br />
We can put the SD-card in the beagleboard and wait for the U-boot prompt. The kernel we compiled only gave serial output if we first ran the coninfo command we therefore type coninfo and ask U-Boot to initialise<br />
the mmc stack. After that we set the kernel command line telling what the console is and where our root file system is located. We then load the image from the fat file system into memory and boot the kernel<br />
<br />
coninfo<br />
mmc init<br />
setenv bootargs 'console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1'<br />
fatload mmc 0:1 0x80000000 uImage<br />
saveenv<br />
bootm<br />
<br />
===One very important note:=== <br />
<br />
It's important to have an X-Loader on your Beagleboard that uses the uBoot on the SD Card that goes with the Angstrom uImage. The B5 Beagleboards do not appear to come with such an X-Loader / U-Boot combination (i.e. the B5 standard uBoot will lead to problems with the sound driver and other things, but will not tell you that it's creating a problem).<br />
<br />
The fix is to load a new X-Loader which will in turn automatically load the uBoot from the SD card, which again in turn will load the uImage properly.<br />
<br />
So you likely will have to upgrade the X-Loader. Here's what to do:<br />
<br />
* Make an SD Card with the [http://www.angstrom-distribution.org/demo/beagleboard Angstrom Demo files]. See the [http://code.google.com/p/beagleboard/wiki/LinuxBootDiskFormat Beagleboard Wiki Page] for more info on making the SD Card.<br />
* Put the SD Card in the Beagle, and boot up to the U-Boot Prompt.<br />
* Do the first six instructions in the [http://code.google.com/p/beagleboard/wiki/BeagleNANDFlashing Flashing Commands with U-Boot] section. <br />
* Reboot the Beagle to see that the new X-Loader is properly loaded.<br />
<br />
This will update the X-Loader to a newer version that will automatically load uBoot from the SD card, and then load uImage from the SD card, rather than always using the uBoot in the Beagleboard NAND.<br />
<br />
===Setting the video resolution:===<br />
<br />
The Angstrom kernels since 2.6.27 have used "DSS2", which is a candidate for replacing the OMAP framebuffer driver in the mainline Linux kernel. It provides greater flexibility for support of the S-Video port on the BeagleBoard and more monitor resolutions than previous mainline kernels. Documentation for the driver is in the kernel source at [Documentation/arm/OMAP/DSS http://groups.google.com/group/beagleboard/msg/4c64b2c614622053].<br />
<br />
Below is one example:<br />
<br />
setenv bootargs console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootwait omap-dss.def_disp=lcd omapfb.video_mode=640x480MR-16@60<br />
<br />
== Using the OpenEmbedded Environment ==<br />
<br />
If you have not used bitbake / OpenEmbedded before, a helpful example for creating packages that can be installed on a beagle linux install (such as the one created above) can be found at [http://www.gumstix.net/Software/view/Build-system-overview/Hello-world-tutorial/111.html Hello World Tutorial for Gumstix].<br />
<br />
See also Open Embedded User's Manual (these links point to nightly builds of the documentation and so should always be up to date):<br />
* [http://docs.openembedded.org/usermanual/html/ HTML Format]<br />
* [http://docs.openembedded.org/usermanual/usermanual.pdf PDF Format]<br />
and bitbake User's Manual:<br />
* [http://bitbake.berlios.de/manual/ HTML Format]<br />
<br />
==OpenEmbedded development==<br />
<br />
See [[BeagleBoardOpenEmbeddedDevelopment|OpenEmbedded development guide]] for one way how to modify and build packages contained within OpenEmbedded (OE) for the BeagleBoard.</div>Kamondelious