Adding USB boot support on the Utilite nettop

More than a year or so, I have been the proud owner of a first generation Utilite ARM appliance. But the harsh Cyprus summer, hit it hard and the microSD circuit stop working. I could no longer boot alternative systems on microSD cards. All I was left with, was the stock system with an aging Ubuntu 12.04 ARM port.

Enter the U-Boot

Das U-Boot is a boot loader that targets mostly embedded systems. Many ARM appliances, including the Utilite, are using U-Boot to boot their OS.

I entered the U-Boot environment to do some checks about the mmc issue. To do that just press the ‘any‘ key when you see the following message:

Hit any key to stop autoboot:

Then type the following command in your U-boot terminal:

CM-FX6 # mmc info
Card did not respond to voltage select!

That message does not look very healthy! When I tried to insert a microSD card, I got this message repeatedly, in the U-Boot terminal:

EHCI timed out on TD - token=0x80008c80

The keyboard stopped responding and I had no other option than to force restart. I think now we have enough evidence to say that the microSD circuitry went FUBAR. At this point you should probably contact CompuLab for a replacement.

But this is not what I did. The appliance has 3 USB ports available, so why not use them? This will have the added benefit of USB devices being more accessible, than the hard to access microSD slot.

Well, the original U-Boot image that the Utilite was shipped with, did not had USB boot support. This has long changed and the nice folks at CompuLab have built a newer version that supports booting from USB storage devices.

Upgrading U-Boot

First download the most recent U-Boot updater on your Utilite appliance:

$ wget http://utilite-computer.com/download/utilite/u-boot/utilite-updater.tar.bz2

Check the MD5 sum:

$ echo a79e492f3eb626c770c5185cda0edfec ; md5sum utilite-updater.tar.bz2 
a79e492f3eb626c770c5185cda0edfec
a79e492f3eb626c770c5185cda0edfec  utilite-updater.tar.bz2

Extract the archive:

$ tar xvjf utilite-updater.tar.bz2

Run the updater:

$ sudo ./utilite-bootloader-update.sh 

CompuLab CM-FX6 (Utilite) boot loader update utility 2.2 (Feb 8 2015)

>> Checking for utilities... 
>> ...Done 
>> Checking that board is CM-FX6 (Utilite)... 
>> ...Done 
Please input firmware file path (or press ENTER to use "cm-fx6-firmware"): 

Just press ‘Enter’ after the above prompt. Then answer ‘Yes’ (y) to the following questions:

>> Looking for boot loader image file: cm-fx6-firmware 
>> ...Found 
>> Looking for SPI flash: mtd0 
>> ...Found 
>> Current U-Boot version in SPI flash: U-Boot 2014.10-cm-fx6-2.1 (Jan 19 2015 - 11:28:10) 
>> New U-Boot version in file:      U-Boot 2014.10-cm-fx6-2.1 (Jan 19 2015 - 11:28:10) (500K) 
>> Proceed with the update? 
1) Yes
2) No
#? <strong>y</strong>  
** Do not power off or reset your computer!!! 
>> Erasing SPI flash... 
Erasing 4 Kibyte @ bf000 -- 100 % complete 
>> ...Done 
>> Writing boot loader to the SPI flash... 
.........................
>> ...Done 
>> Checking boot loader in the SPI flash... 
.
>> ...Done 
>> Boot loader update succeeded!

** Resetting U-Boot environment will override any changes made to the environment! 
>> Reset U-Boot environment (recommended)? 
1) Yes
2) No
#? y
>> U-boot environment will be reset on restart. 
>> Done!

Then reboot the appliance:

$ sudo reboot

It is a good idea to keep a backup of the original U-Boot configuration for future reference:

$ sudo fw_printenv > utilite.uboot.orig

Enhancing the USB boot setup

If you study the above U-Boot setup you will find that the USB config works only if you have an option boot.scr script under the first partition of your USB. This excludes USB drives with only the uImage file. That means that you cannot even boot the Utilite SSD installer if you burn it on USB, since it does not have a boot.scr script.

I’ve been playing around with the U-Boot environment and I came out to this configuration:

setenv bootcmd run setupmmcboot;mmc dev ${storagedev};if mmc rescan; then run trybootsrz;fi;run setupusbboot;if usb start; then if run loadscript; then run bootscript;else run usbbootargs;if run loadkernel; then run doboot;else setenv bootargs;fi;fi;fi; run setupsataboot;if sata init; then run trybootsmz;fi;run setupnandboot;run nandboot;
setenv usbroot /dev/sdb2
setenv usbrootdelay=1
setenv usbbootargs=setenv bootargs root=${usbroot} rootdelay=${usbrootdelay}

If you don’t want to configure the above commands manually, you can download my custom U-boot environment updater and the patch I prepared:

Download the U-Boot environment update shell script:

