Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Difference between revisions of "Rock/ubuntu"

(bluez package configure error)
(Chroot and post configuration)
 
(17 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
+
{{rock_header}}
 
+
 
{{Languages|rock/ubuntu}}
 
{{Languages|rock/ubuntu}}
  
Line 11: Line 10:
  
 
=== Generate the image ===
 
=== Generate the image ===
     dd if=/dev/zero of=rock_rootfs.img bs=1M count=1024
+
     dd if=/dev/zero of=rootfs.ext4 bs=1M count=1024
     mkfs.ext4 -F -L linuxroot rock_rootfs.img #kernel use the label linuxroot to mount the rootfs as /
+
     mkfs.ext4 -F -L linuxroot rootfs.ext4 #kernel use the label linuxroot to mount the rootfs as /
     sudo mount -o loop rock_rootfs.img /mnt
+
     sudo mount -o loop rootfs.ext4 /mnt
The fast way is to make a ubuntu image is downloading a recent pre-built ubuntu rootfs from [https://releases.linaro.org/latest/ubuntu/raring-images linaro]
+
The fast way is to make a ubuntu image is downloading a recent pre-built ubuntu rootfs from [https://releases.linaro.org/latest/ubuntu/ linaro]
     wget https://releases.linaro.org/13.08/ubuntu/raring-images/alip/linaro-raring-alip-20130826-474.tar.gz
+
     wget http://releases.linaro.org/14.10/ubuntu/trusty-images/alip/linaro-trusty-alip-20141024-684.tar.gz
     sudo tar zxvf linaro-raring-alip-20130826-474.tar.gz -C /mnt
+
     sudo tar zxvf linaro-*.tar.gz -C /mnt
 
     cd /mnt
 
     cd /mnt
 
     sudo mv binary/* .
 
     sudo mv binary/* .
 
     sudo rmdir binary
 
     sudo rmdir binary
 +
Copy the kernel modules you built from [[rock/Booting_Linux | Building the kernel]]
 +
    sudo mkdir -p /mnt/lib/modules
 +
    sudo cp -r /path/to/linux-rockchip/modules/lib/modules/3.0.36+ /mnt/lib/modules
  
 
=== Prepare chroot ===
 
=== Prepare chroot ===
Line 26: Line 28:
 
     sudo mount -t devpts devpts /mnt/dev/pts
 
     sudo mount -t devpts devpts /mnt/dev/pts
 
     sudo mount -t proc proc /mnt/proc
 
     sudo mount -t proc proc /mnt/proc
=== Chroot and post configuartion ===
+
=== Chroot and post configuration ===
 
     sudo chroot /mnt
 
     sudo chroot /mnt
Now we are in the target rootfs.
+
'''Now we are in the target rootfs, let's continue to configure the system.'''
To be continued...
+
 
 +
Change the default shell to bash.
 +
    root@target:# rm /bin/sh && ln -s /bin/bash /bin/sh
 +
Install the pre-installed packages
 +
    root@target:# apt-get update
 +
    root@target:# apt-get install ssh vim usbutils wpasupplicant wireless-tools
 +
Add a script to link the mtd blocks to names
 +
    root@target:# vim /usr/local/bin/mtd-by-name.sh
 +
Add the following
 +
    #!/bin/sh -e
 +
    # mtd-by-name link the mtdblock to name
 +
    # radxa.com, thanks to naobsd
 +
    rm -rf /dev/block/mtd/by-name/
 +
    mkdir -p /dev/block/mtd/by-name
 +
    for i in `ls -d /sys/class/mtd/mtd*[0-9]`; do
 +
        name=`cat $i/name`
 +
        tmp="`echo $i | sed -e 's/mtd/mtdblock/g'`"
 +
        dev="`echo $tmp |sed -e 's/\/sys\/class\/mtdblock/\/dev/g'`"
 +
        ln -s $dev /dev/block/mtd/by-name/$name
 +
    done
 +
Add the mtd-by-name script to rc.local to get executed every time system boots
 +
    root@target:# vim /etc/rc.local
 +
Add this line before '''exit 0'''
 +
    /usr/local/bin/mtd-by-name.sh
 +
'''Now we are done! :D'''
 +
    root@target:# exit
 +
    sync
 +
    sudo umount /mnt
 +
Now you have '''rootfs.ext4''' as the rootfs image for RR.
 +
 
 +
--------------------------------------------------------------------
  
 
=== Trouble shooting ===
 
=== Trouble shooting ===
Line 53: Line 85:
 
     dpkg --configure bluez
 
     dpkg --configure bluez
  
=== Non root user can not use the network ===
+
==== Non root user can not use the network ====
 
Edit /etc/group and add
 
Edit /etc/group and add
 
     inet:x:3003:root
 
     inet:x:3003:root
Line 59: Line 91:
 
and then run
 
and then run
 
     gpasswd -a username inet
 
     gpasswd -a username inet
 +
 +
=== Alternative way ===
 +
 +
[http://androtab.info/radxa_rock/ubuntu/ you can prepare your own ubuntu rootfs on Radxa Rock]
  
 
[[Category: Distributions]]
 
[[Category: Distributions]]
 
[[Category: Tutorial]]
 
[[Category: Tutorial]]
 
[[Category: Ubuntu]]
 
[[Category: Ubuntu]]

Latest revision as of 11:25, 21 January 2015

This page describe how to customize a ubuntu image for radxa rock.

Install required packages

   sudo apt-get install qemu-user-static binfmt-support

Generate the image

   dd if=/dev/zero of=rootfs.ext4 bs=1M count=1024
   mkfs.ext4 -F -L linuxroot rootfs.ext4 #kernel use the label linuxroot to mount the rootfs as /
   sudo mount -o loop rootfs.ext4 /mnt

The fast way is to make a ubuntu image is downloading a recent pre-built ubuntu rootfs from linaro

   wget http://releases.linaro.org/14.10/ubuntu/trusty-images/alip/linaro-trusty-alip-20141024-684.tar.gz
   sudo tar zxvf linaro-*.tar.gz -C /mnt
   cd /mnt
   sudo mv binary/* .
   sudo rmdir binary

Copy the kernel modules you built from Building the kernel

   sudo mkdir -p /mnt/lib/modules
   sudo cp -r /path/to/linux-rockchip/modules/lib/modules/3.0.36+ /mnt/lib/modules

Prepare chroot

   sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin
   sudo modprobe binfmt_misc
   sudo mount -t devpts devpts /mnt/dev/pts
   sudo mount -t proc proc /mnt/proc

Chroot and post configuration

   sudo chroot /mnt

Now we are in the target rootfs, let's continue to configure the system.

Change the default shell to bash.

   root@target:# rm /bin/sh && ln -s /bin/bash /bin/sh

Install the pre-installed packages

   root@target:# apt-get update
   root@target:# apt-get install ssh vim usbutils wpasupplicant wireless-tools

Add a script to link the mtd blocks to names

   root@target:# vim /usr/local/bin/mtd-by-name.sh

Add the following

   #!/bin/sh -e
   # mtd-by-name link the mtdblock to name
   # radxa.com, thanks to naobsd
   rm -rf /dev/block/mtd/by-name/
   mkdir -p /dev/block/mtd/by-name
   for i in `ls -d /sys/class/mtd/mtd*[0-9]`; do
       name=`cat $i/name`
       tmp="`echo $i | sed -e 's/mtd/mtdblock/g'`"
       dev="`echo $tmp |sed -e 's/\/sys\/class\/mtdblock/\/dev/g'`"
       ln -s $dev /dev/block/mtd/by-name/$name
   done

Add the mtd-by-name script to rc.local to get executed every time system boots

   root@target:# vim /etc/rc.local

Add this line before exit 0

   /usr/local/bin/mtd-by-name.sh

Now we are done! :D

   root@target:# exit
   sync
   sudo umount /mnt

Now you have rootfs.ext4 as the rootfs image for RR.


Trouble shooting

bluez package configure error

Setting up bluez (4.101-0ubuntu8b1) ...
reload: Unknown instance: 
invoke-rc.d: initscript dbus, action "force-reload" failed.
start: Job failed to start
invoke-rc.d: initscript bluetooth, action "start" failed.
dpkg: error processing bluez (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of blueman:
blueman depends on bluez (>= 4.25); however:
Package bluez is not configured yet.
...

It turns out the bluez package needs the dbus service running in order to configure properly. The following works:

   service dbus start
   dbus start/running, process 24551
   dpkg --configure bluez

Non root user can not use the network

Edit /etc/group and add

   inet:x:3003:root
   net_raw:x:3004:root

and then run

   gpasswd -a username inet

Alternative way

you can prepare your own ubuntu rootfs on Radxa Rock