Terasic DE0-NANO-SoC (NANO-SoC) comes with the Yacto Linux on microSD Card as ready to go. Since we have been using Debian for analytical instrument control software and firmware, it worth to take time to swich it to Debian Linux. Here is the complete walk-through for install Debian Jessie onto NANO-SoC.
Setup Debian Jessie (amd64) on Oracle VirtualBox on Windows 8.1 (64bit), and setup MultiArch Cross Tools according to Debian CrossTools (armhf)
Xfce4 desktop environment was used for operation by disabled USB automount feature by unchecking "Enable Volume Management" option on File Manager Preferences.
Make minimal ARM Debian root fs on amd64 Debian host according to "Debian ARM kernel install (Helio SOC FPGA)"
Command walk through:
sudo apt-get install qemu-user-static debootstrap binfmt-support
targetdir=arm-linux-gnueabihf-rootfs
distro=jessie mkdir $targetdir
sudo debootstrap --arch=armhf --foreign $distro $targetdir
sudo cp /usr/bin/qemu-arm-static $targetdir/usr/bin/
sudo cp /etc/resolv.conf $targetdir/etc
sudo chroot $targetdir
distro=jessie
export LANG=C
/debootstrap/debootstrap --second-stage
cat <<EOT > /etc/apt/sources.list
deb http://ftp.jaist.ac.jp/debian/ jessie main
deb-src http://ftp.jaist.ac.jp/debian/ jessie main
deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main
EOT
apt-get update
apt-get install locales dialog dpkg-reconfigure locales
apt-get install openssh-server ntpdate
echo <<EOT > /etc/network/interfaces allow-hotplug eth0 iface eth0 inet dhcp EOT
passwd <set root passwd> echo nano > /etc/hostname exit
tar xvf linux-4.4.6.tar.xz
cd linux-4.4.6
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 socfpga_defconfig
Run following command, and then make sure "CONFIG_FHANDLE" is enabled that located on "Generic setup --->" "open by fhandle syscalls" otherwise, you have no login prompt after boot. Disable CAN network support (due it it get me hand up during boot the target kernel).
References: http://unix.stackexchange.com/questions/169935/no-login-prompt-on-serial-console; https://github.com/wtfuzz/socfpga-debian
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 zImage
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 all
Mount microSD Card, which is a full image copy of NANO-SoC original microSD card, which has initial FPGA configuration and u-boot binary.
sudo mkdir /a
sudo mount /dev/sdb1 /a
sudo cp arch/arm/boot/zImage /a
sudo cp arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dtb /a/socfpga.dtb
sudo umount /a
sudo mkfs.ext3 /dev/sdb2
sudo mount /dev/sdb2 /mnt
cd $targetdir
sudo tar cf - . | (sudo tar xvf - -C /mnt)
cd ~/linux-4.4.6
sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 modules_install INSTALL_MOD_PATH=/mnt
sudo chroot /mnt
passwd <set root password for this instance>
That's it.
See also: http://xillybus.com/tutorials/u-boot-image-altera-soc
Comments
toshi
Wed, 02/10/2016 - 23:43
Permalink
Create de0_nano_soc.rbf file from Quartus Prme generated .sof
Default FPGA configuration comes with DE0-Nano-SoC from Terasic blocks debugging a software access to LED region. So that I've figured the way to generate the de0-nano-soc.rbf file for /dev/mmcblk0p1 partition (vFAT).
Walkthrough:
If no "compression" is checked at last step, MSEL switch on the DE0-Nano-SoC board should be changed to: 1: ON-2:ON-3:ON-4:ON-5:ON
See: http://rocketboards.org/foswiki/view/Documentation/GSRD131ProgrammingFPGA
toshi
Wed, 04/13/2016 - 07:11
Permalink
Create .img file directory on linux (amd64) for de0-nano-soc
Download DE0_Nano_SoC_Linux_Console_3.3.zip from Terrasic web site, and inflate it. Rename DE0_Nano_SoC_Linux_Console.img to de0_nano_soc_debian8.img.
And then, follow the procedure;
toshi
Wed, 05/11/2016 - 05:16
Permalink
mount ext4
When I create a new partition by mkfs.ext4 that partition failed on mount. Require following commands for disable huge_file feature.
toshi
Sat, 05/14/2016 - 01:36
Permalink
Easy way to mount .img file on loop device
sudo losetup --show -f -P de0.img
/dev/loop0
ls /dev/loop0*
/dev/loop0 /dev/loop0p1 /dev/loop0p2 /dev/loop0p3
toshi
Sat, 05/14/2016 - 08:59
Permalink
Expand root partition
1. Boot up de0_nano_soc with newly created SD Card.
2. Expand root filesystem: -- The procedure blow might be completely destroy your data. Do it at your own risk --
Reboot Linux, then
Reboot again, and make sure file system was enlarged.
Good luck.