freemyipod r865 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r864‎ | r865 | r866 >
Date:22:06, 31 May 2012
Author:user890104
Status:new
Tags:
Comment:
tools: add some shell scripts, that help building an installer and uploading it to a device
Modified paths:
  • /tools/build-tree.sh (added) (history)
  • /tools/install-classic.sh (added) (history)

Diff [purge]

Index: tools/install-classic.sh
@@ -0,0 +1,77 @@
 2+#!/bin/bash
 3+#
 4+#
 5+# Copyright 2012 user890104
 6+#
 7+#
 8+# This file is part of emCORE.
 9+#
 10+# emCORE is free software: you can redistribute it and/or
 11+# modify it under the terms of the GNU General Public License as
 12+# published by the Free Software Foundation, either version 2 of the
 13+# License, or (at your option) any later version.
 14+#
 15+# emCORE is distributed in the hope that it will be useful,
 16+# but WITHOUT ANY WARRANTY; without even the implied warranty of
 17+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 18+# See the GNU General Public License for more details.
 19+#
 20+# You should have received a copy of the GNU General Public License
 21+# along with emCORE. If not, see <http://www.gnu.org/licenses/>.
 22+#
 23+#
 24+
 25+# Quick README:
 26+# 1. place this script in your home dir
 27+# 2. checkout our SVN to $HOME/freemyipod
 28+# 3. build the tree (or use precompiled binaries)
 29+# 4. adjust the paths below
 30+# 5. plug your iPod and enter DFU mode
 31+# 6. run the script
 32+# 7. enjoy!
 33+
 34+# works for both initial installs and updating
 35+
 36+####################################
 37+# IMPORTANT!!! EDIT THESE BELOW!!! #
 38+####################################
 39+
 40+if [ -z "${1}" ]
 41+then
 42+ FMI_TARGET_DEVICE='/dev/sdc'
 43+else
 44+ FMI_TARGET_DEVICE="${1}"
 45+fi
 46+
 47+FMI_IPODDFU="${HOME}/freemyipod/tools/ipoddfu/ipoddfu.py"
 48+FMI_BOOTSTRAP="${HOME}/freemyipod/apps/installer-ipodclassic/build/bootstrap-ipodclassic.dfu"
 49+#FMI_BOOTSTRAP="${HOME}/dfu-images/bootstrap-ipodclassic-r708-20110424.dfu"
 50+#FMI_INSTALLER="${HOME}/freemyipod/emcore/trunk/build/ipodclassic/emcore.bin"
 51+FMI_INSTALLER="${HOME}/freemyipod/apps/installer-ipodclassic/build/installer-ipodclassic.ubi"
 52+#FMI_INSTALLER="${HOME}/installers/installer-ipodclassic-r708-20110424.ubi"
 53+
 54+########################
 55+# DO NOT EDIT BELOW!!! #
 56+########################
 57+
 58+FMI_MOUNTPOINT="$(mktemp --directory --tmpdir freemyipod.XXXXXXXX)"/
 59+trap "echo; rm -vrf '${FMI_MOUNTPOINT}'" EXIT
 60+
 61+python3 "${FMI_IPODDFU}" "${FMI_BOOTSTRAP}" && \
 62+
 63+( \
 64+ echo -n 'Please wait'
 65+
 66+ while [ ! -e "${FMI_TARGET_DEVICE}" ]
 67+ do
 68+ echo -n .
 69+ sleep 1
 70+ done
 71+
 72+ echo
 73+) && \
 74+sudo mount "${FMI_TARGET_DEVICE}" "${FMI_MOUNTPOINT}" && \
 75+sudo cp "${FMI_INSTALLER}" "${FMI_MOUNTPOINT}"/init.ubi && \
 76+sudo eject "${FMI_TARGET_DEVICE}" && \
 77+rm -vrf "${FMI_MOUNTPOINT}" && \
 78+echo 'Installer has been launched!'
Property changes on: tools/install-classic.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
 79+*
