This SD image is a debian jessie console image with:
- a 4.1.22-ltsi-rt kernel with RT-PREEMPT patches applied
- tested on Terasic DE0-Nano-SoC Kit, other SoCKit platforms should work with appropriate dtb
- machinekit RIP-build under /home/machinekit/machinekit, all build artefacts are in place (no need to run make)
- machinekit packages are NOT installed and you do not have to!
- all machinekit build- and runtime required packages ARE installed.
- /home/machinekit/.bashrc already set up to run machinekit from the RIP build directory.
- one known-to-work configuration with hostmot2/onboard FPGA support is:
machinekit/configs/hm2-soc-stepper/5i25-socfpga.ini
- this assumes Charles'd DB25 adapter board and Mesanet 7i76 or 7i85S cards connected
- both the DE0_Nano_SoC_DB25.7I76_7I76_7I76_7I76 and DE0_Nano_SoC_DB25.7I76_7I85S_GPIO_GPIO firmwares are verified to work
- there is a HAL test configuration in
machinekit/configs/hm2-soc-stepper/irqtest.hal
- apt sources ready for ROS integration via debian-robotics
- this is intended for advanced users and developers - which is why it contains a RIP install and no packages.
- the purpose is to shake out configurations and remove any remaining bugs.
- this is not for beginners and folks looking for a turn-key image for say 3D printers.
Instead of starting over with a new image, you can upgrade to the current status by:
apt update
apt install device-tree-compiler
apt upgrade
Then proceed to machinekit/src , git pull and rebuild the supplied RIP build.
Install bmaptools
apt install bmap-tools
- Download both files from the most recent directory in http://deb.mah.priv.at/uploads/de0-nano
- write the image to the card:
# make sure the card is not accidentially mounted - Ubuntu likes to do that
# so:
umount /dev/sdb # just to be sure
bmaptool copy <name.img.xz> /dev/<sd card device, usually sdb>
````
- verify [the switches on the board are set: 1,3,5,6 towards 'ON'](https://cloud.githubusercontent.com/assets/901479/14768899/faf9025c-0a4c-11e6-9a2d-bc8a2dfa4bd1.png)
- insert SD card, connect serial console at 115200, apply power
- when u-boot starts, hit enter immediately to interrupt automatic boot - display:
````
Restarting system.
U-Boot SPL 2016.05-rc3-01014-g57258ab (Apr 27 2016 - 13:20:08)
drivers/ddr/altera/sequencer.c: Preparing to start memory calibration
drivers/ddr/altera/sequencer.c: CALIBRATION PASSED
drivers/ddr/altera/sequencer.c: Calibration complete
Trying to boot from MMC1
U-Boot 2016.05-rc3-01014-g57258ab (Apr 27 2016 - 13:20:08 +0200), Build: jenkins-u-boot-socfpga-23
CPU: Altera SoCFPGA Platform
FPGA: Altera Cyclone V, SE/A4 or SX/C4, version 0x0
BOOT: SD/MMC Internal Transceiver (3.0V)
Watchdog enabled
I2C: ready
DRAM: 1 GiB
MMC: dwmmc0@ff704000: 0
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Model: Terasic DE0-Nano(Atlas)
Net:
Error: ethernet@ff702000 address not set.
No ethernet found.
Hit any key to stop autoboot: 0
=>
````
**If you do no get this far, try an SD card from another manufacturer** - I found the de0 nano to be a lot more fussy than the Beaglebone wrt SD card manufacturer:
- known-to-work: [Samsung HC](https://snag.gy/IfsvhG.jpg), [Kingston SDC4 HC](https://snag.gy/vh46It.jpg)
- problematic: [Sandisk Ultra HC1](https://snag.gy/fCJaeO.jpg), [Transcend Ultimate 633x](https://snag.gy/C3gOo6.jpg)
Try ejecting the SD card, wiggle the card a bit before gently pushing in again; I found the SD card connector is a tad flakey and probably easy to break
**IMPORTANT:** reset to default environment - set the ethernet MAC address (the de0 has no fixed MAC address out of the box - make one up); then save the environment and reset - the commands are:
env default -a setenv ethaddr ba:d0:4a:9c:4e:ce saveenv reset
**do this line by line, not copy & paste in one go (may overrun u-boot):**
````
=> env default -a
## Resetting to default environment
=> setenv ethaddr ba:d0:4a:9c:4e:ce
=> saveenv
Saving Environment to MMC...
Writing to MMC(0)... done
=> reset
````
- this information is saved on the SD card, not some config EEPROM or NVRAM. You will have to redo this step for every SD card.
- The board should come up like so (note change of `Net: eth0: ethernet@ff702000` line):
resetting ...
U-Boot SPL 2016.05-rc3-01014-g57258ab (Apr 27 2016 - 13:20:08) drivers/ddr/altera/sequencer.c: Preparing to start memory calibration drivers/ddr/altera/sequencer.c: CALIBRATION PASSED drivers/ddr/altera/sequencer.c: Calibration complete Trying to boot from MMC1
U-Boot 2016.05-rc3-01014-g57258ab (Apr 27 2016 - 13:20:08 +0200), Build: jenkins-u-boot-socfpga-23
CPU: Altera SoCFPGA Platform FPGA: Altera Cyclone V, SE/A4 or SX/C4, version 0x0 BOOT: SD/MMC Internal Transceiver (3.0V) Watchdog enabled I2C: ready DRAM: 1 GiB MMC: dwmmc0@ff704000: 0 In: serial Out: serial Err: serial Model: Terasic DE0-Nano(Atlas) Net: eth0: ethernet@ff702000 Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0 is current device Checking for: /boot/uEnv.txt ... trying interface=mmc bootpart0:2 ... 410 bytes read in 20 ms (19.5 KiB/s) Loaded environment from /boot/uEnv.txt Using: dtb=socfpga_cyclone5_de0_sockit.dtb ... fpgaimage: file /lib/firmware/socfpga/soc_system.rbf not found - skipping FPGA load... Checking if uname_r is set in /boot/uEnv.txt... Running uname_boot ... loading /boot/vmlinuz-4.1.22-ltsi-rt23-ge1e5eb8 ... 4164872 bytes read in 237 ms (16.8 MiB/s) loading /boot/dtbs//socfpga_cyclone5_de0_sockit.dtb ... 29520 bytes read in 25 ms (1.1 MiB/s) debug: [console=ttyS0,115200 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait quiet] (no initrd)... debug: [bootz 0x01000000 - 100] ... Kernel image @ 0x1000000 [ 0x000000 - 0x3f8d08 ]
Booting using the fdt blob at 0x000100 reserving fdt memory region: addr=0 size=1000 Loading Device Tree to 03ff5000, end 03fff34f ... OK
Starting kernel ...
[ 0.000000] L2C: platform provided aux values permit register corruption.
Debian GNU/Linux 8 mksocfpga ttyS0
Machinekit Debian Image 2016-08-06
Support/FAQ: http://www.machinekit.io/
default username:password is [machinekit:machinekit]
mksocfpga login:
- login from a box with an X display:
````
slogin -x machinekit@mksocfpga.local
- pull any updates (in particular, the socfpga-rbf FPGA firmware package is changing fast!)
sudo apt update
sudo apt -y upgrade
````
- resize the image to the actual SD size
````
sudo /opt/scripts/tools/grow_partition.sh
````
- now you're good to try the demo configs
# Rebuilding on target:
for now, you will have to create a swapfile manually like so:
sudo bash dd if=/dev/zero of=/swapfile bs=1M count=512 chmod 600 /swapfile mkswap /swapfile swapon /swapfile
to make the swap space permanent, add this line to /etc/fstab:
/swapfile none swap defaults 0 0
Rebuild example:
machinekit@mksocfpga:$ cd machinekit/src
machinekit@mksocfpga:/machinekit/src$ touch hal/drivers/mesa-hostmot2/hm2_soc_ol.*
machinekit@mksocfpga:~/machinekit/src$ make
Reading 2/2 PRU dependency files
Reading 328/330 dependency files
Done reading dependencies
Reading 0/0 realtime dependency files Done reading realtime dependencies make: Entering directory '/home/machinekit/machinekit/src' Making modules for flavor posix make[1]: Entering directory '/home/machinekit/machinekit/src' Reading 2/2 PRU dependency files Reading 336/338 dependency files Done reading dependencies
Reading 289/289 realtime dependency files Done reading realtime dependencies Depending hal/drivers/mesa-hostmot2/hm2_soc.c Reading 2/2 PRU dependency files Reading 336/338 dependency files Done reading dependencies
Reading 289/289 realtime dependency files Done reading realtime dependencies Compiling realtime hal/drivers/mesa-hostmot2/hm2_soc.c Linking ../rtlib/posix/hm2_soc.so make[1]: Leaving directory '/home/machinekit/machinekit/src' Making modules for flavor rt-preempt make[1]: Entering directory '/home/machinekit/machinekit/src' Reading 2/2 PRU dependency files Reading 336/338 dependency files Done reading dependencies
Reading 289/289 realtime dependency files Done reading realtime dependencies Depending hal/drivers/mesa-hostmot2/hm2_soc.c Reading 2/2 PRU dependency files Reading 336/338 dependency files Done reading dependencies
Reading 289/289 realtime dependency files Done reading realtime dependencies Compiling realtime hal/drivers/mesa-hostmot2/hm2_soc.c Linking ../rtlib/rt-preempt/hm2_soc.so make[1]: Leaving directory '/home/machinekit/machinekit/src' make: Leaving directory '/home/machinekit/machinekit/src'
machinekit@mksocfpga:/machinekit/src$ sudo make setuid
...
machinekit@mksocfpga:/machinekit/src$ machinekit ../configs/hm2-soc-stepper/5i25-socfpga.ini
MACHINEKIT - 0.1
Machine configuration directory is '/home/machinekit/machinekit/src/../configs/hm2-soc-stepper'
Machine configuration file is '5i25-socfpga.ini'
Starting Machinekit...
io started
....
# Converting to a package-based install:
````
apt update
apt install machinekit machinekit-dev machinekit-rt-preempt
`````
and edit out the reference to /home/machinekit/machinekit/scripts/rip-environment in the .bashrc file.
from progressing through various versions of uboot, I noticed that the SD card handling code must have improved - the initial problems with SD cards of some make have all but gone away