87757336989bafa6f8313a8221298bb4c298a03c
[openwrt/staging/wigyori.git] / target / linux / imx6 / image / bootscript-ventana
1 echo "Gateworks Ventana OpenWrt Boot script v1.00"
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 and bootdev 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 if test -n "$bootdev" ; then
35 echo "Using bootdev from env: $bootdev"
36 else
37 if itest.s "x${dtype}" == "xmmc" ; then
38 bootdev=mmcblk0
39 else
40 bootdev=sda
41 fi
42 fi
43
44 if itest.s "x${dtype}" == "xnand" ; then
45 echo "Booting from NAND..."
46 # fix partition name
47 # OpenWrt kernel bug prevents partition name of 'rootfs' from booting
48 # instead name the partition ubi which is what is looked for by
49 # procd sysupgrade
50 mtdparts del rootfs && mtdparts add nand0 - ubi
51 echo "mtdparts:${mtdparts}"
52 setenv fsload ubifsload
53 setenv root "ubi0:ubi ubi.mtd=2 rootfstype=squashfs,ubifs"
54 else
55 echo "Booting from block device ${bootdev}..."
56 setenv fsload "${fs}load ${dtype} ${disk}:1"
57 setenv root "root=/dev/${bootdev}"
58 fi
59
60 setenv bootargs "${bootargs}" "${root}" "${video}" "${extra}"
61 if ${fsload} ${loadaddr} ${bootdir}/uImage; then
62 if ${fsload} ${fdt_addr} ${bootdir}/${fdt_file}; then
63 echo Loaded DTB from ${bootdir}/${fdt_file}
64 bootm ${loadaddr} - ${fdt_addr}
65 elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file1}; then
66 echo Loaded DTB from ${bootdir}/${fdt_file1}
67 bootm ${loadaddr} - ${fdt_addr}
68 elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file2}; then
69 echo Loaded DTB from ${bootdir}/${fdt_file2}
70 bootm ${loadaddr} - ${fdt_addr}
71 else
72 echo "Error loading device-tree"
73 fi
74 else
75 echo "Error loading kernel image"
76 fi