GTA04Installation » History » Revision 4
Revision 3 (Paul Kocialkowski, 05/18/2012 09:27 PM) → Revision 4/24 (Paul Kocialkowski, 08/01/2012 03:34 PM)
h1. GTA04 Installation h2. Installing for µSD card storage Creating a system tarball Once your Replicant systemtarball build is ready (bootimage and bootimage for GTA04 are ready, systemimage), you can start need to create a system tarball: <pre> cd out/target/product/gta04/system tar -cf ../system.tar . cd .. </pre> h2. Flashing the install procedure. h3. Getting kernel You need to flash the install kernel to the place your boot.scr will try to load it (usually from NAND). h2. Setting up the sdcard Connect the sdcard to your pc (running GNU/Linux) and run the following script (with nor arguments to see usage): To make it easier to install <pre> #!/bin/sh # Replicant GTA04 Install script # # Copyright (C) 2012 Paul Kocialkowski, GPLv2 # # Based on GTA04, mkcard.sh v0.5 # Copyright (C) 2009 Graeme Gregory <dp@xora.org.uk>, GPLv2 # Parts of the procudure base on the work of Denys Dmytriyenko # http://wiki.omap.com/index.php/MMC_Boot_Format # # This program is free software: you can use the install script: replicant_gta04_install.sh. redistribute it and/or modify It should be shipped with Replicant images or copied in @out/target/product/gta04/@ during # it under the build process. terms of the GNU General Public License as published by If you cannot find # the script, download the latest Free Software Foundation, either version from gitorious: "replicant_gta04_install.sh":https://gitorious.org/replicant/device_goldelico_gta04/blobs/raw/replicant-2.3/replicant_gta04_install.sh h3. Installing 2 of the kernel License, or # (at your option) any later version. # # You should have to write the kernel at the correct location where u-boot will read it. Replicant may provide received a boot.scr file in copy of the future, allowing to chose between NAND and uSD kernel location. GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. h3. Installing the system # Env vars Follow replicant_gta04_install.sh usage: export LC_ALL=C # Global vars DRIVE="" <pre> DRIVE_NAME="" Usage: ./replicant_gta04_install.sh DRIVE_SIZE="" DRIVE_CYLINDERS="" DRIVE_PART="" SYSTEM_AR="" MOUNT_BASE="/media" # Functions display_banner() { echo "Replicant GTA04 installer" echo "" } display_help() { echo "Usage: $0 [DRIVE] [SYSTEM] Notes: - [SYSTEM]" echo "" echo "Notes: " echo "- The [DRIVE] argument can be omitted - omitted" echo "- The [SYSTEM] argument must be a tar archive archive" } drive_select_list() { drives_dir="/dev/disk/by-id/" count=0 list=$( ls "$drives_dir" ) for drive in $list do drive_nopart=$( echo "$drive" | sed "s/-part[0-9]*$//g" ) if [ "$drive" = "$drive_nopart" ] then ls $drives_dir/$drive-part* 2> /dev/null > /dev/null if [ $? -eq 0 ] then count=$(( $count + 1 )) name=$( echo "$drive" | sed "s/^[^-]*-\(.*\)$/\1/g" ) case "$1" in "show") echo "$count - $name" ;; "store") if [ $count -eq $2 ] then DRIVE=$( readlink -f "$drives_dir/$drive" ) DRIVE_NAME="$name" fi ;; esac fi fi done } drive_select() { echo "Available devices:" drive_select_list "show" echo -n "Choice: " read choice drive_select_list "store" $choice echo "" } drive_write_confirm() { if [ "$DRIVE" = "" ] then echo "Wrong drive block" exit 1 fi echo "This is going to erase the following drive:" if [ "$DRIVE_NAME" != "" ] then echo "- $DRIVE_NAME ($DRIVE)" else echo "- $DRIVE" fi echo "" echo -n "Are you sure? " read confirm if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ] then echo "" return else exit 0 fi } drive_umount() { umount $DRIVE* 2> /dev/null } drive_empty() { dd if=/dev/zero of="$DRIVE" bs=1024 count=1024 } drive_infos_get() { DRIVE_SIZE=$( fdisk -l "$DRIVE" | grep Disk | grep bytes | awk '{print $5}' ) DRIVE_CYLINDERS=$( echo "$DRIVE_SIZE/255/63/512" | bc ) } drive_partitions_set() { system_size=$( echo "(250 * 1024 * 1024) / ($DRIVE_SIZE/$DRIVE_CYLINDERS)" | bc ) data_size=$( echo "(250 * 1024 * 1024) / ($DRIVE_SIZE/$DRIVE_CYLINDERS)" | bc ) cache_size=$( echo "(100 * 1024 * 1024) / ($DRIVE_SIZE/$DRIVE_CYLINDERS)" | bc ) { echo ",$system_size,83" echo ",$data_size,83" echo ",$cache_size,83" echo ",,0c" } | sfdisk -D -H 255 -S 63 -C "$DRIVE_CYLINDERS" "$DRIVE" mkfs.ext2 -L "system" "${DRIVE}1" mkfs.ext2 -L "data" "${DRIVE}2" mkfs.ext2 -L "cache" "${DRIVE}3" mkfs.vfat -F 32 -n "storage" "${DRIVE}4" } system_write() { echo "Writing system files" mkdir -p "$MOUNT_BASE/system" mount "${DRIVE}1" "$MOUNT_BASE/system" tar -p -xf $SYSTEM_AR -C "$MOUNT_BASE/system" dir=$( pwd ) echo "Syncing files" cd "$MOUNT_BASE/system" sync cd "$dir" rmdir "$MOUNT_BASE/system" } display_end() { echo "" echo "Your drive is now ready to be used!" } drive_eject() { eject "$DRIVE" } # Script start if [ $# -eq 0 ] then display_help exit 1 fi if [ $# -eq 1 ] then SYSTEM_AR=$1 fi if [ $# -eq 2 ] then DRIVE=$1 SYSTEM_AR=$2 fi display_banner if [ "$DRIVE" = "" ] then drive_select fi drive_write_confirm drive_umount drive_empty drive_infos_get drive_partitions_set system_write display_end drive_eject </pre> For instance: @./replicant_gta04_install.sh system.tar@