How to make a customize ubuntu rootfs image
Install required packages
sudo apt-get install qemu-user-static binfmt-support
Generate the image
dd if=/dev/zero of=rootfs.img bs=1M count=1024 mkfs.ext4 -F -L linuxroot rootfs.img #kernel use the label linuxroot to mount the rootfs as / sudo mount -o loop rootfs.img /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/marsboard-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
Now we are done! :D
root@target:# exit sync sudo umount /mnt
Now you have rootfs.img as the rootfs image for marsboard. 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