Fedora ARM Installer

From FedoraProject

Revision as of 17:52, 22 April 2013 by Fossjon (Talk | contribs)

Jump to: navigation, search

Contents

Summary

@ WARNING: This program *WILL* destroy *ANY* data on the selected disk. Please make sure to backup your device first and be careful! @

This is a first attempt at a basic Fedora ARM Image Installer ( Downloader / Creator / Updater ). All one has to do is first select a source image file or download option (click the refresh button first). Then select the destination (target) device drive to write to. Then just click install!

This script is written in Python (version 2 & 3 compatible) and makes use of the PyQt4 GUI module allowing it to run graphically (both Linux & Windows). The files written are block device image files containing: [MBR + Partitions + File Systems + Data]. Distributors should make sure to package some sort of first-boot setup-script to customize the root file system as there is no official installer for ARM devices yet. Hopefully this application will be able to create bootable media for almost any generalized Guruplug , Raspberry Pi , Efika , Pandaboard and Trimslice. Devices that boot off of hard drives may have to wait a bit as there is a line of code that ignores block devices that are greater than 32 Gigabytes in size (temporarily trying to protect users).

Note: The Windows version makes use of a pre-packaged dd.exe binary file to help write to device files

@ WARNING: This program *WILL* destroy *ANY* data on the selected disk. Please make sure to backup your device first and be careful! @

Faii-win.png

Faii-nix.png

Downloads & Install

  • Note: Make sure to force-refresh this page when checking for a new or updated version as this page gets easily cached.

Windows Vista & 7

        Zip File

  1. Click on the link above
  2. Right click on the file and select "Extract All..."
  3. Open the extracted folder
  4. Right click on the program/executable file and select "Run as administrator"
  5. Be careful!

Linux

        RPM Package

  1. yum install pyqt4
  2. rpm -i fedora-arm-installer-<v-r>.noarch.rpm
  • On a Fedora 18 system, you can now run "yum install fedora-arm-installer"

Distributors

Notes

This simple bash script, based on dd, should allow one to create a flat device-file (of a minimal size) which contains any necessary partitions (mbr) and data (kernel + filesystem) such that a bootable SD card can be created from it. Since there is no real installation process, an initial on-boot script should be included to perform the following:

  • Since the partition space is minimized here, the data partition should be re-sized to fill the rest of the drive space
  • Initial root and user account setup

Usage

  • The -c switch creates a flat-file with a given size in Gigabytes
    • allowing you to partition it
  • The -s switch splits the partitioned flat-file into its respective partition chunks
    • allowing you to make filesystems, mount them and copy files to them
  • The -j switch joins all of the split flat-files back into a final block image file

Script

#!/bin/bash

if [ "${1}" == "c" ]
then
	if [ "${3}" == "" ]
	then
		echo "Usage: $0 $1 <filename> <filesize>"
		exit 1
	fi
	echo "Creating new file [${2}]..."
	dd if=/dev/zero of=${2} bs=${3}G count=1 > /dev/null 2>&1
	echo "Partition the new flat file ( fdisk ${2} )"
	echo
fi

if [ "${1}" == "s" ]
then
	if [ "${2}" == "" ]
	then
		echo "Usage: $0 $1 <filename>"
		exit 1
	fi
	unit=`fdisk -l "${2}" | grep -i '^Units' | sed -e 's/^.* \([0-9][0-9]*\) bytes.*$/\1/g'`
	lase="-1"
	numb=0
	fdisk -l "${2}" | sed -e 's/^[ \t]*//g' -e 's/\*//g' | grep -i "^${2}[0-9][0-9]*" | while read line
	do
		curb=`echo "${line}" | awk '{ print $2 }'`
		cure=`echo "${line}" | awk '{ print $3 }'`
		let size="${cure} - ${curb} + 1"
		let diff="${curb} - ${lase} - 1"
		if [ ${diff} -gt 0 ]
		then
			let endi="${curb} - 1"
			let skip="${lase} + 1"
			echo "[${numb}] Unused space [${skip} - ${endi}] [${diff} blocks]..."
			dd if=${2} bs=${unit} skip=${skip} count=${diff} of=${2}${numb} > /dev/null 2>&1
			let numb="${numb} + 1"
		fi
		echo "[${numb}] Carving partition [${curb} - ${cure}] [${size} blocks]..."
		dd if=${2} bs=${unit} skip=${curb} count=${size} of=${2}${numb} > /dev/null 2>&1
		let numb="${numb} + 1"
		lase="${cure}"
	done
	fdisk -l "${2}" | sed -e 's/^[ \t]*//g' -e 's/\*//g' | grep -i "^${2}[0-9][0-9]*" | tail -n 1 | while read line
	do
		endi=`echo "${line}" | awk '{ print $3 }'`
		let rest="${endi} + 1"
		numb="9"
		echo "[${numb}] Copying ending [${rest} - <end>]..."
		dd if=${2} bs=${unit} skip=${rest} of=${2}${numb} > /dev/null 2>&1
	done
	echo
	echo "Create any filesystem needed ( mkfs.* ${2}[0-9] )"
	echo "Mount any filesystem needed ( mount -o loop ${2}[0-9] /mnt/tmp[0-9] )"
	echo "Copy any files needed ( cp -r source/* /mnt/tmp[0-9]/ )"
	echo "Unmount any filesystem needed ( umount /mnt/tmp[0-9] )"
	echo
fi

if [ "${1}" == "j" ]
then
	if [ "${2}" == "" ]
	then
		echo "Usage: $0 $1 <filename>"
		exit 1
	fi
	echo "Writing to file [${2}.join]..."
	cat ${2}[0-9]* > ${2}.join
	echo
fi

Comments / Questions / Feedback / Suggestions ?