Debian Codegraph @

bootscript/armhf/bootscr.sunxi

raw
1 # boot script for Allwinner SunXi-based devices
2
3 # Mainline u-boot v2014.10 introduces a new default environment and
4 # a new common bootcmd handling for all platforms, which is not fully
5 # compatible with the old-style environment used by u-boot-sunxi.
6 # This script therefore needs to check in which environment it
7 # is running and set some variables accordingly.
8
9 # On u-boot-sunxi, this script assumes that ${device} and ${partition}
10 # are set.
11
12 # The new-style environment predefines ${boot_targets}, the old-style
13 # environment does not.
14 if test -n "${boot_targets}"
15 then
16 echo "Mainline u-boot / new-style environment detected."
17 # Mainline u-boot v2014.10 uses ${devtype}, ${devnum} and
18 # ${bootpart} where u-boot-sunxi uses ${device} and ${partition}.
19 # ${distro_bootpart} replaced ${bootpart} in u-boot v2016.01.
20 if test -z "${device}"; then setenv device "${devtype}"; fi
21 if test -z "${partition}${distro_bootpart}"; then setenv partition "${devnum}:${bootpart}"; fi
22 if test -z "${partition}"; then setenv partition "${devnum}:${distro_bootpart}"; fi
23 else
24 echo "U-boot-sunxi / old-style environment detected."
25 # U-boot-sunxi does not predefine kernel_addr_r, fdt_addr_r and
26 # ramdisk_addr_r, so they have to be manually set. Use the values
27 # from mainline u-boot v2014.10, except for ramdisk_addr_r,
28 # which is set to 0x44300000 to allow for initrds larger than
29 # 13MB on u-boot-sunxi.
30 setenv kernel_addr_r 0x42000000
31 setenv fdt_addr_r 0x43000000
32 setenv ramdisk_addr_r 0x44300000
33 fi
34
35 if test -n "${console}"; then
36 setenv bootargs "${bootargs} console=${console}"
37 fi
38
39 setenv bootargs @@LINUX_KERNEL_CMDLINE_DEFAULTS@@ ${bootargs} @@LINUX_KERNEL_CMDLINE@@
40 @@UBOOT_ENV_EXTRA@@
41
42 if test -z "${image_locations}"; then
43 setenv image_locations ${prefix}
44 fi
45 if test -z "${image_locations}"; then
46 setenv image_locations /boot/ /
47 fi
48
49 if test -z "${fk_kvers}"; then
50 setenv fk_kvers '@@KERNEL_VERSION@@'
51 fi
52
53 if test -n "${fdtfile}"; then
54 setenv fdtpath dtbs/${fk_kvers}/${fdtfile}
55 else
56 setenv fdtpath dtb-${fk_kvers}
57 fi
58
59 for pathprefix in ${image_locations}
60 do
61 if test -e ${device} ${partition} ${pathprefix}vmlinuz-${fk_kvers}
62 then
63 load ${device} ${partition} ${kernel_addr_r} ${pathprefix}vmlinuz-${fk_kvers} \
64 && load ${device} ${partition} ${fdt_addr_r} ${pathprefix}${fdtpath} \
65 && load ${device} ${partition} ${ramdisk_addr_r} ${pathprefix}initrd.img-${fk_kvers} \
66 && echo "Booting Debian ${fk_kvers} from ${device} ${partition}..." \
67 && bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
68 fi
69 done