Debian ARM kernel install (Helio SOC FPGA)

1. make minimal rootfs on amd64 Debian Jessie, according to "How to create bare minimum Debian Wheezy rootfs from scratch"

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.jp.debian.org/debian $distro main contrib non-free
deb-src http://ftp.jp.debian.org/debian $distro main contrib non-free
deb http://ftp.jp.debian.org/debian $distro-updates main contrib non-free
deb-src http://ftp.jp.debian.org/debian $distro-updates main contrib non-free
deb http://security.debian.org/debian-security $distro/updates main contrib non-free
deb-src http://security.debian.org/debian-security $distro/updates main contrib non-free
EOT

apt-get update
apt-get install locales dialog
dpkg-reconfigure locales

apt-get install openssh-server ntpdate

passwd
 
cat <<EOT > /etc/network/interfaces
allow-hotplug eth0
iface eth0 inet static
	address 192.168.1.254
	netmask 255.255.255.248
	gateway 192.168.1.1	
EOT

echo helio > /etc/hostname

echo T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 >> /etc/inittab
 
exit

2. Cross compile Linux kernel

Reference: http://www.rocketboards.org/foswiki/Documentation/HowUseTftpDebugKernel

sudo apt-get install bc u-boot-tools
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.9.tar.xz
tar xvf linux-3.18.9.tar.xz
cd linux-3.18.9

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 socfpga_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 zImage
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 all

Mount SDCard, which created from Ubuntu image downloaded from Macnica-america's web site. It's not necessary to start with Ubuntu image though just make it easy to create two partitions on SDCard as first fat device, then second ext3 linux fs.

sudo mkdir /a
sudo mount /dev/sdb1 /a
sudo cp arch/arm/boot/zImage /a
sudo cp arch/arm/boot/dts/socfpga_cyclone5_socdk.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-3.18.9
sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 modules_install INSTALL_MOD_PATH=/mnt

That's it.

English

User login