ath79: do not build TP-Link tiny images by default
[oweals/openwrt.git] / target / linux / imx6 / image / bootscript-ventana
1 echo "Gateworks Ventana OpenWrt Boot script v1.02"
2
3 # set some defaults
4 # set some defaults
5 test -n "$fs"    || fs=ext2
6 test -n "$disk"  || disk=0
7 setenv nextcon 0
8 setenv bootargs console=${console},${baudrate}
9 setenv loadaddr 10800000
10 setenv fdt_addr 18000000
11
12 # detect dtype by looking for kernel on media the bootloader
13 # has mounted (in order of preference: usb/mmc/sata)
14 #
15 # This assumes the bootloader has already started the respective subsystem
16 # or mounted the filesystem if appropriate to get to this bootscript
17 #
18 # To Speed up boot set dtype manually
19 if test -n "$dtype" ; then
20         echo "Using dtype from env: $dtype"
21 else
22         echo "Detecting boot device (dtype)..."
23         if ${fs}load usb ${disk}:1 ${loadaddr} ${bootdir}/uImage ; then
24                 dtype=usb
25         elif ${fs}load mmc ${disk}:1 ${loadaddr} ${bootdir}/uImage ; then
26                 dtype=mmc
27         elif ${fs}load sata ${disk}:1 ${loadaddr} ${bootdir}/uImage ; then
28                 dtype=sata
29         elif ubifsload ${loadaddr} ${bootdir}/uImage ; then
30                 dtype=nand
31         fi
32         echo "detected dtype:$dtype"
33 fi
34
35 echo "Booting from ${dtype}..."
36 if itest.s "x${dtype}" == "xnand" ; then
37         # fix partition name
38         #  OpenWrt kernel bug prevents partition name of 'rootfs' from booting
39         #  instead name the partition ubi which is what is looked for by
40         #  procd sysupgrade
41         mtdparts del rootfs && mtdparts add nand0 - ubi
42         echo "mtdparts:${mtdparts}"
43         setenv fsload ubifsload
44         setenv root "ubi0:ubi ubi.mtd=2 rootfstype=squashfs,ubifs"
45 else
46         setenv fsload "${fs}load ${dtype} ${disk}:1"
47         part uuid ${dtype} ${disk}:1 uuid
48         if test -z "${uuid}"; then
49                 # fallback to bootdev
50                 if test -n "$bootdev" ; then
51                         echo "Using bootdev from env: $bootdev"
52                 else
53                         if itest.s "x${dtype}" == "xmmc" ; then
54                                 bootdev=mmcblk0p1
55                         else
56                                 bootdev=sda1
57                         fi
58                 fi
59                 setenv root "root=/dev/${bootdev}"
60         else
61                 setenv root "root=PARTUUID=${uuid}"
62         fi
63         setenv root "$root rootfstype=${fs} rootwait rw"
64 fi
65
66 setenv bootargs "${bootargs}" "${root}" "${video}" "${extra}"
67 if ${fsload} ${loadaddr} ${bootdir}/uImage; then
68         if ${fsload} ${fdt_addr} ${bootdir}/${fdt_file}; then
69                 echo Loaded DTB from ${bootdir}/${fdt_file}
70                 test -n "$fixfdt" && run fixfdt
71                 bootm ${loadaddr} - ${fdt_addr}
72         elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file1}; then
73                 echo Loaded DTB from ${bootdir}/${fdt_file1}
74                 test -n "$fixfdt" && run fixfdt
75                 bootm ${loadaddr} - ${fdt_addr}
76         elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file2}; then
77                 echo Loaded DTB from ${bootdir}/${fdt_file2}
78                 test -n "$fixfdt" && run fixfdt
79                 bootm ${loadaddr} - ${fdt_addr}
80         else
81                 echo "Error loading device-tree"
82         fi
83 else
84         echo "Error loading kernel image"
85 fi