[Buildroot] [PATCH v1 1/4] board/zynqmp/post-build.sh: auto-generate extlinux.conf

Neal Frager nealf at xilinx.com
Wed May 25 13:33:29 UTC 2022


Hi Luca,

>     FILE="${BOARD_DIR}/extlinux.conf"
>     if test -f "$FILE"; then
>         install -m 0644 -D "${BOARD_DIR}/extlinux.conf" "${BINARIES_DIR}/extlinux.conf"

> Right, but use "${FILE}" after -D.

I just want to make sure I am not missing something.  I have changed the script to the following:

if test -f "${FILE}"; then
         install -m 0644 -D "${BOARD_DIR}/extlinux.conf" "${BINARIES_DIR}/extlinux.conf"

Is there another -D I need to add somewhere?

>     else
>         mkdir -p "${BINARIES_DIR}"
>         cat <<-__HEADER_EOF >"${BINARIES_DIR}/extlinux.conf"
>     TAB>label linux
>     TAB>  kernel /Image
>     TAB>  devicetree /system.dtb
>     TAB>  append console=${CONSOLE} root=/dev/${ROOT} rw rootwait
>     TAB>__HEADER_EOF
>     fi
>
> Note: the <<- rediretion removes leading TABs, so it is allows a nicer 
> indentation (so, replace TAB> above with an actual TAB, of course).

> It's amazing how I always have some more shell trick to learn from Yann! :-D

Yes, I am learning a lot too!

> Also, please always evaluate variables using curly braces and quote the
> expansion, like so:   "${foo}"   (in the here-document, quotes are not
> needed, of course).
>
> Eventualy, at the end of this series, the script will always be used 
> for boards that do not already have an extlinux.conf, the condition 
> can be dropped in a final patch, to just only keep the else part of 
> the condition, don't you think?

Best regards,
Neal Frager
AMD


More information about the buildroot mailing list