Difference between revisions of "Building for BeagleBone"

From eLinux.org
Jump to: navigation, search
(crosstool-NG)
Line 69: Line 69:
 
Now with that sdcard in BeagleBone the output from serial should be:
 
Now with that sdcard in BeagleBone the output from serial should be:
  
<pre class="bash">
+
<pre class="bash">U-Boot SPL 2014.07-rc4-00264-g23f23f2-dirty (Jul 05 2014 - 21:56:58)
U-Boot SPL 2014.07-rc3-00136-gba9b42c (Jun 25 2014 - 14:36:07)
 
 
reading u-boot.img
 
reading u-boot.img
 
reading u-boot.img
 
reading u-boot.img
  
U-Boot 2014.07-rc3-00136-gba9b42c (Jun 25 2014 - 14:36:07)
+
 
 +
U-Boot 2014.07-rc4-00264-g23f23f2-dirty (Jul 05 2014 - 21:56:58)
  
 
I2C:  ready
 
I2C:  ready
Line 84: Line 84:
 
Net:  <ethaddr> not set. Validating first E-fuse MAC
 
Net:  <ethaddr> not set. Validating first E-fuse MAC
 
cpsw, usb_ether
 
cpsw, usb_ether
Hit any key to stop autoboot:  0
+
Hit any key to stop autoboot:  0  
 
switch to partitions #0, OK
 
switch to partitions #0, OK
 
mmc0 is current device
 
mmc0 is current device
 
SD/MMC found on device 0
 
SD/MMC found on device 0
 
reading uEnv.txt
 
reading uEnv.txt
9 bytes read in 4 ms (2 KiB/s)
+
** Unable to read file uEnv.txt **
Loaded environment from uEnv.txt
 
Importing environment from mmc ...
 
 
** Invalid partition 2 **
 
** Invalid partition 2 **
 
switch to partitions #0, OK
 
switch to partitions #0, OK
Line 97: Line 95:
 
SD/MMC found on device 1
 
SD/MMC found on device 1
 
reading uEnv.txt
 
reading uEnv.txt
26 bytes read in 4 ms (5.9 KiB/s)
+
26 bytes read in 3 ms (7.8 KiB/s)
 
Loaded environment from uEnv.txt
 
Loaded environment from uEnv.txt
 
Importing environment from mmc ...
 
Importing environment from mmc ...
** File not found /zImage **
+
** File not found /boot/zImage **
 
Booting from nand ...
 
Booting from nand ...
  
Line 107: Line 105:
 
no devices available
 
no devices available
 
Bad Linux ARM zImage magic!
 
Bad Linux ARM zImage magic!
U-Boot#
+
U-Boot#  
 
</pre>
 
</pre>
  

Revision as of 18:19, 5 July 2014

Arm Compiler

Setting up cross-compile environment is the first and necessary step.

Distro provided

The easier way is install the default compiler provided by your distribution.

Ubuntu : gcc-arm-linux-gnueabi

Arch Linux : arm-linux-gnueabi-gcc

Debian : ??

Fedora : ??

Linux Mint : ??

  • Tip: Do a alias in your environment, where N is the number of processors cores plus one:
$ alias armmake='make -jN ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- '

crosstool-NG

crosstool-NG aims at building toolchains. So, by this way you will build your own cross-compiler, but this requires that you choose an operation system and LibC. Therefore we will build a cross-compiler for Linux/gLibc.

U-Boot

Mainline U-boot

You can use the mainline u-boot for beaglebone.

Get:

$ git clone git://git.denx.de/u-boot.git

Clean:

$ armmake distclean

Configure for BeagleBone:

$ armmake am335x_evm_config

Build:

$ armmake

Test your new U-Boot

You need a microSd card with 2Gb or more. In order to make U-Boot work you will need to create the first partion as FAT32 LBA, bootable, with something like 64 Megabytes.
This command wipes everything from your sdcard and creates that partition.

$ echo -e "o\nn\np\n1\n\n+64M\na\n1\nt\nc\nw\n" | sudo fdisk /dev/MYDISK ; sudo fdisk /dev/MYDISK -l

This comand should print something like:

Disk /dev/sdb: 7948 MB, 7948206080 bytes
16 heads, 4 sectors/track, 242560 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1c524301
    Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048      133119       65536    c  W95 FAT32 (LBA)

The U-Boot compilation generated two files, MLO and uboot.img. Mount the partition that you just created and copy FIRST the MLO file to partition. Then copy the u-boot.img.

$ sudo mount /dev/MYDISK /mnt
$ sudo cp MLO /mnt
$ sudo cp u-boot.img
$ sudo sync
$ sudo umount  /mnt

Now with that sdcard in BeagleBone the output from serial should be:

U-Boot SPL 2014.07-rc4-00264-g23f23f2-dirty (Jul 05 2014 - 21:56:58)
reading u-boot.img
reading u-boot.img


U-Boot 2014.07-rc4-00264-g23f23f2-dirty (Jul 05 2014 - 21:56:58)

I2C:   ready
DRAM:  512 MiB
NAND:  0 MiB
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Warning - readenv() failed, using default environment

Net:   <ethaddr> not set. Validating first E-fuse MAC
cpsw, usb_ether
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
reading uEnv.txt
** Unable to read file uEnv.txt **
** Invalid partition 2 **
switch to partitions #0, OK
mmc1(part 0) is current device
SD/MMC found on device 1
reading uEnv.txt
26 bytes read in 3 ms (7.8 KiB/s)
Loaded environment from uEnv.txt
Importing environment from mmc ...
** File not found /boot/zImage **
Booting from nand ...

no devices available

no devices available
Bad Linux ARM zImage magic!
U-Boot# 

There are two problems in this output. First, you don't have a uEnv.txt, which configure the U-Boot and secondly you don't have a linux image.

Kernel

Mainline Kernel

TODO

Test your new Kernel

TODO