bootscript-ventana 2.5 KB

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