# Disk Image ReadMe

This disk image is intended to support hardware vendors and enthusiasts
interested in porting their platform to CentOS. In some cases this means
the kernel needs to be modified, which can be difficult via the
traditional installer. 


# Using this Disk Image

## Considerations

 * This image is 12GB when uncompressed. Please ensure you have enough
   free space

 * The default root password is 'centos'. The kickstart used to create
   this image will be included below.

 * You will need to add the appropriate boot information in a uefi entry
   after using this image, since the installer traditionally handles
   this.


## Burning the image to disk

You may simply dd this image to disk, however for the sake of ensuring 
that it is written correctly, we recommend the following command. Please 
replace the image-name and target device with the appropriate values for
your environment. 


```
dd if=<image-name.img> of=/dev/sdX bs=2M conv=fsync && sync;
```

## Growing the disk image. 

The root partition of this image was intentionally placed at the end of
the image so that it could be easily grown. A simple command for growing
the image is listed below


```
sudo sgdisk -e -d4 -n4:0:0  /dev/<your-device>
```


## Examining and editing the image

The kpartx tool is very handy for manipulating disk images. Some example
commands are below. Please read the documentation for kpartx before you
modify the disk image. 


 * kpartx -l CentOS-7-1503-aarch64.img # List partitions in the image
 * kpartx -a -v CentOS-7-1503-aarch64.img # Add partition mappings
 * mount /dev/mapper/loop1p1 /mnt # mount the first partition to /mnt
 * umount /mnt # unmount /mnt, obviously.
 * kpartx -d -v CentOS-7-1503-aarch64.img # remove partition mappings


# Kickstart

The following is the kickstart used to generate the disk image. A number
of common development packages were included to make initial porting a
little easier. If you would like to request an additional package 
please email the arm-devel list (http://lists.centos.org/mailman/listinfo/arm-dev)
and request it. 



url --url=http://mirror.centos.org/altarch/7/os/aarch64/

auth --useshadow --passalgo=sha512


# Root password - probably should let firstboot change this
# NOTE: python -c 'import crypt; print crypt.crypt("centos", "$6$APXFUm4V8X9qPrF0")'
#rootpw --iscrypted $6$APXFUm4V8X9qPrF0$.8iDyE8oIKs0sYzyrkRaEJak3SaJhW0nRhKe4C5NsJqXreWA16a8fZlo2b/UDsuV39wczh7mRhxqgaoPSTxxY/

rootpw centos

# Time Zone - probably should let firstboot change this
timezone --utc --ntpservers=0.centos.pool.ntp.org,1.centos.pool.ntp.org,2.centos.pool.ntp.org,3.centos.pool.ntp.org  Etc/UTC

# Keyboard layout - probably something firstboot should configure
keyboard --xlayouts=us --vckeymap=us


shutdown

lang en_US.UTF-8
bootloader --location=mbr
clearpart --initlabel --all

part /boot/efi --size=100
part /boot     --size=400  --label=boot
part swap      --size=2000 --label=swap --asprimary
part /         --size=9400 --label=rootfs

%packages
@core
bash-completion
vim-enhanced
emacs-nox
dracut-config-generic
git
autoconf
automake
binutils-devel
elfutils-devel
pesign
bison
flex
gcc
gcc-c++
gettext
libtool
make
patch
pkgconfig
redhat-rpm-config
rpm-build
byacc
cscope
ctags
diffstat
doxygen
elfutils
gcc-gfortran
git
indent
intltool
patchutils
kmod
hmaccalc
perl
m4
gzip
perl-Carp
diffutils
zlib-devel
newt-devel
python-devel
ncurses-devel
pciutils-devel
sh-utils
tar

%end


# NOTE: usually would use kickstart network directives, but that no worky on image builds, so HACK!
# This might be something firstboot could fix.
%post
cat <<EOF > '/etc/sysconfig/network-scripts/ifcfg-eth0'
NAME=eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
NM_CONTROLLED=yes
EOF
%end