[build] add cvitek build scripts
Change-Id: If63ce4a669e5d4d72b8e3b9253336dd99bf74c30
This commit is contained in:
65
build/tools/common/sd_tools/expect_fdisk.exp
Executable file
65
build/tools/common/sd_tools/expect_fdisk.exp
Executable file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/expect
|
||||
|
||||
set timeout 60
|
||||
|
||||
if {$argc != 3} {
|
||||
send "usage expect_fdisk \[size\] \n"
|
||||
exit
|
||||
}
|
||||
|
||||
set device [lindex $argv 0]
|
||||
set fat32_size +[lindex $argv 1]
|
||||
set ext4_size +[lindex $argv 2]
|
||||
|
||||
send_user "args: $device $fat32_size $ext4_size \n"
|
||||
|
||||
spawn fdisk $device
|
||||
expect -re "Command"
|
||||
|
||||
while {1} {
|
||||
send "d\r"
|
||||
expect -re "default" {
|
||||
send "\r"
|
||||
expect -re "deleted"
|
||||
} -re "deleted" {
|
||||
continue
|
||||
} -re "No partition" {
|
||||
expect -re "Command"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
send "o\r"
|
||||
expect -re "Command"
|
||||
|
||||
send "n\r"
|
||||
expect -re "Partition type"
|
||||
|
||||
send "p\r"
|
||||
expect -re "Partition number"
|
||||
|
||||
send "\r"
|
||||
expect -re "First sector"
|
||||
|
||||
send "\r"
|
||||
expect -re "Last sector"
|
||||
send "$fat32_size\r"
|
||||
expect -re "Command"
|
||||
|
||||
send "n\r"
|
||||
expect -re "Partition type"
|
||||
|
||||
send "p\r"
|
||||
expect -re "Partition number"
|
||||
|
||||
send "\r"
|
||||
expect -re "First sector"
|
||||
|
||||
send "\r"
|
||||
expect -re "Last sector"
|
||||
send "$ext4_size\r"
|
||||
expect -re "Command"
|
||||
|
||||
send "w\r"
|
||||
expect eof
|
||||
|
||||
43
build/tools/common/sd_tools/sd_creat_rootfs.sh
Executable file
43
build/tools/common/sd_tools/sd_creat_rootfs.sh
Executable file
@ -0,0 +1,43 @@
|
||||
if [ "$#" -ne "1" ]
|
||||
then
|
||||
echo "usage: sudo ./sd_creat_rootfs.sh /dev/mmc0blkX"
|
||||
echo ""
|
||||
echo " The script is used to create two sd boot partitions, "
|
||||
echo " one is fat32 with 128M, the other is ext4 with 3072M."
|
||||
echo " You can modify the capacities in this script as you wish!"
|
||||
echo ""
|
||||
echo "Note: Please backup you sdcard files before using this script!"
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
LANGUAGE=en_US
|
||||
LANG=en_US.UTF-8
|
||||
|
||||
basepath=$(dirname $0)
|
||||
device=$1
|
||||
vfat_part=${device}p1
|
||||
vfat_cap="128M"
|
||||
vfat_label="IMAGES"
|
||||
|
||||
ext4_part=${device}p2
|
||||
ext4_cap="3072M"
|
||||
ext4_label="rootfs"
|
||||
|
||||
echo "umount ${device}p*"
|
||||
umount ${device}p*
|
||||
$basepath/expect_fdisk.exp $device $vfat_cap $ext4_cap
|
||||
|
||||
echo "mkfs.vfat $vfat_part"
|
||||
mkfs.vfat $vfat_part
|
||||
echo "mlabel -i $vfat_part ::$vfat_label"
|
||||
mlabel -i $vfat_part ::$vfat_label
|
||||
echo "mkfs.ext4 $ext4_part -F"
|
||||
mkfs.ext4 $ext4_part -F
|
||||
echo "e2label $ext4_part $ext4_label"
|
||||
e2label $ext4_part $ext4_label
|
||||
|
||||
|
||||
sync
|
||||
|
||||
exit
|
||||
43
build/tools/common/sd_tools/sd_creat_rootfs_mmc.sh
Executable file
43
build/tools/common/sd_tools/sd_creat_rootfs_mmc.sh
Executable file
@ -0,0 +1,43 @@
|
||||
if [ "$#" -ne "1" ]
|
||||
then
|
||||
echo "usage: sudo ./sd_creat_rootfs.sh /dev/mmc0blkX"
|
||||
echo ""
|
||||
echo " The script is used to create two sd boot partitions, "
|
||||
echo " one is fat32 with 128M, the other is ext4 with 3072M."
|
||||
echo " You can modify the capacities in this script as you wish!"
|
||||
echo ""
|
||||
echo "Note: Please backup you sdcard files before using this script!"
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
LANGUAGE=en_US
|
||||
LANG=en_US.UTF-8
|
||||
|
||||
basepath=$(dirname $0)
|
||||
device=$1
|
||||
vfat_part=${device}p1
|
||||
vfat_cap="128M"
|
||||
vfat_label="IMAGES"
|
||||
|
||||
ext4_part=${device}p2
|
||||
ext4_cap="3072M"
|
||||
ext4_label="rootfs"
|
||||
|
||||
echo "umount ${device}p*"
|
||||
umount ${device}p*
|
||||
$basepath/expect_fdisk.exp $device $vfat_cap $ext4_cap
|
||||
|
||||
echo "mkfs.vfat $vfat_part"
|
||||
mkfs.vfat $vfat_part
|
||||
echo "mlabel -i $vfat_part ::$vfat_label"
|
||||
mlabel -i $vfat_part ::$vfat_label
|
||||
echo "mkfs.ext4 $ext4_part -F"
|
||||
mkfs.ext4 $ext4_part -F
|
||||
echo "e2label $ext4_part $ext4_label"
|
||||
e2label $ext4_part $ext4_label
|
||||
|
||||
|
||||
sync
|
||||
|
||||
exit
|
||||
43
build/tools/common/sd_tools/sd_creat_rootfs_sd.sh
Executable file
43
build/tools/common/sd_tools/sd_creat_rootfs_sd.sh
Executable file
@ -0,0 +1,43 @@
|
||||
if [ "$#" -ne "1" ]
|
||||
then
|
||||
echo "usage: sudo ./sd_creat_rootfs_sd.sh /dev/sdX"
|
||||
echo ""
|
||||
echo " The script is used to create two sd boot partitions, "
|
||||
echo " one is fat32 with 128M, the other is ext4 with 3072M."
|
||||
echo " You can modify the capacities in this script as you wish!"
|
||||
echo ""
|
||||
echo "Note: Please backup you sdcard files before using this script!"
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
LANGUAGE=en_US
|
||||
LANG=en_US.UTF-8
|
||||
|
||||
basepath=$(dirname $0)
|
||||
device=$1
|
||||
vfat_part=${device}1
|
||||
vfat_cap="128M"
|
||||
vfat_label="IMAGES"
|
||||
|
||||
ext4_part=${device}2
|
||||
ext4_cap="3072M"
|
||||
ext4_label="rootfs"
|
||||
|
||||
echo "umount ${device}*"
|
||||
umount ${device}*
|
||||
$basepath/expect_fdisk.exp $device $vfat_cap $ext4_cap
|
||||
|
||||
echo "mkfs.vfat $vfat_part"
|
||||
mkfs.vfat $vfat_part
|
||||
echo "mlabel -i $vfat_part ::$vfat_label"
|
||||
mlabel -i $vfat_part ::$vfat_label
|
||||
echo "mkfs.ext4 $ext4_part -F"
|
||||
mkfs.ext4 $ext4_part -F
|
||||
echo "e2label $ext4_part $ext4_label"
|
||||
e2label $ext4_part $ext4_label
|
||||
|
||||
|
||||
sync
|
||||
|
||||
exit
|
||||
Reference in New Issue
Block a user