Difference between revisions of "Rock/ubuntu"
(→Generate the image) |
(→Chroot and post configuration) |
||
(3 intermediate revisions by the same user 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= | + | dd if=/dev/zero of=rootfs.ext4 bs=1M count=1024 |
− | mkfs.ext4 -F -L linuxroot | + | mkfs.ext4 -F -L linuxroot rootfs.ext4 #kernel use the label linuxroot to mount the rootfs as / |
− | sudo mount -o loop | + | 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/ 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 http://releases.linaro.org/14.10/ubuntu/trusty-images/alip/linaro-trusty-alip-20141024-684.tar.gz | wget http://releases.linaro.org/14.10/ubuntu/trusty-images/alip/linaro-trusty-alip-20141024-684.tar.gz | ||
Line 60: | Line 59: | ||
sync | sync | ||
sudo umount /mnt | sudo umount /mnt | ||
− | Now you have ''' | + | Now you have '''rootfs.ext4''' as the rootfs image for RR. |
-------------------------------------------------------------------- | -------------------------------------------------------------------- |
Latest revision as of 11:25, 21 January 2015
Contents
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