(Created page with "With recent refinements of Flash and Java/AJAX, webcam chat systems may be handled, cross-platform in browsers. Like language barriers and cultural barriers, system platform b...")
 
(U-Boot tftpboot)
 
(41 intermediate revisions by one user not shown)
Line 1: Line 1:
With recent refinements of Flash and Java/AJAX, webcam chat systems may be handled, cross-platform in browsers. Like language barriers and cultural barriers, system platform barriers are starting out disappear quickly.
+
== Compiling the BeagleBone Black Kernel ==
  
Random video chat systems were the first apparition of the new form of online video chat, and were for the greater degree a toy. They did however provide some useful variety-rich communication and interaction environment using a high a higher level safety due to distance.
+
The following contains instructions for building the BeagleBone Black kernel on Ubuntu 15.04.
  
However, now more direct, predetermined group video chat systems have become popular. These free webcam chat sites are springing up like dandelions and therefore are becoming quite popular. Where there once had being complicated and frequently unreliable conference calls and video chat sessions create with programs committed to it, now it's much easier. These clients often never worked, or had issues between platforms, ISPs or any variety of other variables.
+
== Prerequisites ==
  
The simplicity of that is helping to make the technology considerably more practical. As video compression math gets increasingly better, this trend will continue. But, have you ever wondered how fraxel treatments works, or why it turned out difficult to produce it work the way it can now until very recently?
+
=== ARM Cross Compiler ===
  
It's actually not that complicated. [http://www.meewii.com video chat] systems actually virtually work the same way as old streaming video which public video sites use to the day. A connection is established, along with the video data is shipped in items of data called "packets" in a finite amount. Every a lot of seconds, a particular amount of video is within the memory, known as a "buffer", and played for the screen.
+
To compile the linux kernel for the BeagleBone Black, you must first have an ARM cross compiler installed. I use gcc version 4.7.4 that ships with Ubuntu 15.04. To install the compiler run:
  
With free video chat services on web pages, there are simply a couple of these. One ones is capturing your video stream and sending it on the other end in the conversation. At the identical time, there is another stream coming right to the video area on your end. So really, it's just two live streams between exclusive machines.
+
<PRE>
 +
sudo apt-get install gcc-arm-linux-gnueabi
 +
</PRE>
  
But, consider the character of video. An image over cable internet takes a couple of seconds to receive and render. Double that for sending it to a new person for and view. Now, with webcam chat, you've video, that is many, many images and sound on the same time. This can be a heavy thing. Web browsers utilized to not contain the capacity to handle this. At one time, even bandwidth restrictions were present.
+
=== GIT ===
  
All this in mind, it isn't surprising that while the video phone concept continues to be an extended time predicted and awaited, its current incarnation wasn't really possible until near the final in the past decade. It will likely be very interesting to find out what continued improvement of bandwidth computing power and browser capacity is prone to make this able to do inside the future. Only time will tell, of course.
+
The Beaglebone patches and build scripts are stored in a git repository. Install git:
 +
 
 +
<PRE>
 +
sudo apt-get install git
 +
</PRE>
 +
 
 +
And configure with your identity.
 +
 
 +
<PRE>
 +
git config --global user.email "your.email@here.com"
 +
</PRE>
 +
 
 +
=== lzop Compression ===
 +
 
 +
The Linux Kernel is compressed using lzo. Install the lzop parallel file compressor:
 +
 
 +
<PRE>
 +
sudo apt-get install lzop
 +
</PRE>
 +
 
 +
=== uBoot mkimage ===
 +
 
 +