\ No newline at end of property
Index: tools/build-tree.sh
@@ -0,0 +1,120 @@
 2+ #!/bin/bash
 3+#
 4+#
 5+# Copyright 2012 user890104
 6+#
 7+#
 8+# This file is part of emCORE.
 9+#
 10+# emCORE is free software: you can redistribute it and/or
 11+# modify it under the terms of the GNU General Public License as
 12+# published by the Free Software Foundation, either version 2 of the
 13+# License, or (at your option) any later version.
 14+#
 15+# emCORE is distributed in the hope that it will be useful,
 16+# but WITHOUT ANY WARRANTY; without even the implied warranty of
 17+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 18+# See the GNU General Public License for more details.
 19+#
 20+# You should have received a copy of the GNU General Public License
 21+# along with emCORE. If not, see <http://www.gnu.org/licenses/>.
 22+#
 23+#
 24+
 25+# Builds the installers
 26+# Adjust the path below, it needs to point to the root of our svn tree
 27+# You also need a rockbox tree at the same level as our svn tree, that
 28+# includes builds for ipodnano2g and ipod6g, in build-ipodnano2g and
 29+# build-ipod6g, respectively.
 30+
 31+ROOT_PATH='/home/venci/freemyipod/'
 32+
 33+# what to build? builds the classic installer by default
 34+
 35+DIRS=(\
 36+ 'tools/ucl' \
 37+ 'tools/elf2emcoreapp' \
 38+ 'apps/installer-ipodclassic' \
 39+)
 40+# 'apps/installer-ipodnano2g' \
 41+
 42+# end of configuration
 43+
 44+cd "${ROOT_PATH}" || exit 1
 45+
 46+for i in $(seq 0 $[${#DIRS[@]} - 1])
 47+do
 48+ echo '== [begin] '"${DIRS[${i}]}"': make clean =='
 49+
 50+ cd "${ROOT_PATH}${DIRS[${i}]}" && \
 51+ \
 52+ if [ 'apps/installer-ipodnano2g' = "${DIRS[${i}]}" ] \
 53+ || [ 'apps/installer-ipodclassic' = "${DIRS[${i}]}" ]
 54+ then
 55+ echo
 56+ #rm -vf 'flashfiles.built' && \
 57+ #find flashfiles -maxdepth 1 -type f |xargs rm -vrf
 58+ elif [ 'tools/elf2emcoreapp' = "${DIRS[${i}]}" ]
 59+ then
 60+ rm -vf '../arm-elf-eabi-elf2emcoreapp'
 61+ fi
 62+
 63+ echo '== [end] '"${DIRS[${i}]}"': make clean =='
 64+done
 65+
 66+cd "${ROOT_PATH}" || exit 2
 67+
 68+if [ -n "${1}" ]
 69+then
 70+ if [ '0' = "${1}" ]
 71+ then
 72+ exit
 73+ fi
 74+
 75+ svn -r "${1}" update || exit 3
 76+else
 77+ svn update || exit 3
 78+fi
 79+
 80+rm -vf "${ROOT_PATH}emcore/trunk/build/version.h"
 81+
 82+for i in $(seq 0 $[${#DIRS[@]} - 1])
 83+do
 84+ echo '== [begin] '"${DIRS[${i}]}"': make =='
 85+
 86+ cd "${ROOT_PATH}${DIRS[${i}]}" && \
 87+
 88+ if [ 'apps/installer-ipodnano2g' = "${DIRS[${i}]}" ]
 89+ then
 90+ make flashfiles && \
 91+ '../../tools/ucl2e10singleblk' '../../../rockbox/build-ipodnano2g/rockbox.ipod' 'flashfiles/rockbox.ipod.ucl' && \
 92+ make
 93+ elif [ 'apps/installer-ipodclassic' = "${DIRS[${i}]}" ]
 94+ then
 95+ make flashfiles && \
 96+ '../../tools/ucl2e10singleblk' '../../../rockbox/build-ipod6g/rockbox.ipod' 'flashfiles/rockbox.ipod.ucl' && \
 97+ make
 98+ elif [ 'tools/elf2emcoreapp' = "${DIRS[${i}]}" ]
 99+ then
 100+ #make
 101+ ln -vs 'elf2emcoreapp/arm-elf-eabi-elf2emcoreapp' '../'
 102+ else
 103+ make
 104+ fi
 105+
 106+ STATUSES[${i}]=$?
 107+
 108+ echo '== [end] '"${DIRS[${i}]}"': make =='
 109+done
 110+
 111+for i in $(seq 0 $[${#DIRS[@]} - 1])
 112+do
 113+ echo -n "${DIRS[${i}]}"': '
 114+
 115+ if [ -n "{STATUSES[${i}]}" ] && [ '0' = "${STATUSES[${i}]}" ]
 116+ then
 117+ echo 'SUCCESS!'
 118+ else
 119+ echo 'ERROR!'
 120+ fi
 121+done
Property changes on: tools/build-tree.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
 122+*
\ No newline at end of property