Jump to content

Clearfog Base with eMMC first boot tutorial


Genesio Lini

Recommended Posts

Hello everyone,

I am trying to achieve first boot with a Clearfog Base with eMMC.

 

It was not clear (at least to me) that the eMMC version does not allow booting from SD card *at all*

But hey, let's get this baby up&running, can anybody please help me?

 

I am trying to follow this procedure [https://www.armbian.com/clearfog-base/]:

1) Write the image to a USB flash drive

-> easy enough, I did it with Win32DiskImager and a well-tested 64GB USB stick

 

2) Load the modified u-boot (from the Armbian image) using the UART method

-> I have issues here. I suppose that UART method consists in plugging in the microUSB cable into my PC and open the COM3 port with Putty, than hitting some key to interrupt normal boot.

Unfortunately the terminal just spits out garbled text. The setup for the COM3 port in windows is 9600bps, 8data, no parity, 1 stop, no flow control and matches the config in Putty.

 

Where do I find the modified u-boot in armbian image?

 

I'm stuck here, and I don't know how to proceed.

 

Thank you

Genesio

Link to comment
Share on other sites

14 minutes ago, Genesio Lini said:

-> easy enough, I did it with Win32DiskImager and a well-tested 64GB USB stick

https://docs.armbian.com/User-Guide_Getting-Started/

Quote

7z and zip archives can be uncompressed with 7-Zip on Windows, Keka on OS X and 7z on Linux. Images shall only be written with Etcher on all platforms since unlike other tools Etcher validates burning results saving you from corrupted SD card contents.

 

 

 

16 minutes ago, Genesio Lini said:

Unfortunately the terminal just spits out garbled text. The setup for the COM3 port in windows is 9600bps, 8data, no parity, 1 stop, no flow control and matches the config in Putty.

Isn't it 115200? (not sure.... )

Link to comment
Share on other sites

29 minutes ago, Genesio Lini said:

Where do I find the modified u-boot in armbian image?

It may be easier to unpack the .deb package from here than mounting the existing image and extracting files from its filesystem.

 

30 minutes ago, Genesio Lini said:

-> I have issues here. I suppose that UART method consists in plugging in the microUSB cable into my PC and open the COM3 port with Putty, than hitting some key to interrupt normal boot.

Not with PuTTY and I'm not sure if there is a good way to do it from Windows in general.

I would recommend reading this tutorial and official Solid-Run instructions here.

You can get the u-boot binary from Armbian packages and this binary can easily boot an image from USB flash with "run usbboot" but you still need to find a way to load the u-boot via UART (either using kwboot or scripts linked in the first tutorial).

 

14 minutes ago, chwe said:

Isn't it 115200?

It is.

Link to comment
Share on other sites

Regarding Putty: 115000bps, 8data, 1stop, no parity, xon/xoff works

 

I am now flashing the USB drive with Etcher and will let you know the results...

Still I have no clue on what to do with the deb package containing the u-boot files.

 

Thank you very much for the help

Link to comment
Share on other sites

I had issues with VM and serial ports, so I fired up an Ubuntu physical machine and I was able to start the procedure.

Unfortunately it seems I got stuck again. The serial downloader shell script does not complete the first step (endless loop)

 

Quote

sudo ./download-serial.sh /dev/ttyUSB0 '/home/ubuu-boot-uart.mmc'


Sleeping
Out of sleep
Got something 0

Sleeping
Out of sleep
Got something -1

Sleeping
Out of sleep
Got something -1


Sleeping
Out of sleep
Got something -1



Sleeping
Out of sleep
Got something -1

