Difference between revisions of "RK3188-SOM"

m (Debian Wheezy)
m (Debian Wheezy)
Line 53: Line 53:
  
 
* Update Debian package database:
 
* Update Debian package database:
<code>apt-get update</code>
+
<code>apt-get update</code>  
  
+
* set up locales dpkg scripts tend to complain otherwise, note in jessie you will also need to install the dialog package as well.
 
+
  <code>apt-get install locales dialog</code>
set up locales dpkg scripts tend to complain otherwise, note in jessie you will also need to install the dialog package as well.
+
<code>dpkg-reconfigure locales</code>
 
 
   
 
'''apt-get install locales dialog
 
dpkg-reconfigure locales'''
 
 
 
 
 
 
Install some useful packages inside the chroot
 
apt-get install openssh-server ntpdate
 
 
 
 
  
Set a root password so you can login
+
* Install some useful packages inside the chroot
'''passwd'''
+
<code>apt-get install openssh-server ntpdate</code>
  
   
+
* Set a root password so you can login
 +
  <code>passwd</code>
  
Build a basic network interface file so that the board will DHCP on eth0
+
* Build a basic network interface file so that the board will DHCP on eth0
'''echo <<EOT >> /etc/network/interfaces
+
<code>echo <<EOT >> /etc/network/interfaces</code>
allow-hotplug eth0
+
<code>allow-hotplug eth0</code>
iface eth0 inet static
+
<code>iface eth0 inet static</code>
address 192.168.1.254
+
<code>    address 192.168.1.254</code>
netmask 255.255.255.248
+
<code>    netmask 255.255.255.248</code>
gateway 192.168.1.1
+
<code>    gateway 192.168.1.1</code>
EOT
+
<code>EOT</code>
'''
 
 
  
Note: Your board will be accessible over SSH on IP address defined above !  
+
Note: Your board will be accessible over SSH on IP address defined above!  
  
   
+
* Set the hostname
 +
  <code>echo nameme > /etc/hostname</code>
  
Set the hostname
+
* Enable the serial console, Debian sysvinit way
'''echo nameme > /etc/hostname
+
<code>echo T0:2345:respawn:/sbin/getty -L ttyFIQ0 115200 vt100 >> /etc/inittab</code>
'''
 
 
  
Enable the serial console, Debian sysvinit way
+
This way you'll get login prompt at startup. By default you cannot login as root. To do this you should make another user,
'''echo T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 >> /etc/inittab
+
add him to the sudo group, login at startup and then login as root. To skip all this replace the line above with:
'''
+
<code>echo T0:2345:respawn:/sbin/getty -L ttyFIQ0 -a root 115200 vt100 >> /etc/inittab</code>
 
   
 
   
 +
* We are done inside the chroot, so quit the chroot shell
 +
<code>exit</code>
  
We are done inside the chroot, so quit the chroot shell
+
* Tidy up the support files
'''exit'''
+
<code>sudo rm $targetdir/etc/resolv.conf</code>
 
+
<code>sudo rm $targetdir/usr/bin/qemu-arm-static</code>
 
 
 
Tidy up the support files
 
'''sudo rm $targetdir/etc/resolv.conf
 
sudo rm $targetdir/usr/bin/qemu-arm-static'''
 
 
 
 
  
 
Now you have your Debian rootfs. Next step is to build Kernel, Uboot and to make your SD-card as explained in our early posts and Build instructions but instead to use the rootfs in the posts you can use your own minimal rootfs which you created above. The rootfs image created above is approx 150MB, it could be made smaller if you remove more packages.
 
Now you have your Debian rootfs. Next step is to build Kernel, Uboot and to make your SD-card as explained in our early posts and Build instructions but instead to use the rootfs in the posts you can use your own minimal rootfs which you created above. The rootfs image created above is approx 150MB, it could be made smaller if you remove more packages.

Revision as of 02:32, 24 October 2014

Linux

Booting from SD-card

Writing Rockchip loader

dd if=loader.img of=/dev/sde conv=sync,fsync
dd if=parameter of=/dev/sde conv=sync,fsync seek=$((0x2000))
dd if=boot.img of=/dev/sde conv=sync,fsync seek=$((0x2000+0x2000))

Building kernel

./mkbootimg --kernel RK3188-SOM/arch/arm/boot/Image --ramdisk initrd.img -o boot.img

Creating root filesystem

Debian Wheezy

In this post we will explain how you can create your own Debian rootfs with pre-installed packages of your choice, which to allow tiny Linux images to be created. All steps below should work on any Debian host (Debian/Ubuntu etc) and are verified with Ubuntu 12.04LTS. First of all you need to install the support packages on your pc:

  • Install needed packages:
sudo apt-get install qemu-user-static debootstrap binfmt-support
  • Define some variables:
targetdir=rootfs
distro=wheezy
  • Build first stage:
mkdir $targetdir
sudo debootstrap --arch=armhf --foreign $distro $targetdir
  • Copy needed files from host to the target:
sudo cp /usr/bin/qemu-arm-static $targetdir/usr/bin/
sudo cp /etc/resolv.conf $targetdir/etc

If everything is right we now have a minimal Debian Rootfs.

  • Login into the new filesystem:
sudo chroot $targetdir 
  • Inside the chroot we need to set up the environment again
distro=wheezy
export LANG=C 
  • Now we are setup the second stage of debootstrap needs to run install the packages downloaded earlier
/debootstrap/debootstrap --second-stage
  • Once the package installation has finished, setup some support files and apt configuration.
cat <<EOT > /etc/apt/sources.list
deb http://ftp.uk.debian.org/debian $distro main contrib non-free
deb-src http://ftp.uk.debian.org/debian $distro main contrib non-free
deb http://ftp.uk.debian.org/debian $distro-updates main contrib non-free
deb-src http://ftp.uk.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 
  • Update Debian package database:
apt-get update 
  • set up locales dpkg scripts tend to complain otherwise, note in jessie you will also need to install the dialog package as well.
apt-get install locales dialog
dpkg-reconfigure locales 
  • Install some useful packages inside the chroot
apt-get install openssh-server ntpdate 
  • Set a root password so you can login
passwd 
  • Build a basic network interface file so that the board will DHCP on eth0
echo <<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 

Note: Your board will be accessible over SSH on IP address defined above!

  • Set the hostname
echo nameme > /etc/hostname 
  • Enable the serial console, Debian sysvinit way
echo T0:2345:respawn:/sbin/getty -L ttyFIQ0 115200 vt100 >> /etc/inittab

This way you'll get login prompt at startup. By default you cannot login as root. To do this you should make another user, add him to the sudo group, login at startup and then login as root. To skip all this replace the line above with:

echo T0:2345:respawn:/sbin/getty -L ttyFIQ0 -a root 115200 vt100 >> /etc/inittab

  • We are done inside the chroot, so quit the chroot shell
exit
  • Tidy up the support files
sudo rm $targetdir/etc/resolv.conf
sudo rm $targetdir/usr/bin/qemu-arm-static

Now you have your Debian rootfs. Next step is to build Kernel, Uboot and to make your SD-card as explained in our early posts and Build instructions but instead to use the rootfs in the posts you can use your own minimal rootfs which you created above. The rootfs image created above is approx 150MB, it could be made smaller if you remove more packages.

  • Adding new user

apt-get install xfce4
apt-get install lightdm

Booting from NAND

Booting from USB-stick

Android