slitaz-arm rev 43

Add: tools/mksd.sh - A script to partition a 4Gb sdcard
author Christophe Lincoln <pankso@slitaz.org>
date Sun Mar 09 07:56:42 2014 +0100 (2014-03-09)
parents f4e0ff9dd9d3
children 5d870dbf2641
files tools/mksd.sh
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/mksd.sh	Sun Mar 09 07:56:42 2014 +0100
     1.3 @@ -0,0 +1,73 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# Sleep to avoid: "kernel still uses old table: Device or resource busy"
     1.7 +#
     1.8 +. /lib/libtaz.sh
     1.9 +check_root
    1.10 +
    1.11 +if [ ! "$dev" ]; then
    1.12 +	echo "Missing: --dev= cmdline option" && exit 1
    1.13 +fi
    1.14 +
    1.15 +# Boot
    1.16 +echo -n "Creating partition: /dev/${dev}1 /boot"
    1.17 +fdisk /dev/${dev} >/dev/null << EOF
    1.18 +o
    1.19 +n
    1.20 +p
    1.21 +1
    1.22 +1
    1.23 ++140M
    1.24 +w
    1.25 +EOF
    1.26 +status
    1.27 +
    1.28 +# Swap
    1.29 +echo -n "Creating partition: /dev/${dev}2 swap"
    1.30 +sleep 2
    1.31 +fdisk /dev/${dev} 2>&1 >/dev/null  << EOF
    1.32 +n
    1.33 +p
    1.34 +2
    1.35 +
    1.36 ++420M
    1.37 +w
    1.38 +EOF
    1.39 +status
    1.40 +
    1.41 +# Root
    1.42 +echo -n "Creating partition: /dev/${dev}3 / (root)"
    1.43 +sleep 2
    1.44 +fdisk /dev/${dev} 2>&1 >/dev/null << EOF
    1.45 +n
    1.46 +p
    1.47 +3
    1.48 +
    1.49 +
    1.50 +w
    1.51 +EOF
    1.52 +status
    1.53 +
    1.54 +# Boot flag
    1.55 +echo -n "Setting boot flag on: /dev/${dev}1"
    1.56 +sleep 2
    1.57 +fdisk /dev/${dev} 2>&1 >/dev/null << EOF
    1.58 +a
    1.59 +1
    1.60 +w
    1.61 +EOF
    1.62 +status
    1.63 +
    1.64 +# Mkfs 2>&1 >/dev/null
    1.65 +#if fdisk -l /dev/${dev} | grep "^/dev/${dev}1"; then
    1.66 +	#debug "Creating: /boot FAT32 filesystem"
    1.67 +	#mkdosfs -F 32 -v -l -n "RPi-boot" /dev/${dev}1 
    1.68 +#fi
    1.69 +#if fdisk -l /dev/${dev} | grep "^/dev/${dev}2"; then
    1.70 +	#debug "Creating: swap memory filesystem"
    1.71 +	#mkswap -L "RPi-swap" /dev/${dev}2
    1.72 +#fi
    1.73 +#if fdisk -l /dev/${dev} | grep "^/dev/${dev}3"; then
    1.74 +	#debug "Creating: root ext4 filesystem"
    1.75 +	#mkfs.ext4 -L "RPi-root" /dev/${dev}3
    1.76 +#fi