Background
Most of the instructions I found on installing anything on the Clearfog Pro or Base with eMMC were either not applicable to me, incomplete or missing some file or there was some other barrier. After a couple weeks of tinkering and notation I feel I have a good handle on getting Armbian on this board by several different methods. Here I will describe my path to using TFTP to install Armbian on my Clearfog Pro.
First off, I have no clue why so many tutorials include a line that reads something like "but that would require you to set up a TFTP server so we're going to go through a lot of other rigamarole instead.' Really? This guide got my TFTP server up and running in a few minutes, all I had to figure out was that since I had used sudo to install the server, it owned the tftpboot directory so copying files there took root or sudo to do it, which is fine since you probably want a little security over a TFTP directory anyway.
I have an M.2 SSD drive installed on my Clearfog, but these instructions should work if you use a USB stick large enough to carry the images. If the Clearfog had a little more RAM, we could do it all on the hardware but Armbian images are too large to fit in RAM with Buildroot or U-Boot so we need an intermediate medium. In another post I'll describe doing the entire install from a prepared M.2 SSD.
I chose the TFTP path for my first load because the U-Boot that ships with the board is configured to attempt to find files via TFTP if it fails to find what it is looking for locally. At the time I had no clue what I was about to learn about the U-Boot process or all the configuration it goes through. I just knew it was looking for boot.scr via tftp so I decided to give it what it was looking for.
Further investigation revealed that the U-boot that ships with the board is 'broken' in that it doesn't allow the obvious function of booting from USB and can't interact with the USB storage. The buildroot image that can load to ram via TFTP can interact with 'SCSI' and USB storage, so again I felt TFTP was the way to go.
The instructions on this page have necessary files and info to get their version of Debian on it but it is missing a CRITICAL instruction in section 8 to boot the board. It took me days to figure that out, after mostly realizing how similar the various boot methods are. If you are interested in following those instructions see this post I made on the Solid Run forum and add that line to the end of section 8.
This forum post has very good information on the U-boot part of the process. This information helped me immensely.
If you use the 'next' kernel (as of 4.14.14) you will have to remove network manager and configure networking manually. 'Default' (4.4.112 currently) networking is fine. I am using Armbian_5.38_Clearfogpro_Debian_stretch_next_4.4.112.img in this guide.
The step by step
This guide is verbose - it assumes little. I hope to have made this so even someone fairly new to SBCs should be able to get this board up and running a basic Armbian configuration.
Download an Armbian image of your choice from Armbian's Clearfog download page, I used the 'default' image for now because I don't want to go through configuring networking manually
install your favorite TFTP server or follow the instructions on the link above and move the following files to your tftp boot directory (I had to use su to move the files) -
You will need a USB terminal program on your host PC. I use an Odroid XU4 with Armbian. 'screen' is the terminal I like, use any you want. For me, opening any terminal and typing
screen /dev/ttyUSB0 115200
gets me a display ready for the Clearfog. (connect a USB to micro USB cable to the Clearfog and your PC ...) Make sure the dip switches are configured for eMMC boot.
Power up the Clearfog and you should see U-boot load and attempt to find bootfiles. It was a scary screen of failures the first time I saw it, don't worry we're going to get that looking the way we want.
Configure the stock U-Boot to see the TFTP server
Since you probably let it go past the stop boot prompt, power down the Clearfog and power it up again ;] stop the boot process by pressing a key when instructed. You will get a Marvell>> prompt.
We need to set some IP parameters so U-boot can find the TFTP server -
setenv serverip [IP of your TFTP server]
setenv ipaddr [IP that you want the Clearfog to have]
Write the newer U-Boot to eMMC
Now we can attempt to write the eMMC u-boot image to eMMC by TFTP.
We have to bring it down from the TFTP server to ram, then write the file from ram to the eMMC -
Now we want the new u-boot to load, so we have to reboot the board from the currently running u-boot
reset
You should notice a difference with the boot behavior with the new U-boot. Again, we stop the boot process when prompted. Of course you will be tempted to let it run through its failures, the messages are very educational. To continue, stop the boot process.
Boot to Buildroot
Now we need a little more functionality than U-Boot can give us. We can do some of these in U-Boot but it is much easier and IMO better in a basic linux environment. Buildroot is good for this and Solidrun has provided a buildroot image that provides access to the USB and M.2 storage.
You will see the data load, the zImage is larger and takes just a second, the dtb file is almost instant. Once these are loaded into memory storage we need to start the image we loaded into the first address and pass it the device tree data we loaded into the second address -
bootz 0x2000000 - 0x1000000
You should now have a Buildroot prompt. Login with root, it will not ask for a password.
Kewl! You now have basic linux hardware control at this point.
Configure IP
We need to set our IP address so we can bring down the Armbian image via TFTP.
ifconfig eth0 [IP address of your Clearfog] netmask [your networks mask] up
Prepare your SSD drive
I created the filesystem on the Clearfog so there was no incompatibility superstition on my part ... obviously only do this once. You could do it on a host PC, but again I didn't want to have to mess with any kind of permission issue or controller incompatibility, etc.
Confirm your SSD device -
fdisk -l
I'm assuming your device is at /dev/sda.
If there is a partition on the SSD delete it -
fdisk /dev/sda
d (once for each partition if multiple exist)
w
Now we know we have a 'clean' drive but need to go ahead and partition it -
fdisk /dev/sda
o (create the partition table)
n (new partition)
p (primary)
1 (first partition)
257 (just start it at 257 ... I failed to note where I found this and why)
(enter to accept default, last sector)
w (write to the drive)
There is a lot of instructions online for the linux fdisk command. While this guide assumes little, it is beyond my scope to teach fdisk and mkfs. Take a look here and here. If you type exactly as above (excluding parenthesis data) it should create a partition and leave enough in the front for u-boot and the file allocation table.
Now we need to create a filesystem. I want to use ext4 64 bit so the mkfs command ends up being -
mkfs.ext4 -O ^64bit /dev/sda1
We can now mount the drive
mkdir /ssd
mount /dev/sda1 /ssd
cd /ssd
and bring down the image via TFTP
tftp -g -r Armbian_5.38_Clearfogpro_Debian_stretch_next_4.4.112.img [TFTP server IP]
Just for the thoroughness of it I brought all the files in the TFTP directory to my SSD ...
Write the image to eMMC
Now we can actually put the image in the Clearfog eMMC -
The eMMC will always be mmcblk0 and will have mmcblk0p1 after the image is written. We can't mount this partition yet, so lets reboot and get one step closer.
reboot
Prepare the Armbian U-Boot
The new image has overwritten all the U-Boot parameters, so we'll have to tell U-Boot the network information again.Stop the boot process again and at the Marvell>> prompt
Now when it boots it will fail to load the boot.scr from the mmc because we still have to put it there, so we will let the boot.scr load via tftp. U-Boot tries numerous ways to boot before it gets to trying boot.scr via TFTP. We will have to
ctrl-c
several times to stop the failing attempts until it finally finds the script on the tftp server, then it will start to boot Armbian. Alternatively we could just sit and wait a very long time for each operation to time out but I've not once had the patience to do that!
Once U-Boot finds boot.scr on the TFTP server it should load Armbian from eMMC. Armbian will force you to do the first login process where you will replace your root password and create a user.
Finalize Armbian so it loads boot.scr from eMMC
Now we can copy the boot script to the root of the mmc.
Log in as root with your new password then -
mkdir /ssd
mount /dev/sda1 /ssd
mkdir /emmc
mount /dev/mmcblk0p1 /emmc
cp /ssd/boot/boot.scr /emmc/boot.scr
reboot
This time don't interrupt the boot process, the unit should boot from mmc.
OMG you're freakin' done! Play with Armbian.
***PLEASE respond with corrections, clarifications and additions and I will update this post.
Question
Technicavolous
Background
Most of the instructions I found on installing anything on the Clearfog Pro or Base with eMMC were either not applicable to me, incomplete or missing some file or there was some other barrier. After a couple weeks of tinkering and notation I feel I have a good handle on getting Armbian on this board by several different methods. Here I will describe my path to using TFTP to install Armbian on my Clearfog Pro.
First off, I have no clue why so many tutorials include a line that reads something like "but that would require you to set up a TFTP server so we're going to go through a lot of other rigamarole instead.' Really? This guide got my TFTP server up and running in a few minutes, all I had to figure out was that since I had used sudo to install the server, it owned the tftpboot directory so copying files there took root or sudo to do it, which is fine since you probably want a little security over a TFTP directory anyway.
I have an M.2 SSD drive installed on my Clearfog, but these instructions should work if you use a USB stick large enough to carry the images. If the Clearfog had a little more RAM, we could do it all on the hardware but Armbian images are too large to fit in RAM with Buildroot or U-Boot so we need an intermediate medium. In another post I'll describe doing the entire install from a prepared M.2 SSD.
I chose the TFTP path for my first load because the U-Boot that ships with the board is configured to attempt to find files via TFTP if it fails to find what it is looking for locally. At the time I had no clue what I was about to learn about the U-Boot process or all the configuration it goes through. I just knew it was looking for boot.scr via tftp so I decided to give it what it was looking for.
Further investigation revealed that the U-boot that ships with the board is 'broken' in that it doesn't allow the obvious function of booting from USB and can't interact with the USB storage. The buildroot image that can load to ram via TFTP can interact with 'SCSI' and USB storage, so again I felt TFTP was the way to go.
The instructions on this page have necessary files and info to get their version of Debian on it but it is missing a CRITICAL instruction in section 8 to boot the board. It took me days to figure that out, after mostly realizing how similar the various boot methods are. If you are interested in following those instructions see this post I made on the Solid Run forum and add that line to the end of section 8.
This forum post has very good information on the U-boot part of the process. This information helped me immensely.
If you use the 'next' kernel (as of 4.14.14) you will have to remove network manager and configure networking manually. 'Default' (4.4.112 currently) networking is fine. I am using Armbian_5.38_Clearfogpro_Debian_stretch_next_4.4.112.img in this guide.
The step by step
This guide is verbose - it assumes little. I hope to have made this so even someone fairly new to SBCs should be able to get this board up and running a basic Armbian configuration.
Get the necessary files
Download
u-boot.mmc
from Solidruns download page for Clearfog
Download
clearfog-emmc.tar.gz
and extract
zImage
armada-388-clearfog.dtb
boot.scr
from the link in the emmc section on Solidruns installation page
Download an Armbian image of your choice from Armbian's Clearfog download page, I used the 'default' image for now because I don't want to go through configuring networking manually
Armbian_5.38_Clearfogpro_Debian_stretch_next_4.4.112.img
Prepare your TFTP server
install your favorite TFTP server or follow the instructions on the link above and move the following files to your tftp boot directory (I had to use su to move the files) -
u-boot.mmc
zImage
armada-388-clearfog.dtb
boot.scr
Armbian_5.38_Clearfogpro_Debian_stretch_next_4.4.112.img
Connect to the Clearfog terminal
You will need a USB terminal program on your host PC. I use an Odroid XU4 with Armbian. 'screen' is the terminal I like, use any you want. For me, opening any terminal and typing
screen /dev/ttyUSB0 115200
gets me a display ready for the Clearfog. (connect a USB to micro USB cable to the Clearfog and your PC ...) Make sure the dip switches are configured for eMMC boot.
Power up the Clearfog and you should see U-boot load and attempt to find bootfiles. It was a scary screen of failures the first time I saw it, don't worry we're going to get that looking the way we want.
Configure the stock U-Boot to see the TFTP server
Since you probably let it go past the stop boot prompt, power down the Clearfog and power it up again ;] stop the boot process by pressing a key when instructed. You will get a Marvell>> prompt.
We need to set some IP parameters so U-boot can find the TFTP server -
setenv serverip [IP of your TFTP server] setenv ipaddr [IP that you want the Clearfog to have]
Write the newer U-Boot to eMMC
Now we can attempt to write the eMMC u-boot image to eMMC by TFTP.
We have to bring it down from the TFTP server to ram, then write the file from ram to the eMMC -
tftpboot 0x02000000 u-boot.mmc mmc write 0x02000000 0 ${filesize}
Now we want the new u-boot to load, so we have to reboot the board from the currently running u-boot
reset
You should notice a difference with the boot behavior with the new U-boot. Again, we stop the boot process when prompted. Of course you will be tempted to let it run through its failures, the messages are very educational. To continue, stop the boot process.
Boot to Buildroot
Now we need a little more functionality than U-Boot can give us. We can do some of these in U-Boot but it is much easier and IMO better in a basic linux environment. Buildroot is good for this and Solidrun has provided a buildroot image that provides access to the USB and M.2 storage.
From the Marvell>> prompt -
tftp 0x2000000 zImage tftp 0x1000000 armada-388-clearfog.dtb
You will see the data load, the zImage is larger and takes just a second, the dtb file is almost instant. Once these are loaded into memory storage we need to start the image we loaded into the first address and pass it the device tree data we loaded into the second address -
bootz 0x2000000 - 0x1000000
You should now have a Buildroot prompt. Login with root, it will not ask for a password.
Kewl! You now have basic linux hardware control at this point.
Configure IP
We need to set our IP address so we can bring down the Armbian image via TFTP.
ifconfig eth0 [IP address of your Clearfog] netmask [your networks mask] up
Prepare your SSD drive
I created the filesystem on the Clearfog so there was no incompatibility superstition on my part ... obviously only do this once. You could do it on a host PC, but again I didn't want to have to mess with any kind of permission issue or controller incompatibility, etc.
Confirm your SSD device -
fdisk -l
I'm assuming your device is at /dev/sda.
If there is a partition on the SSD delete it -
fdisk /dev/sda d (once for each partition if multiple exist) w
Now we know we have a 'clean' drive but need to go ahead and partition it -
fdisk /dev/sda o (create the partition table) n (new partition) p (primary) 1 (first partition) 257 (just start it at 257 ... I failed to note where I found this and why) (enter to accept default, last sector) w (write to the drive)
There is a lot of instructions online for the linux fdisk command. While this guide assumes little, it is beyond my scope to teach fdisk and mkfs. Take a look here and here. If you type exactly as above (excluding parenthesis data) it should create a partition and leave enough in the front for u-boot and the file allocation table.
Now we need to create a filesystem. I want to use ext4 64 bit so the mkfs command ends up being -
mkfs.ext4 -O ^64bit /dev/sda1
We can now mount the drive
mkdir /ssd mount /dev/sda1 /ssd cd /ssd
and bring down the image via TFTP
tftp -g -r Armbian_5.38_Clearfogpro_Debian_stretch_next_4.4.112.img [TFTP server IP]
Just for the thoroughness of it I brought all the files in the TFTP directory to my SSD ...
Write the image to eMMC
Now we can actually put the image in the Clearfog eMMC -
dd if=Armbian_5.38_Clearfogpro_Debian_stretch_next_4.14.14.img bs=1M of=/dev/mmcblk0
The eMMC will always be mmcblk0 and will have mmcblk0p1 after the image is written. We can't mount this partition yet, so lets reboot and get one step closer.
reboot
Prepare the Armbian U-Boot
The new image has overwritten all the U-Boot parameters, so we'll have to tell U-Boot the network information again.Stop the boot process again and at the Marvell>> prompt
setenv serverip [your TFTP server IP] setenv ipaddr {your Clearfog IP] saveenv reset
Load boot.scr via TFTP and start Armbian
Now when it boots it will fail to load the boot.scr from the mmc because we still have to put it there, so we will let the boot.scr load via tftp. U-Boot tries numerous ways to boot before it gets to trying boot.scr via TFTP. We will have to
ctrl-c
several times to stop the failing attempts until it finally finds the script on the tftp server, then it will start to boot Armbian. Alternatively we could just sit and wait a very long time for each operation to time out but I've not once had the patience to do that!
Once U-Boot finds boot.scr on the TFTP server it should load Armbian from eMMC. Armbian will force you to do the first login process where you will replace your root password and create a user.
Finalize Armbian so it loads boot.scr from eMMC
Now we can copy the boot script to the root of the mmc.
Log in as root with your new password then -
mkdir /ssd mount /dev/sda1 /ssd mkdir /emmc mount /dev/mmcblk0p1 /emmc cp /ssd/boot/boot.scr /emmc/boot.scr reboot
This time don't interrupt the boot process, the unit should boot from mmc.
OMG you're freakin' done! Play with Armbian.
***PLEASE respond with corrections, clarifications and additions and I will update this post.
Link to comment
Share on other sites
2 answers to this question
Recommended Posts