Skip to content

Loading Linux on Macho Man

tkrupicka edited this page Jul 21, 2016 · 4 revisions

###Setup

Clone Toolchain-Release and then run ./update-repos.py and ./build-repos.py.

###Install

  1. Plug in a USB drive, and run sudo fdisk -l to locate it. If it is mounted, unmount it using sudo umount /dev/[DRIVE].

  2. Navigate to Toolchain-Release/Install and run sudo ./prep_usb.sh /dev/sd<whatever>, making sure that you're running e.g. /dev/sdc not /dev/sdc1. This will put everything on the drive.

  3. Plug the USB in to Macho Man, turn the boot header on by putting a jumper on the headers labelled "Jumper to boot from UART", and plug in the TTL cable. The black wire will be next to the white dot by the port.

  4. Navigate to Toolchain-Release/Toolchain/morepork-u-boot/util and run sudo ./uartflash.py -p /dev/TTLPORT. The TTL port will be something like /dev/ttyUSB0. This utility will send the bootloader to the board and boot from USB.

  5. The uartflash program will launch xmodem as an interface, close it using Ctrl-\ q. A better solution is to use GNU screen by running sudo screen /dev/ttyUSB0 115200, where ttyUSB0 is the TTL port and 115200 is the baud rate.

  6. You can now talk to the board's linux environment.

###Making Changes

When you want to change things, there's two things to know:

  • When you're compiling a repository in Toolchain-Release, always do it by going to the repository you want to build and doing ../../build-repos.py --this-dir. This makes sure that dependencies get met and things are installed into the right place.

  • Unless you run build-repos with the repository bundle-morepork, if you then do another prep_usb.sh your changes won't make it onto the file system. So either copy individual files to the USB (they live in Toolchain-Release/Install/rootfs/ or run the full build-repos.py before making a new file system.

###The Kernel

The way the kernel build works, is that it has three artifacts:

  1. The compiled device tree binary. This will have the same name as the device tree but the suffix .dtb and live in Toolchain-Release/Install/rootfs/boot/.

  2. The zipped kernel binary. This will be called zImage and live in Toolchain-Release/Install/rootf/boot/.

  3. The modulized kernel drivers. These live in Toolchain-Release/Install/rootfs/lib/modules/ and you need the whole directory

The kernel, when it boots, will refuse to load modules that don't have the same build hash as it. The board will still boot, but if you had any drivers you were relying on, they won't run.

Also, since drivers get put in subdirectories according to their build hash in that directory, it can build up a lot of old drivers that should be deleted every now and again.

Clone this wiki locally