jarrocha / XinuBBB

Source and guide to run Xinu on the BeagleBone Black
Other
43 stars 10 forks source link

Hardware Setup


If you rather work with VMs, check the guide folder. If you get any issues let me know. The first section does a step-by-step setup of UBoot with BBB, the second section automates the development environment by setting up a TFTP server to quickly load images through a network link instead of using an SD card.

  1. Setup for BeagleBone Black
  2. Setup a TFTP server for faster image loading

Warning: the source code provided here is untouched from the original Xinu website. As it is, it crashes at startup on the BBB while trying to test for a network link. After performing the steps on this first section you will have the tools necessary to mitigate or fix this crash. If you do connect the board to a network link, you won't have this error.

Fix: The issue is on the file device/eth/ethinit.c starting on function eth_phy_reset().


1. Setup for BeagleBone Black

You can use the mainline u-boot for beaglebone.

Cross-Compiler/ToolChain

Bootoader

Update: Thanks to user Kikou1998. Newer versions of uboot work with the address given after the kernel build which is 0x81000000. Check the picture below.

Pic8

Kernel

Connection

sudo minicom -D /dev/ttyUSB0 -c on -b 115200

2. Setup a TFTP server for faster image loading

I recommend doing the previous work just to make sure that your development environment is ready. After that is done we can start of the next part which will allow for easier image loading without having to swap the SD card to every change done to the OS.

You will need:

The ethernet port is needed to communicate the BBB to the TFTP server in your development computer. The cross-over cable is required to speak directly to the BBB because they are both end devices and they need to transmitt data between each other. The alternative is to have a network switch or a router to handle their communication.

Setup TFTP Server

First install the TFTP server in the development computer. The command below works for both Ubuntu and Debian, it can also work on other derivatives.

sudo apt-get install tftpd-hpa

Run the following command to make sure the TFTP server is up. When you run this command, you will see the default tftp directory: /srv/tftp. Make sure to place the Xinu image there. Just copy the xinu.boot file in there or whichever name you are using.

sudo systemctl status tftpd-hpa

You could also use netstat and check for a service on port 69.

netstat -vaun

# if you don't have netstat
sudo apt install net-tools

Make sure to check /etc/defaults/tftpd-hpa, this is the configuration file for tftpfd-hpa.

Configure the Server IP

We need to configure an IP address to the interface which is going to communicate with the BBB. There are several options and will depend on how you are connecting them, but I recommend to put a static IP address to this interface. There are several methods to do this but on this guid we are just going to assign a temporary IP to the interface.

First identify the interface name

ip addr

Pic5

In my case, I'll be using enx000ec66a8383. This is a USB Ethernet interface so systemd assigns this name. You can see that this interface has an IP already assigned.

For my setup, I'll assign IP 10.10.10.1/24 for the TFTP server and 10.10.10.10/24 for UBoot. To assign this temporary addresss run:

# assigns IP address
sudo ip addr add 10.10.10.1/24 brd + dev enx000ec66a8383

# If you make a mistake, you can remove the address with the command below
# just put switch the "add" argument with "del"
sudo ip addr del 10.10.10.1/24 brd + dev enx000ec66a8383

Configure UBoot

My settings for UBoot could be different from yours. But I'll recommend first loading UBoot by itself and then try out what settings works best. Below are the sufficient commands to get UBoot to load an image from a TFTP server.

U-Boot# setenv ipaddr 10.10.10.10
U-Boot# setenv netmask 255.255.255.0

Test if you can ping the TFTP server with

U-Boot# ping 10.10.10

Pic6

If you get problems at this point just know that this is network related, it should be an easy fix.

Before connecting to the TFTP server we need to setup the server ip variable. After that just request the image with the tftp command.

U-Boot# setenv serverip 10.10.10.1
U-Boot# tftp xinu.boot

Pic7

After that just boot up from local memory. You should see Xinu booting up.

U-Boot# bootm

Here's the final uEnv.txt

ipaddr=10.10.10.10
serverip=10.10.10.1
netmask=255.255.255.0
bootfile=xinu.boot
boot_mmc=tftp ${bootfile}; bootm 
uenvcmd=run boot_mmc

Create this file and place it in the SD card, as directed on the first section of the guide. Now, everytime you make a change to the OS, just compile and copy this final image result to the TFTP directory location and to a reset on the BBB and that's it.