slitaz-arm view tools/mksd.sh @ 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
children de766d155dae
line source
1 #!/bin/sh
2 #
3 # Sleep to avoid: "kernel still uses old table: Device or resource busy"
4 #
5 . /lib/libtaz.sh
6 check_root
8 if [ ! "$dev" ]; then
9 echo "Missing: --dev= cmdline option" && exit 1
10 fi
12 # Boot
13 echo -n "Creating partition: /dev/${dev}1 /boot"
14 fdisk /dev/${dev} >/dev/null << EOF
15 o
16 n
17 p
18 1
19 1
20 +140M
21 w
22 EOF
23 status
25 # Swap
26 echo -n "Creating partition: /dev/${dev}2 swap"
27 sleep 2
28 fdisk /dev/${dev} 2>&1 >/dev/null << EOF
29 n
30 p
31 2
33 +420M
34 w
35 EOF
36 status
38 # Root
39 echo -n "Creating partition: /dev/${dev}3 / (root)"
40 sleep 2
41 fdisk /dev/${dev} 2>&1 >/dev/null << EOF
42 n
43 p
44 3
47 w
48 EOF
49 status
51 # Boot flag
52 echo -n "Setting boot flag on: /dev/${dev}1"
53 sleep 2
54 fdisk /dev/${dev} 2>&1 >/dev/null << EOF
55 a
56 1
57 w
58 EOF
59 status
61 # Mkfs 2>&1 >/dev/null
62 #if fdisk -l /dev/${dev} | grep "^/dev/${dev}1"; then
63 #debug "Creating: /boot FAT32 filesystem"
64 #mkdosfs -F 32 -v -l -n "RPi-boot" /dev/${dev}1
65 #fi
66 #if fdisk -l /dev/${dev} | grep "^/dev/${dev}2"; then
67 #debug "Creating: swap memory filesystem"
68 #mkswap -L "RPi-swap" /dev/${dev}2
69 #fi
70 #if fdisk -l /dev/${dev} | grep "^/dev/${dev}3"; then
71 #debug "Creating: root ext4 filesystem"
72 #mkfs.ext4 -L "RPi-root" /dev/${dev}3
73 #fi