创建Ubuntu ARM的根文件系统环境

Host OS: Ubuntu 12.04


Step1: 安装ARM QEMU 环境 

PC$  sudo apt-get install qemu-kvm qemu-kvm-extras qemu-kvm-extras-static

Step2: 下载Ubuntu ARM imge, 本例下载 ubuntu-12.04-preinstalled-server-armhf+omap.img.gz

             访问 http://cdimage.ubuntu.com/releases/12.04/release/


Step3: 抽取img里边的rootfs

           PC$ gunzip ubuntu-12.04-preinstalled-server-armhf+omap.img.gz

           PC$ sudo losetup /dev/loop0 ./ubuntu-12.04-preinstalled-server-armhf+omap.img

           PC$ sudo fdisk /dev/loop0

                    Command (m for help): p

                      Disk /dev/loop3: 1590 MB, 1590689792 bytes
                      255 heads, 63 sectors/track, 193 cylinders, total 3106816 sectors
                      Units = sectors of 1 * 512 = 512 bytes
                      Sector size (logical/physical): 512 bytes / 512 bytes
                      I/O size (minimum/optimal): 512 bytes / 512 bytes
                      Disk identifier: 0x00000000

                      Device Boot      Start         End      Blocks   Id  System
                      /dev/loop3p1   *          32      147455       73712    c  W95 FAT32 (LBA)
                      /dev/loop3p2          147456     3106815     1479680   83  Linux

                      Command (m for help): q
             PC$ sudo losetup -d /dev/loop0

             PC$ mkdir tmp rootfs

             PC$  sudo mount -o loop,offset=$[147456*512] ./ubuntu-12.04-preinstalled-server-armhf+omap.img  ./tmp      /*或者使用kpartx代替之*/

             PC$ sudo cp -raf  tmp/* rootfs/

             PC$ sudo umount tmp; rm -rf tmp

             PC$ sudo cp /usr/bin/qemu-arm-static rootfs/usr/bin/

             PC$ sudo mount -t proc proc rootfs/proc

             PC$ sudo mount -t sysfs sysfs rootfs/sys

             PC$ sudo cp /etc/resolv.conf rootfs/etc/

             PC$ sudo chroot  rootfs/ /bin/bash

Step4: 然后就可以在里边像操纵普通的PC 一样加包删除包了

            系统默认的源  http://ports.ubuntu.com/ubuntu-ports/


其他制作rootfs的工具有:


http://processors.wiki.ti.com/index.php/Ubuntu_armhf_development_process
https://wiki.ubuntu.com/ARM/RootfsFromScratch

https://wiki.linaro.org/Platform/DevPlatform/Rootfs

http://www.debian-administration.org/article/Installing_new_Debian_systems_with_debootstrap

          

你可能感兴趣的:(创建Ubuntu ARM的根文件系统环境)