September 26, 2016

Making a custom flasher image

The best approach here is to take an existing flasher image and modify it. Keep the linux environment intact and modify the script that replaces init.

The first thing to consider is editing uEnv.txt to change the name of the script run in place of the init program. This is the file /boot/uEnv.txt. Change the last line to be something like:


Installing a different U-boot

You don't have to do this from a flasher script (but you could, which is the point of writing this section). You could just scp the new U-boot components to the running system and then put them in place using the dd command as shown below.

Installing a different U-boot would first of all be a matter of replacing the files in /opt/backup/uboot, namely these:

-rw-r--r-- 1 tom tom  65620 Sep 27 17:27 MLO
-rw-r--r-- 1 tom tom 317044 Sep 27 17:27 u-boot.img
You could just replace these files and reflash the entire eMMC. This only takes a couple of minutes. You might want to take a gentler approach, in which case you could consider modifying the flasher script to do only the following:
dd if=/opt/backup/uboot/MLO of=/dev/mmcblk1 count=1 seek=1 conv=notrunc bs=128k
dd if=/opt/backup/uboot/u-boot.img of=/dev/mmcblk1 count=2 seek=1 conv=notrunc bs=384k
While you were at it, you might want to install a different uEnv.txt. You could for example set up a flasher script that installs a uEnv.txt that always does network booting (such as if you were setting up myriads of boards for some kind of student lab). This file ends up in /boot/uEnv.txt.

Installing a new static binary image

I sometimes set up a system to boot an embedded system right off of eMMC rather than network booting. So I modify /uEnv.txt and place kyu.bin right in / alongside of it. This is fine, but the question then becomes, how can updates be performed? What if the system is not connected to the network?

What is wanted here is a modified flasher card that can just be inserted,, booted, and allowed to run to completion. This card could do nothing more than boot up linux to run a runt flasher script, copy a new kyu.bin to /boot and shutdown. This would work on top of a mountain, up on a microwave tower -- or whereever.

Feedback? Questions? Drop me a line!

Tom's Computer Info /