Skip to contentSkip to conversation

Building dtc etc. for packaging

DISCUSSION Matt Sealey 5 participants 5 messages Nov 11, 2008

lore
Share & tools
lore
#0 lore raw

For some of what we're doing with SUSE now I've determined we should really be packaging the device tree compiler (and libfdt) so that we can install and script it, along with some other stuff from U-Boot (not for this mail).

I was wondering if the recommended way would be to use the dtc found in the kernel-source or to use the git repo at git.jdl.com to grab it and build it. The one in the kernel is seemingly impossible to build without some tweaking around (I can't find a target for make that does it) so I also wonder about a hint here on what to do to create it from the kernel source so we can pull it out for a local system install.

(the other tool we need is mkimage from U-Boot, I noticed Debian uses this same command name inside jigdo etc. too, sigh.. also you can't build the tools without the rest of U-Boot which is hard to envision doing just to get one command out of it - "make tools/mkimage" doesn't work and I got tired of reverse engineering the chickenscratch..)

Signature · 2 lines
Matt Sealey <[email protected]>
Genesi, Manager, Developer Relations
#1 lore raw
Quoted 9 lines · Matt Sealey

(the other tool we need is mkimage from U-Boot, I noticed Debian uses this
same command name inside jigdo etc. too, sigh.. also you can't build the
tools without the rest of U-Boot which is hard to envision doing just to
get one command out of it - "make tools/mkimage" doesn't work and I got
tired of reverse engineering the chickenscratch..)

This is a bit off-topic, but here is my ugly hack to compile a statically linked 'mkimage' from the U-Boot tree:

Place this file, 'Makefile.mkimage' in u-boot/tools/ ---[snip]---
CFLAGS = -O2 -static -I../include -DUSE_HOSTCC -I. ASMDIR = ../include/asm

CFILES = ../lib_generic/crc32.c ../libfdt/fdt_strerror.c \
         ../lib_generic/sha1.c ../lib_generic/md5.c ../common/image.c \
         ../libfdt/fdt_wip.c ../libfdt/fdt.c ../libfdt/fdt_ro.c \
         ../libfdt/fdt_rw.c

mkimage: mkimage.c

        mv $(ASMDIR) $(ASMDIR).back
        ln -s $(ASMDIR)-i386 $(ASMDIR)
        gcc $(CFLAGS) $(CFILES) mkimage.c -o mkimage
        rm -f $(ASMDIR)
        mv $(ASMDIR).back $(ASMDIR)
        strip mkimage

default: mkimage
---[snip]---

Then just run 'make -f Makefile.mkimage' from within tools/. Of course this uses some nasty tricks that will only work on i386 host. I don't think I'm the first person to have this need, so others here may have better solutions.

Signature · 1 line
Nate Case <[email protected]>
#2 lore raw
In reply to Matt Sealey

Hi,

Quoted 5 lines · Matt Sealey

(the other tool we need is mkimage from U-Boot, I noticed Debian uses this same command name inside jigdo etc. too, sigh.. also you can't build the tools without the rest of U-Boot which is hard to envision doing just to get one command out of it - "make tools/mkimage" doesn't work and I got tired of reverse engineering the chickenscratch..)

I have a Debian package that basically just builds the tools into one binary package, and the source tarball into another.

Didn't upload it back then, but I can see if I can find the time to get it up to date.

Simon

#3 lore raw
In reply to Matt Sealey
Quoted 10 lines · Matt Sealey

For some of what we're doing with SUSE now I've determined we should really be packaging the device tree compiler (and libfdt) so that we can install and script it, along with some other stuff from U-Boot (not for this mail).

I was wondering if the recommended way would be to use the dtc found in the kernel-source or to use the git repo at git.jdl.com to grab it and build it. The one in the kernel is seemingly impossible to build without some tweaking around (I can't find a target for make that does it) so I also wonder about a hint here on what to do to create it from the kernel source so we can pull it out for a local system install.

Use the tree from jdl.org. Either the git tree if you really need an up-to-date snahpshot, or one of the actual release tarballs.

Apart from being the official upstream version, the tree there has make install targets, the full testsuite and other conveniences which will help for packaging.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#4 lore raw
Quoted 2 lines · David Gibson

Use the tree from jdl.org. Either the git tree if you really need an up-to-date snahpshot, or one of the actual release tarballs.

The tree from jdl.com will work better. :-)

jdl