]> git.siccegge.de Git - forks/vmdebootstrap.git/blob - examples/wandboard-uboot.sh
Exclude syslinux support when using grub
[forks/vmdebootstrap.git] / examples / wandboard-uboot.sh
1 #!/bin/sh
2
3 set -e
4
5 # This script is experimental and incomplete.
6
7 # Expects a tarball rootfs which includes a kernel, e.g.
8 # wandboard6q.sh --tarball wandboard.tgz
9 # wandboard-uboot.sh /dev/mmcblk0 wandboard.tgz
10
11 device=$1
12 tarball=$2
13
14 if [ -z "${device}" ]; then
15 echo "Block device not specified"
16 exit
17 fi
18
19 if [ ! -f "${device}" ]; then
20 echo "Specified device does not exist: ${device}"
21 exit
22 fi
23
24 if [ -z "${tarball}" ]; then
25 echo "Tarball not specified"
26 exit
27 fi
28
29 if [ ! -f '/usr/lib/u-boot/wandboard_quad/u-boot.imx' ]; then
30 echo "Unable to find wandboard u-boot file"
31 exit
32 fi
33
34 # u-boot needs to be dd'd to the device, not a partition
35 # but kpartx does not setup the device, just the partitions
36
37 sudo dd if=/dev/zero of=${device} bs=1M count=10
38 sudo dd if=/usr/lib/u-boot/wandboard_quad/u-boot.imx of=${device} seek=1 conv=fsync bs=1k
39 sudo sfdisk --in-order --Linux --unit M ${device} <<-__EOF__
40 1,,0x83,-
41 __EOF__
42 sudo mkfs.ext4 ${device}p1 -L rootfs
43
44 dir=`mktemp -d`
45 sudo mount ${Ddevice}p1 ${dir}
46 sudo tar -xzf ${tarball} -C ${dir}
47
48 # assumes a single partition deployment to SD card
49
50 ver=$(basename `find $rootdir/lib/modules/ -maxdepth 1 -mindepth 1 -type d`)
51 sudo touch ${dir}/uEnv.txt
52 sudo chmod 666 ${dir}/uEnv.txt
53 echo autoload=no > ${dir}/uEnv.txt
54 echo initrd_high=0xffffffff >> ${dir}/uEnv.txt
55 echo fdt_high=0xffffffff >> ${dir}/uEnv.txt
56 echo kernel_addr_r=0x11000000 >> ${dir}/uEnv.txt
57 echo initrd_addr_r=0x13000000 >> ${dir}/uEnv.txt
58 echo fdt_addr_r=0x12000000 >> ${dir}/uEnv.txt
59 echo mmcdev=0 >> ${dir}/uEnv.txt
60 echo mmcpart=1 >> ${dir}/uEnv.txt
61 echo ver=3.16.0-4-armmp >> ${dir}/uEnv.txt
62 echo loadkernel=load mmc ${mmcdev}:${mmcpart} ${kernel_addr_r} boot/vmlinuz-${ver} >> ${dir}/uEnv.txt
63 echo loadinitrd=load mmc ${mmcdev}:${mmcpart} ${initrd_addr_r} boot/initrd.img-${ver}.uboot; setenv initrd_size ${filesize} >> ${dir}/uEnv.txt
64 echo loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} boot/dtbs/imx6q-wandboard.dtb >> ${dir}/uEnv.txt
65 echo bootargs=console=ttymxc0,115200 root=/dev/mmcblk0p1 rootwait rw ip=dhcp >> ${dir}/uEnv.txt
66 echo uenvcmd=run loadkernel; run loadinitrd; run loadfdt; bootz ${kernel_addr_r} ${initrd_addr_r} ${fdt_addr_r} >> ${dir}/uEnv.txt
67 sudo chmod 644 ${dir}/uEnv.txt
68 sudo umount ${dir}
69 sudo rm -rf ${dir}