Dip switches are set to ON from number 1 to number 4 (https://pasteboard.co/GXok3Gb.jpg)

 

 

Link to comment
Share on other sites

51 minutes ago, Genesio Lini said:

Dip switches are set to ON from number 1 to number 4 (https://pasteboard.co/GXok3Gb.jpg)

Please try setting switches to OFF,ON,OFF,OFF,ON instead.

 

I just tried to use kwboot from mainline u-boot and it worked fine for me

git clone --depth 1 git://git.denx.de/u-boot.git
cd u-boot
make CROSS_COMPILE=arm-linux-gnueabihf- clearfog_defconfig
make CROSS_COMPILE=arm-linux-gnueabihf- tools
tools/kwboot -b ~/u-boot-uart.mmc /dev/ttyUSB0
screen /dev/ttyUSB0 115200

 

 

➜  u-boot git:(c253573) % _ tools/kwboot -b ~/u-boot-uart.mmc /dev/ttyUSB0
Sending boot message. Please reboot the target...-
Sending boot image...
  0 % [......................................................................]
  0 % [......................................................................]
  1 % [......................................................................]
  2 % [......................................................................]
  3 % [......................................................................]
  4 % [......................................................................]
  5 % [......................................................................]
  6 % [......................................................................]
  7 % [......................................................................]
  8 % [......................................................................]
  9 % [......................................................................]
 10 % [......................................................................]
 11 % [......................................................................]
 12 % [......................................................................]
 13 % [......................................................................]
 14 % [......................................................................]
 15 % [......................................................................]
 16 % [......................................................................]
 17 % [......................................................................]
 18 % [......................................................................]
 19 % [......................................................................]
 20 % [......................................................................]
 21 % [......................................................................]
 21 % [......................................................................]
 22 % [......................................................................]
 23 % [......................................................................]
 24 % [......................................................................]
 25 % [......................................................................]
 26 % [......................................................................]
 27 % [......................................................................]
 28 % [......................................................................]
 29 % [......................................................................]
 30 % [......................................................................]
 31 % [......................................................................]
 32 % [......................................................................]
 33 % [......................................................................]
 34 % [......................................................................]
 35 % [......................................................................]
 36 % [......................................................................]
 37 % [......................................................................]
 38 % [......................................................................]
 39 % [......................................................................]
 40 % [......................................................................]
 41 % [......................................................................]
 42 % [......................................................................]
 42 % [......................................................................]
 43 % [......................................................................]
 44 % [......................................................................]
 45 % [......................................................................]
 46 % [......................................................................]
 47 % [......................................................................]
 48 % [......................................................................]
 49 % [......................................................................]
 50 % [......................................................................]
 51 % [......................................................................]
 52 % [......................................................................]
 53 % [......................................................................]
 54 % [......................................................................]
 55 % [......................................................................]
 56 % [......................................................................]
 57 % [......................................................................]
 58 % [......................................................................]
 59 % [......................................................................]
 60 % [......................................................................]
 61 % [......................................................................]
 62 % [......................................................................]
 63 % [......................................................................]
 63 % [......................................................................]
 64 % [......................................................................]
 65 % [......................................................................]
 66 % [......................................................................]
 67 % [......................................................................]
 68 % [......................................................................]
 69 % [......................................................................]
 70 % [......................................................................]
 71 % [......................................................................]
 72 % [......................................................................]
 73 % [......................................................................]
 74 % [......................................................................]
 75 % [......................................................................]
 76 % [......................................................................]
 77 % [......................................................................]
 78 % [......................................................................]
 79 % [......................................................................]

 81 % [......................................................................]
 82 % [......................................................................]
 83 % [......................................................................]
 84 % [......................................................................]
 84 % [......................................................................]
 85 % [......................................................................]
 86 % [......................................................................]
 87 % [......................................................................]
 88 % [......................................................................]
 89 % [......................................................................]
 90 % [......................................................................]
 91 % [......................................................................]
 92 % [......................................................................]
 93 % [......................................................................]
 94 % [......................................................................]
 95 % [......................................................................]
 96 % [......................................................................]
 97 % [......................................................................]
 98 % [......................................................................]
 99 % [......................................................]
➜  u-boot git:(c253573) % _ screen /dev/ttyUSB0 115200
[screen is terminating]
➜  u-boot git:(c253573) %

Link to comment
Share on other sites

With your help and kwboot I got the u-boot-uart.mmc file flashed to the clearfog base.

I also noticed that, after the flash, the system automatically booted my USB flash drive with armbian image flashed with Etcher.

 

Is there an "easy way" to install the running system into eMMC at this point?

Or should I copy the .iso file on a separate USB stick and dd it into the eMMC?

 

BTW how can this procedure be so hard to perform?

Am I alone with these issues?

 

Link to comment
Share on other sites

13 minutes ago, Genesio Lini said:

Or should I copy the .iso file on a separate USB stick and dd it into the eMMC?

You can copy it to the same USB stick (as a file) and dd it to the eMMC. Please note that you need to add/set "emmc_fix=on" in /boot/armbianEnv.txt both on your USB stick and on eMMC after you flash the image on it, or you can just insert any SD card into the SD slot.

 

13 minutes ago, Genesio Lini said:

BTW how can this procedure be so hard to perform?

Am I alone with these issues?

There is no USB OTG port here so UMS (mass storage gadget) or fastboot is not an option here. The only "better" solution could be tftp based to download the image to RAM or USB storage and flash it to eMMC, but it requires setting up a tftp server, or writing the image from USB to eMMC from u-boot.

Link to comment
Share on other sites

I just copied to iso file to the USB stick and rebooted the clearfog.

If I repeat the kwboot procedure again, Armbian does not boot like the first time.

Instead, I get this:

immagine.png.e43f50058f43c272bc96459b5cb66ede.png

 

I tried to flash the ISO back to the USB stick again with Etcher but the error persist.

I am almost ready to give up and sell the clearfog on ebay

Link to comment
Share on other sites

I have a uSD card into the slot.

And first boot from USB stick was working, I don't know why I am not able to boot from the USB stick anymore.

I did not do anything apart from rebooting.

 

I am now trying again.

kwboot is succesfull and I am able to run the modified u-boot loaded thru UART.

As I have no system in eMMC and no USB stick into the USB port, I feel good with this result (I am using picocom)

immagine.png.8200071ab8bf4995349e179165a21f1e.png

 

Following the procedure I should insert my USB stick and execute "run usbboot", right?

 

This is the result:

immagine.png.aa25afa67d3a6bfd7d8e50ab2f00ffdf.png

 

I am now logged in as root (1234) into the running Armbian system from USB stick.

I am also able to log in thru SSH, and I uploaded both armbian ISO file and u-boot-mmc file to /tmp

 

Could you please help me with instructions on how to permanently install the bootloader and armbian to the eMMC?

 

Thank you for your great support

 

 

 

Link to comment
Share on other sites

I am now trying following steps from here: https://github.com/nightseas/arm_applications/blob/master/doc/getting_started_with_clearfog_base.md#boot-from-usb-disk----download-armbian-to-emmc

from inside armbian running from the USB stick:

 

dd'ing the img to the eMMC device was successful:

root@clearfogbase:~# dd if=/root/Armbian_5.35_Clearfogbase_Ubuntu_xenial_default_4.4.102.img of=/dev/mmcblk0 bs=4M
352+0 records in
352+0 records out
1476395008 bytes (1.5 GB, 1.4 GiB) copied, 79.9802 s, 18.5 MB/s
root@clearfogbase:~# sudo mount /dev/mmcblk0p1 /mnt
mount: special device /dev/mmcblk0p1 does not exist

I was not able to mount the partition in order to modify the armbianEnv.txt.

But, as I have a uSD card into the slot, I am trying to boot from eMMC anyway.

 

So I just went on with dd'ing the bootloader to the eMMC:

root@clearfogbase:~# echo 0 > /sys/block/mmcblk0boot0/force_ro
root@clearfogbase:~# echo 0 > /sys/block/mmcblk0boot1/force_ro
root@clearfogbase:~# sudo dd if=u-boot.mmc of=/dev/mmcblk0boot0
1836+1 records in
1836+1 records out
940108 bytes (940 kB, 918 KiB) copied, 0.167683 s, 5.6 MB/s
root@clearfogbase:~# sudo dd if=u-boot.mmc of=/dev/mmcblk0boot1
1836+1 records in
1836+1 records out
940108 bytes (940 kB, 918 KiB) copied, 0.17947 s, 5.2 MB/s
root@clearfogbase:~# echo 1 > /sys/block/mmcblk0boot0/force_ro
root@clearfogbase:~# echo 1 > /sys/block/mmcblk0boot1/force_ro
root@clearfogbase:~# sync

 

Now I think I could just set the dip switches into eMMC boot position and reboot.

Is that correct?

Link to comment
Share on other sites

Ok, it works.

after setting the DIP switches to eMMC boot, I rebooted with the uSD card into the slot and armbian was running fine from eMMC.

 

Then I logged in and modified the armbianEnv.txt

 

The clearfog now boots from eMMC without uSD card into the slot.

 

Thank you for your help and patience

 

Link to comment
Share on other sites

I summarized the content of a few sites and wrote a complete installation guide for Armbian on a Clearfog pro and Clearfog base.

You will need

  • a FAT formatted USB Stick where you can store the Armbian image and some bootloader files
  • an USB A to microUSB B cable
  • Clearfog Base or Pro with a power adapter

Prepare installation files

mkdir -p /opt/clearfog_installation
cd /opt/clearfog_installation
curl https://wiki.solid-run.com/lib/exe/fetch.php?media=products:a38x:software:debian:clearfog-emmc-v3.tar.gz --output clearfog-emmc-v3.tar.gz
tar xfz clearfog-emmc-v3.tar.gz

 

Copy following files to an USB stick

 

mnt <your usb> /mnt/
mv u-boot-clearfog-base-mmc.kwb zImage armada-388-clearfog.dtb /mnt/

Put Armbian to the stick

You have to create the _extlinux_ directory and put the _extlinux.conf_ into it. You'll need this do boot a linux image. With it you will be able to write the Armbian image to the eMMC memory

mkdir -p /mnt/extlinux
mv extlinux.conf /mnt/extlinux/
cd /mnt/extlinux/

 

Clearfog Pro
   

wget https://dl.armbian.com/clearfogpro/Debian_stretch_next.7z

Clearfog Base
   

wget https://dl.armbian.com/clearfogbase/Debian_stretch_next.7z


Extract and check integrity

7za e Debian_stretch_next.7z
shasum -a 256 -c sha256sum.sha Armbian_*.img
STRG+c
cd /opt/clearfog_installation
umount /mnt

 

 

Next Steps

  • Plug in USB stick to the Clearfog
  • Plug in USB cable (USB A site) to the PC
  • Plug in USB cable (microUSB B site) to the Clearfog
  • Set Jumper to UART **0 1 0 0 1**

 

PC
The maintainer delivers *kwboot* for the installation. With it you can send the u-boot bootloader to the device

   

./kwboot -t -b u-boot-clearfog-base-uart.kwb /dev/ttyUSB0

 

Clearfog
- Power up the Clearfog
- Wait a few minutes of the U-Boot image to download
- !! Hit a key to stop autoboot !!
- Configure the eMMC to boot from hardware boot partition

 

PC (kwboot terminal)

mmc partconf 0 1 1 0
date reset
run bootcmd_usb0

login with _root_

 

mount /dev/sda1 /mnt
dd if=/mnt/extlinux/Armbian_5.59_Clearfogpro_Debian_stretch_next_4.14.66.img of=/dev/mmcblk0 bs=1M conv=fsync
hdparm -z /dev/mmcblk0
umount /mnt/
mount /dev/mmcblk0p1 /mnt/
echo 0 > /sys/block/mmcblk0boot0/force_ro
dd if=/mnt/usr/lib/linux-u-boot-next-clearfogpro_5.59_armhf/u-boot.mmc of=/dev/mmcblk0boot0
sed -i 's/emmc_fix=off/emmc_fix=on/g' /mnt/boot/armbianEnv.txt
umount /mnt/
poweroff

 

PC (a second terminal)

killall kwboot
screen /dev/ttyUSB0 115200

 

Clearfog

  • Unplug power adapter
  • Set jumpers to **0 0 1 1 1**
  • Plugin power jack

Now you should see Armbian booting up in the terminal were you executed the _screen_ command


Sources
First insights (armbian.com)
Maintainers installation guide (wiki.solid-run.com)
First hint for armbian bootloader installation (armbian.com)
Final Armbian bootloader installation hint

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines