On 11/30/2012 05:34 PM, John Dulaney wrote:
!/bin/bash -x # script for creating a filesystem image for Fedora's Aarch64 port # Copyright 2012 John Dulaneyjdulaney@xxxxxxxxxxxxxxxxx # Licensed under the GPLv3+ # Dependancies: qemu # Set image size imgsize=8G # Create image qemu-img create rootfs.img $imgsize # Add partitions to the image, a 50 MB DOS bootable partition for # uboot, and the rest will be for / parted rootfs.img mklabel msdos parted rootfs.img mkpart primary fat16 1 50 parted rootfs.img mkpart primary ext3 50 $imgsize parted rootfs.img set 1 boot on # Mount the image in /tmp mkdir /tmp/ext3 mkdir /tmp/vfat sudo kpartx -a -v rootfs.img sudo mkfs.vfat /dev/mapper/loop0p1 sudo mkfs.ext3 /dev/mapper/loop0p2 sudo mount /dev/mapper/loop0p1 /tmp/vfat sudo mount /dev/mapper/loop0p2 /tmp/ext3 # Put uboot into the vfat partition for booting wgethttp://fedorapeople.org/groups/armv8/u-boot.bin sudo cp u-boot.bin /tmp/vfat sudo sync sudo umount /tmp/vfat # Copy file system into image cd rootfs sudo sh -c "find . -print | cpio -pdumv /tmp/ext3" #Create /proc, /sys, /dev, etc. since Git doesn't seem to like empty directories sudo mkdir /tmp/ext3/proc sudo mkdir /tmp/ext3/sys sudo mkdir /tmp/ext3/dev sudo mkdir /tmp/ext3/tmp sudo mkdir /tmp/ext3/var/tmp # Create special files in /dev chdir /tmp/ext3/dev sudo mknod null c 1 3 sudo mknod zero c 1 5 sudo mknod tty c 5 0 sudo mknod console c 5 1 sudo mknod sda b 8 0 sudo mknod sda1 b 8 1 sudo mknod sda2 b 8 2 sudo mknod sda3 b 8 3 sudo mknod sda4 b 8 4 sudo mknod mmcblk0 b 179 0 sudo mknod mmcblk0p1 b 179 1 sudo mknod mmcblk0p2 b 179 2 sudo mknod mmcblk0p3 b 179 3 sudo mknod mmcblk0p4 b 179 4 sudo mknod ttyO0 c 253 0 sudo mknod ttyO1 c 253 1 sudo mknod ttyO2 c 253 2 sudo mknod ttyO3 c 253 3 sudo mknod tty2 c 4 2 sudo mknod tty3 c 4 3 sudo mknod tty4 c 4 4 sudo mknod ttyS0 c 4 64 sudo mknod ttyS1 c 4 65 sudo mknod ttyS2 c 4 66 sudo mknod ttyS3 c 4 67 sudo chmod a+rw null zero # Unmount the image. sudo sync sudo umount /tmp/ext3 echo 'Completed.'
I've added this script mostly as-is to the bootstrap.git tree as build-rootfs-img.sh. Note that I took out the mkdirs and mknods in what I checked in; those are being handled in the script init-rootfs.sh which is now being run by the stage1 script when it completes everything it needs to start stage2. Thanks, John. I've already used it a couple of times :). -- ciao, al ----------------------------------- Al Stone Software Engineer Red Hat, Inc. ahs3@xxxxxxxxxx ----------------------------------- _______________________________________________ arm mailing list arm@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/arm