bootscript-ventana 2.3 KB

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