$ wget https://raw.githubusercontent.com/theodotos/arena/master/u-boot/u-boot-update-env.sh
$ chmox +x u-boot-update-env.sh

Download the U-boot custom configuration:

$ wget https://raw.githubusercontent.com/theodotos/arena/master/u-boot/setup-usb-boot-utilite.uboot

Now load the custom configuration into the U-Boot environment:

$ sudo ./u-boot-update-env.sh setup-usb-boot-utilite.uboot

If something goes wrong you can restore your original configuration using the original configuration we saved earlier:

$ sudo ./u-boot-update-env.sh utilite.uboot.orig

The U-Boot environment updater will also create a backup file, with the current U-Boot environment configuration, just before the update:

$ ls *.bak
u-boot_env-3366.bak

Test with the Utilite SSD installer

Now it is time to test our new configuration.

First download the SSD installer:

$ wget http://utilite-computer.com/download/utilite/installer/cl-installer_utilite-2_kernel-6.3_2014-12-17.img.xz

Check the MD5 sum:

$ echo 82eeb54c4d5245c60fd82c3e983d10e9 ; md5sum cl-installer_utilite-2_kernel-6.3_2014-12-17.img.xz
82eeb54c4d5245c60fd82c3e983d10e9
82eeb54c4d5245c60fd82c3e983d10e9  cl-installer_utilite-2_kernel-6.3_2014-12-17.img.xz

Extract it:

$ unxz cl-installer_utilite-2_kernel-6.3_2014-12-17.img.xz

This will extract a cl-installer_utilite-2_kernel-6.3_2014-12-17.img image file in the working directory.

Now comes the tricky part. We will load the image in a USB device. Make sure you choose the correct device! The dd tool we are using below, is a heartless beast that will chew the data out of every device you select in its of= flag. If by mistake you give your internal disk instead of the USB, you will lose your partitions and data! You have been warned!

So after you select a USB (one that does not have any data you need) insert it in your Linux workstation. Then try the following check to find out the device name of the USB drive:

$ dmesg | tail -n20
[61425.197050] mce: [Hardware Error]: Machine check events logged
[71124.693498] compiz[1853]: segfault at 80000000 ip 0000000080000000 sp 00007ffc438c50a8 error 14
[73897.971544] usb 1-2: new high-speed USB device number 10 using xhci_hcd
[73898.105247] usb 1-2: New USB device found, idVendor=0951, idProduct=1665
[73898.105254] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[73898.105257] usb 1-2: Product: DataTraveler 2.0
[73898.105260] usb 1-2: Manufacturer: Kingston
[73898.105262] usb 1-2: SerialNumber: 50E54951351BBE70A9455C5B
[73898.106083] usb-storage 1-2:1.0: USB Mass Storage device detected
[73898.106370] scsi host8: usb-storage 1-2:1.0
[73899.187591] scsi 8:0:0:0: Direct-Access     Kingston DataTraveler 2.0 PMAP PQ: 0 ANSI: 6
[73899.187848] sd 8:0:0:0: Attached scsi generic sg2 type 0
[73900.521857] sd 8:0:0:0: [sdb] 15335424 512-byte logical blocks: (7.85 GB/7.31 GiB)
[73900.522528] sd 8:0:0:0: [sdb] Write Protect is off
[73900.522531] sd 8:0:0:0: [sdb] Mode Sense: 23 00 00 00
[73900.523124] sd 8:0:0:0: [sdb] No Caching mode page found
[73900.523126] sd 8:0:0:0: [sdb] Assuming drive cache: write through
[73900.562834]  sdb: sdb1 sdb2
[73900.565248] sd 8:0:0:0: [sdb] Attached SCSI removable disk
[73903.203134] EXT4-fs (sdb2): mounted filesystem with ordered data mode. Opts: (null)

So the device name is sdb and it has two partitions: sda1 and sda2. Check if these partitions have been mounted automatically:

$ mount | grep sdb
/dev/sdb2 on /media/theodotos/rootfs type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)
/dev/sdb1 on /media/theodotos/boot type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

They are mounted. We need to unmount them before dumping the image on the device:

$ sudo umount /dev/sdb1 /dev/sdb2

Now we are ready to run dd (device dump) against the USB drive:

$ sudo dd if=~/Downloads/cl-installer_utilite-2_kernel-6.3_2014-12-17.img of=/dev/sdb bs=1M

You are not going to see any progress bar during the device dump. Just be patient and let the utility take its time.

After dd finishes and returns back to the shell, safely remove the USB drive and try it on Utilite. If you reboot the appliance you should see the LXDE desktop of the Utilite installer. Unplug it and you are back to your Ubuntu, on the internal drive.

References

  • http://www.compulab.co.il/utilite-computer/web/utilite-overview
  • http://www.compulab.co.il/utilite-computer/wiki/index.php/Utilite_U-Boot

Leave a Reply

Your email address will not be published. Required fields are marked *