summaryrefslogtreecommitdiff
path: root/scripts/baserock-jetson-flash.sh
blob: 757943814f022d2a8f67940711e3f8e304d0ffcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

uboot_file=baserock/u-boot.bin
system_image=$1

if [[ $(id -u) != 0 ]]; then
    echo "Script must be run as root"
    exit
fi;

if [ ! -f "${uboot_file}" ]; then
    echo "Error: missing u-boot file $uboot_file"
    exit
fi;

if [ ! -f "${system_image}" ]; then
    echo "Error: missing system image"
    exit
fi;

if [ -f "bootloader/system.img" ]; then
    echo "Backup existing system image"
    cp bootloader/system.img bootloader/system.img.bak
fi;

ln -s $1 bootloader/system.img
echo "Flashing u-boot and baserock image to emmc"
ROOTFS_SIZE=15032385536 ./flash.sh -L baserock/u-boot.bin -r jetson-tk1 mmcblk0p1
echo "Finished flashing...."
rm bootloader/system.img
if [ -f "bootloader/system.img.bak" ]; then
    cp bootloader/system.img.bak bootloader/system.img
fi;