post-build.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/sh -x
  2. # genimage will need to find the extlinux.conf
  3. # in the binaries directory
  4. die() {
  5. cat <<EOF >&2
  6. Error: $@
  7. Usage: ${0} -c <console> -r <root> [-x <extra-args>]
  8. EOF
  9. exit 1
  10. }
  11. o='c:d:l:r:x:'
  12. O='console:,devicetree:,label:,root:,extra-args:'
  13. opts="$(getopt -n "${0##*/}" -o "${o}" -l "${O}" -- "${@}")"
  14. eval set -- "${opts}"
  15. while [ ${#} -gt 0 ]; do
  16. case "${1}" in
  17. (-c|--console)
  18. CONSOLE="${2}"; shift 2
  19. ;;
  20. (-d|--devicetree)
  21. DEVICETREE="${2}"; shift 2
  22. ;;
  23. (-l|--label)
  24. LABEL="${2}"; shift 2
  25. ;;
  26. (-r|--root)
  27. ROOT="${2}"; shift 2
  28. ;;
  29. (-x|--extra-args)
  30. EXTRA_ARGS="${2}"; shift 2
  31. ;;
  32. (--)
  33. shift 1; break
  34. ;;
  35. esac
  36. done
  37. [ -n "${CONSOLE}" ] || die "Missing \`console' argument"
  38. [ -n "${DEVICETREE}" ] || die "Missing \`devicetree' argument"
  39. [ -n "${LABEL}" ] || die "Missing \`label' argument"
  40. [ -n "${ROOT}" ] || die "Missing \`root' argument"
  41. append="console=${CONSOLE} root=${ROOT} rw rootfstype=ext4 rootwait"
  42. if [ -n "${EXTRA_ARGS}" ]; then
  43. append="${append} ${EXTRA_ARGS}"
  44. fi
  45. mkdir -p "${BINARIES_DIR}"
  46. cat <<-__HEADER_EOF > "${BINARIES_DIR}/extlinux.conf"
  47. label ${LABEL}
  48. kernel /Image
  49. fdtdir /
  50. devicetree /${DEVICETREE}
  51. append ${append}
  52. __HEADER_EOF