Re: Stand-alone DTB build fails

2014-04-26 Thread Warner Losh

On Apr 25, 2014, at 8:56 AM, Ron Brown  wrote:

> The FreeBSD Wiki at https://wiki.freebsd.org/FlattenedDeviceTree refers to
> building a dtb in the following manner:
> 
> --
>  On platforms capable of running loader(8) the default scenario is to use
>  a stand-alone DTB file, which is handled by the loader and handed over to
>  kernel at boot time. In this approach, a DTB should be created at kernel
>  build time:
> 
>  If FDT_DTS_FILE is specified in the kernel config file, the DTB is
>  compiled automatically as part of the buildkernel stage. The user does
>  not have to perform any explicit steps.
> 
>  If the default DTS file is not specified in the kernel config file, the
>  DTB needs to be created separately by the user with the builddtb target:
> 
>$ make builddtb FDT_DTS_FILE=mpc8572ds.dts
> --
> 
> However, this fails with:
>ERROR: Specified DTS File (zedboard.dts) does not exist!
> 
> This is because /usr/src/Makefile.inc1 uses the MACHINE environment
> variable to find FDT_DTS_FILE:
> 
> Starting at line 1836:
>if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${MACHINE}/${FDT_DTS_FILE} ]; ...
>echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
>exist!"; \
> 
> MACHINE refers to the currently running system, however most of the ARM
> development is cross-compiled and the zedboard .dts resides in the dts/arm
> directory while MACHINE points if to the dts/amd64 directory.
> Should Makefile.inc1 instead refer to TARGET or something similar?
> 
>if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${TARGET}/${FDT_DTS_FILE} ]; …


I just committed r264979:

 make_dtb.sh is designed to be used in a kernel build environment where
 MACHINE is defined to the target's value, not the host's
 value. However, in Makefile.inc1, it is still defined to be the host's
 value. Make the makedtb target work by expanding TARGET in the
 existance test, and passing MACHINE=$TARGET in the call to make_dtb.sh

which will fix the problem. At least it fixed the problem for me.

Warner

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Stand-alone DTB build fails

2014-04-25 Thread Warner Losh

On Apr 25, 2014, at 8:56 AM, Ron Brown  wrote:

> The FreeBSD Wiki at https://wiki.freebsd.org/FlattenedDeviceTree refers to
> building a dtb in the following manner:
> 
> --
>  On platforms capable of running loader(8) the default scenario is to use
>  a stand-alone DTB file, which is handled by the loader and handed over to
>  kernel at boot time. In this approach, a DTB should be created at kernel
>  build time:
> 
>  If FDT_DTS_FILE is specified in the kernel config file, the DTB is
>  compiled automatically as part of the buildkernel stage. The user does
>  not have to perform any explicit steps.
> 
>  If the default DTS file is not specified in the kernel config file, the
>  DTB needs to be created separately by the user with the builddtb target:
> 
>$ make builddtb FDT_DTS_FILE=mpc8572ds.dts
> --
> 
> However, this fails with:
>ERROR: Specified DTS File (zedboard.dts) does not exist!
> 
> This is because /usr/src/Makefile.inc1 uses the MACHINE environment
> variable to find FDT_DTS_FILE:
> 
> Starting at line 1836:
>if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${MACHINE}/${FDT_DTS_FILE} ]; ...
>echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
>exist!"; \
> 
> MACHINE refers to the currently running system, however most of the ARM
> development is cross-compiled and the zedboard .dts resides in the dts/arm
> directory while MACHINE points if to the dts/amd64 directory.
> Should Makefile.inc1 instead refer to TARGET or something similar?
> 
>if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${TARGET}/${FDT_DTS_FILE} ]; ...

I think this is a mistake, but the make_dtb script also makes a similar
mistake (because it expects to be called from a different context). I’ll
sort this out and post a patch.

Warner

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"