The bootloader used on the BeagleBone black is [http://www.denx.de/wiki/U-Boot U-Boot]. U-Boot has a special image format called uImage. It includes parameters such as descriptions, the machine/architecture type, compression type, load address, checksums etc. To make these images, you need to have a mkimage tool that comes part of the U-Boot distribution.
 +
 
 +
Building U-Boot requires libssl-dev to be installed:
 +
 
 +
<PRE>
 +
sudo apt-get install libssl-dev
 +
</PRE>
 +
 
 +
Download U-Boot, make and install the U-Boot tools:
 +
 
 +
<PRE>
 +
wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2
 +
tar -xjf u-boot-latest.tar.bz2
 +
cd into u-boot directory
 +
make sandbox_defconfig tools-only
 +
sudo install tools/mkimage /usr/local/bin
 +
</PRE>
 +
 
 +
== Compiling the BeagleBone Black Kernel ==
 +
 
 +
Here we compile the BeagleBone Black Kernel, and generate an uImage file with a DTB blob:
 +
 
 +
<PRE>
 +
git clone git://github.com/beagleboard/linux.git
 +
cd linux
 +
git checkout 4.1
 +
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- bb.org_defconfig
 +
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4
 +
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage dtbs LOADADDR=0x80008000 -j4
 +
</PRE>
 +
 
 +
Now we build any kernel modules:
 +
<PRE>
 +
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules -j4
 +
</PRE>
 +
 
 +
And if you have your rootfs ready, you can install them:
 +
<PRE>
 +
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/home/cpeacock/export/rootfs modules_install
 +
</PRE>
 +
 
 +
== Testing ==
 +
 
 +
=== TFTP Server ===
 +
 
 +
Rather than flashing your newly created kernel to find out it doesn't work or it is not quite configured correctly, a better way is to load the kernel into RAM and boot it from there. U-Boot allows kernel images to be loaded via TFTP.
 +
 
 +
To speed up development, I create an 'export' directory. A [[Setup_TFTP_Server|TFTP server is then configured]] to use this directory as the TFTP root.
 +
 
 +
From the export directory, add symbolic links to the kernel images. This way, you can recompile the Kernel and the new image is instantly available without having to move it.
 +
 
 +
<PRE>
 +
ln -s /path to linux/arch/arm/boot/uImage uImage-BBB
 +
ln -s /path to linux/arch/arm/boot/dts/am335x-boneblack.dtb am335x-boneblack.dtb
 +
</PRE>
 +
 
 +
=== U-Boot tftpboot ===
 +
 
 +
To test your kernel, bring up a serial console to the BeagleBone Black. First we will need to configure the IP addresses. The ipaddr variable contains the IP address for the BeagleBone Black, while the serverip variable is the address of the TFTP server containing the kernel image.
 +
 
 +
<PRE>
 +
setenv ipaddr 192.168.0.250
 +
setenv serverip 192.168.0.251
 +
</PRE>
 +
 
 +
These variables can be saved to non-volatile memory to speed up development.
 +
 
 +
Next load the Kernel image and device tree binary blob. The kernel image is prefixed with a 64 byte MKIMAGE header. To take advantage of eXecute in place (XIP), we load the image at 0x80007FC0 (0x800080000 - 64 bytes) so the kernel is loaded at 0x80008000:
 +
 
 +
<PRE>
 +
tftpboot 0x80F80000 am335x-boneblack.dtb
 +
tftpboot 0x80007FC0 uImage-BBB
 +
</PRE>
 +
 
 +
Let's use the existing root filesystem, and send kernel messages to ttyO0:
 +
 
 +
<PRE>
 +
setenv bootargs console=ttyO0,115200n8 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait
 +
</PRE>
 +
 
 +
And boot from the memory location:
 +
<PRE>
 +
bootm 0x80007FC0 - 0x80F80000
 +
</PRE>
 +
 
 +
Your BeagleBone Black should now boot your new Kernel:
 +
 
 +
<PRE>
 +
## Booting kernel from Legacy Image at 80007fc0 ...
 +
  Image Name:  Linux-4.1.3
 +
  Created:      2015-07-25  13:16:03 UTC
 +
  Image Type:  ARM Linux Kernel Image (uncompressed)
 +
  Data Size:    8068232 Bytes = 7.7 MiB
 +
  Load Address: 80008000
 +
  Entry Point:  80008000
 +
  Verifying Checksum ... OK
 +
## Flattened Device Tree blob at 80f80000
 +
  Booting using the fdt blob at 0x80f80000
 +
  XIP Kernel Image ... OK
 +
  Loading Device Tree to 8ffee000, end 8ffff0ec ... OK
 +
 
 +
Starting kernel ...
 +
 
 +
[    0.000000] Booting Linux on physical CPU 0x0
 +
[    0.000000] Initializing cgroup subsys cpuset
 +
[    0.000000] Initializing cgroup subsys cpu
 +
[    0.000000] Initializing cgroup subsys cpuacct
 +
[    0.000000] Linux version 4.1.3 (cpeacock@ubuntu) (gcc version 4.7.4 (Ubuntu/Linaro 4.7.4-2ubuntu1) ) #3 SMP PREEMPT Sat Jul 25 06:14:49 PDT 2015
 +
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
 +
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
 +
[    0.000000] Machine model: TI AM335x BeagleBone Black
 +
[    0.000000] cma: Reserved 24 MiB at 0x9e000000
 +
[    0.000000] Memory policy: Data cache writeback
 +
[    0.000000] CPU: All CPU(s) started in SVC mode.
 +
[    0.000000] AM335X ES2.0 (sgx neon )
 +
[    0.000000] PERCPU: Embedded 13 pages/cpu @df927000 s22336 r8192 d22720 u53248
 +
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 129408
 +
[    0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait
 +
</PRE>
 +
 
 +
The example shown is to use the filesystem already in place (i.e. ext4 on mmcblk0p2). The preferred option is to export a root NFS filesystem.
 +
 
 +
== Booting from NFS ==
 +
 
 +
Booting from NFS has the added advantage that you can compile userland binaries on your development box, install them to the NFS export and have instant access to them on your target system.
 +
 
 +
This requires a root filesystem to be present on your development box with binaries that have been cross compiled for ARM. Various distributions exist to assist you with this. It is assumed a [[Setup_NFS_Server_RootNFS|NFS Server]] is installed and configured properly to export this directory.
 +
 
 +
Angstrom BeagleBone demo files can be downloaded from [http://downloads.angstrom-distribution.org/demo/beaglebone/ here]
 +
 
 +
Download the raw filesystem and decompress:
 +
 
 +
<PRE>
 +
mkdir rootfs
 +
wget http://downloads.angstrom-distribution.org/demo/beaglebone/Angstrom-systemd-image-eglibc-ipk-v2012.12-beaglebone-2013.09.12.rootfs.tar.xz
 +
tar -xJf Angstrom-systemd-image-eglibc-ipk-v2012.12-beaglebone-2013.09.12.rootfs.tar.xz -C rootfs
 +
</PRE>
 +
 
 +
At this point you will need to ensure your Kernel modules are present. If not, run the following from your Kernel folder to install the modules on your rootfs:
 +
 
 +
<PRE>
 +
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/home/cpeacock/export/rootfs modules_install
 +
</PRE>
 +
 
 +
In U-Boot, you can now issue the following commands to load your Linux Kernel from TFTP and your rootfs over NFS:
 +
 
 +
<PRE>
 +
setenv ipaddr 192.168.0.250
 +
setenv serverip 192.168.0.251
 +
tftpboot 0x80F80000 am335x-boneblack.dtb
 +
tftpboot 0x80007FC0 uImage-BBB
 +
setenv bootargs console=ttyO0,115200n8 root=/dev/nfs rw nfsroot=192.168.0.251:/home/cpeacock/export/rootfs ip=192.168.0.250:::::eth0
 +
bootm 0x80007FC0 - 0x80F80000
 +
</PRE>
 +
 
 +
=== NFS boot failures ===
 +
 
 +
If your NFS root freezes during boot with a message similar to:
 +
 
 +
<PRE>
 +
nfs: server 192.168.0.251 not responding, still trying
 +
</PRE>
 +
 
 +
Then it is possible the network connection used by the NFS connection has been re-configured. On Angstrom, this connection is re-established by the Connection Manager ([https://connman.net/about ConnMan.]) To quickly overcome this problem, remove /lib/systemd/system/connman.service from your rootFS.

Latest revision as of 10:40, 6 August 2015

Compiling the BeagleBone Black Kernel

The following contains instructions for building the BeagleBone Black kernel on Ubuntu 15.04.

Prerequisites

ARM Cross Compiler

To compile the linux kernel for the BeagleBone Black, you must first have an ARM cross compiler installed. I use gcc version 4.7.4 that ships with Ubuntu 15.04. To install the compiler run:

sudo apt-get install gcc-arm-linux-gnueabi

GIT

The Beaglebone patches and build scripts are stored in a git repository. Install git:

sudo apt-get install git

And configure with your identity.

git config --global user.email "your.email@here.com"

lzop Compression

The Linux Kernel is compressed using lzo. Install the lzop parallel file compressor:

sudo apt-get install lzop

uBoot mkimage

The bootloader used on the BeagleBone black is U-Boot. U-Boot has a special image format called uImage. It includes parameters such as descriptions, the machine/architecture type, compression type, load address, checksums etc. To make these images, you need to have a mkimage tool that comes part of the U-Boot distribution.

Building U-Boot requires libssl-dev to be installed:

sudo apt-get install libssl-dev

Download U-Boot, make and install the U-Boot tools:

wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2
tar -xjf u-boot-latest.tar.bz2
cd into u-boot directory
make sandbox_defconfig tools-only
sudo install tools/mkimage /usr/local/bin

Compiling the BeagleBone Black Kernel

Here we compile the BeagleBone Black Kernel, and generate an uImage file with a DTB blob:

git clone git://github.com/beagleboard/linux.git
cd linux
git checkout 4.1
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- bb.org_defconfig 
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage dtbs LOADADDR=0x80008000 -j4

Now we build any kernel modules:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules -j4

And if you have your rootfs ready, you can install them:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/home/cpeacock/export/rootfs modules_install

Testing

TFTP Server

Rather than flashing your newly created kernel to find out it doesn't work or it is not quite configured correctly, a better way is to load the kernel into RAM and boot it from there. U-Boot allows kernel images to be loaded via TFTP.

To speed up development, I create an 'export' directory. A TFTP server is then configured to use this directory as the TFTP root.

From the export directory, add symbolic links to the kernel images. This way, you can recompile the Kernel and the new image is instantly available without having to move it.

ln -s /path to linux/arch/arm/boot/uImage uImage-BBB
ln -s /path to linux/arch/arm/boot/dts/am335x-boneblack.dtb am335x-boneblack.dtb

U-Boot tftpboot

To test your kernel, bring up a serial console to the BeagleBone Black. First we will need to configure the IP addresses. The ipaddr variable contains the IP address for the BeagleBone Black, while the serverip variable is the address of the TFTP server containing the kernel image.

setenv ipaddr 192.168.0.250
setenv serverip 192.168.0.251

These variables can be saved to non-volatile memory to speed up development.

Next load the Kernel image and device tree binary blob. The kernel image is prefixed with a 64 byte MKIMAGE header. To take advantage of eXecute in place (XIP), we load the image at 0x80007FC0 (0x800080000 - 64 bytes) so the kernel is loaded at 0x80008000:

tftpboot 0x80F80000 am335x-boneblack.dtb
tftpboot 0x80007FC0 uImage-BBB

Let's use the existing root filesystem, and send kernel messages to ttyO0:

setenv bootargs console=ttyO0,115200n8 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait

And boot from the memory location:

bootm 0x80007FC0 - 0x80F80000

Your BeagleBone Black should now boot your new Kernel:

## Booting kernel from Legacy Image at 80007fc0 ...
   Image Name:   Linux-4.1.3
   Created:      2015-07-25  13:16:03 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    8068232 Bytes = 7.7 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 80f80000
   Booting using the fdt blob at 0x80f80000
   XIP Kernel Image ... OK
   Loading Device Tree to 8ffee000, end 8ffff0ec ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.1.3 (cpeacock@ubuntu) (gcc version 4.7.4 (Ubuntu/Linaro 4.7.4-2ubuntu1) ) #3 SMP PREEMPT Sat Jul 25 06:14:49 PDT 2015
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: TI AM335x BeagleBone Black
[    0.000000] cma: Reserved 24 MiB at 0x9e000000
[    0.000000] Memory policy: Data cache writeback
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] AM335X ES2.0 (sgx neon )
[    0.000000] PERCPU: Embedded 13 pages/cpu @df927000 s22336 r8192 d22720 u53248
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 129408
[    0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait

The example shown is to use the filesystem already in place (i.e. ext4 on mmcblk0p2). The preferred option is to export a root NFS filesystem.

Booting from NFS

Booting from NFS has the added advantage that you can compile userland binaries on your development box, install them to the NFS export and have instant access to them on your target system.

This requires a root filesystem to be present on your development box with binaries that have been cross compiled for ARM. Various distributions exist to assist you with this. It is assumed a NFS Server is installed and configured properly to export this directory.

Angstrom BeagleBone demo files can be downloaded from here

Download the raw filesystem and decompress:

mkdir rootfs
wget http://downloads.angstrom-distribution.org/demo/beaglebone/Angstrom-systemd-image-eglibc-ipk-v2012.12-beaglebone-2013.09.12.rootfs.tar.xz
tar -xJf Angstrom-systemd-image-eglibc-ipk-v2012.12-beaglebone-2013.09.12.rootfs.tar.xz -C rootfs

At this point you will need to ensure your Kernel modules are present. If not, run the following from your Kernel folder to install the modules on your rootfs:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/home/cpeacock/export/rootfs modules_install

In U-Boot, you can now issue the following commands to load your Linux Kernel from TFTP and your rootfs over NFS:

setenv ipaddr 192.168.0.250
setenv serverip 192.168.0.251
tftpboot 0x80F80000 am335x-boneblack.dtb
tftpboot 0x80007FC0 uImage-BBB
setenv bootargs console=ttyO0,115200n8 root=/dev/nfs rw nfsroot=192.168.0.251:/home/cpeacock/export/rootfs ip=192.168.0.250:::::eth0
bootm 0x80007FC0 - 0x80F80000

NFS boot failures

If your NFS root freezes during boot with a message similar to:

nfs: server 192.168.0.251 not responding, still trying

Then it is possible the network connection used by the NFS connection has been re-configured. On Angstrom, this connection is re-established by the Connection Manager (ConnMan.) To quickly overcome this problem, remove /lib/systemd/system/connman.service from your rootFS.