turris-mox.bootscript 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. if part uuid ${devtype} ${devnum}:${distro_bootpart} bootuuid; then
  2. if test "${bootfstype}" = "btrfs"; then
  3. # Original BTRFS partition layout
  4. rootdev="PARTUUID=${bootuuid}"
  5. rootflags="commit=5,subvol=@"
  6. bootpath="/@/boot"
  7. else
  8. # OpenWrt default ext4 bootpart + rootpart layout
  9. rootdev="/dev/mmcblk0p2"
  10. rootflags="commit=5"
  11. bootpath="/"
  12. fi
  13. load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${bootpath}/armada-3720-turris-mox.dtb
  14. if test "$filesize" != "0"; then
  15. has_dtb=1
  16. else
  17. setenv has_dtb 0
  18. echo "Cannot find device tree binary!"
  19. fi
  20. if test $has_dtb -eq 1; then
  21. load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ${bootpath}/Image
  22. if test "$filesize" = "0"; then
  23. echo "Failed to load ${bootpath}/Image"
  24. echo "Now trying ${bootpath}/Image.lzma"
  25. tmp_addr_r=0x10000000
  26. load ${devtype} ${devnum}:${distro_bootpart} ${tmp_addr_r} ${bootpath}/Image.lzma
  27. if test "$filesize" != "0"; then
  28. if lzmadec ${tmp_addr_r} ${kernel_addr_r}; then
  29. echo "Successfully decompressed Image.lzma"
  30. else
  31. echo "Failed decompressing Image.lzma"
  32. filesize=0
  33. fi
  34. else
  35. echo "Failed to load ${subvol}/boot/Image.lzma"
  36. fi
  37. fi
  38. if test "$filesize" != "0"; then
  39. setenv bootargs "earlyprintk console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000 rootfstype=${bootfstype} root=${rootdev} rootflags=${rootflags} rootwait ${contract} rw cfg80211.freg=${regdomain} ${quirks}"
  40. booti ${kernel_addr_r} - ${fdt_addr_r}
  41. echo "Booting Image failed"
  42. else
  43. echo "Cannot load kernel binary"
  44. fi
  45. fi
  46. env delete bootuuid rootpart
  47. fi