diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2014-08-29 14:56:44 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2014-08-29 14:57:08 +0200 |
commit | bd1e437e98d01d95929c91f5000605fb37f26982 (patch) | |
tree | dcf623efd059d3ceb6b7c07de8c446fa9e41f28f /scripts | |
parent | 9ce65704f643d47cca296bd3ab802036863a9774 (diff) |
add support for data partition
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/install-solidrun.sh | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/scripts/install-solidrun.sh b/scripts/install-solidrun.sh index 262532815..1e427c99f 100755 --- a/scripts/install-solidrun.sh +++ b/scripts/install-solidrun.sh @@ -81,26 +81,58 @@ fi maxsize=$(env LC_ALL=C parted $1 -s unit s print |awk '/^Disk/ { print $3 }'|sed -e 's/s//') maxsize=$(($maxsize-1)) -rootsize=$(($maxsize-32768)) -rootsizeend=$(($rootsize+1)) + +if [ $datadir -eq 0 ];then + rootsize=$(($maxsize-32768)) + rootsizeend=$(($rootsize+1)) +else + rootsize=$(($maxsize-32768-131072)) + datasize=$(($maxsize-32768)) + datasizeend=$(($datasize+1)) +fi echo "Install bootloader for cubox-i/hummingboard" parted -s $1 mklabel msdos >/dev/null 2>&1 dd if=${3}/SPL of=${1} bs=1K seek=1 >/dev/null 2>&1 dd if=${3}/u-boot.img of=${1} bs=1K seek=42 >/dev/null 2>&1 -parted -a optimal -s $1 unit s mkpart primary ext2 -- 2048 $rootsize >/dev/null 2>&1 -parted -a optimal -s $1 unit s mkpart primary fat32 $rootsizeend $maxsize >/dev/null 2>&1 -sfdisk --change-id $1 2 88 >/dev/null 2>&1 +if [ $datadir -eq 0 ];then + parted -a optimal -s $1 unit s mkpart primary ext2 -- 2048 $rootsize >/dev/null 2>&1 + parted -a optimal -s $1 unit s mkpart primary fat32 -- $rootsizeend $maxsize + sfdisk --change-id $1 2 88 >/dev/null 2>&1 +else + parted -a optimal -s $1 unit s mkpart primary ext2 -- 2048 $rootsize >/dev/null 2>&1 + parted -a optimal -s $1 unit s mkpart primary ext2 -- $rootsize $datasize >/dev/null 2>&1 + parted -a optimal -s $1 unit s mkpart primary fat32 -- $datasizeend $maxsize + sfdisk --change-id $1 3 88 >/dev/null 2>&1 + +fi echo "Creating filesystem" mkfs.ext4 -F -q -O ^huge_file ${1}1 sync +if [ $datadir -eq 1 ];then + if [ $keep -eq 0 ];then + mkfs.ext4 -F -q -O ^huge_file ${1}2 + fi +fi tmp=$(mktemp -d) mount -t ext4 ${1}1 $tmp +if [ $datadir -eq 1 ];then + if [ $keep -eq 0 ];then + mkdir $tmp/data + mount -t ext4 ${1}2 $tmp/data + mkdir $tmp/data/mpd $tmp/data/xbmc + umount $tmp/data + fi +fi + echo "Extracting install archive" tar -C $tmp -xzpf $2 +if [ $datadir -eq 1 ];then + echo "/dev/mmcblk0p2 /data ext4 rw 0 0" >>$tmp/etc/fstab +fi echo "Fixing permissions" chmod 1777 $tmp/tmp chmod 4755 $tmp/bin/busybox |