[U-Boot] Question about board-specific Makefile actions

Simon Glass sjg at chromium.org
Mon Mar 9 19:49:44 CET 2015


Hi,

On 9 March 2015 at 08:54, Tom Rini <trini at konsulko.com> wrote:
> On Tue, Mar 03, 2015 at 01:39:35PM -0800, James Chargin wrote:
>> I have a custom board in a git workspace for U-Boot 2014.07. I've
>> copied most of this from the .../board/ti/beagle. My board directory
>> Makefile looks like
>>
>> 8<---
>> obj-y := board.o
>> 8<---
>>
>> I'd like to add a few files to this directory that are processed
>> during "make all" and have any newly derived files deleted during
>> "make clean".
>>
>> I've experimented with various Makefile contents but I can't get the
>> new files processed or any newly derived files deleted. U-Boot's
>> makefile system is quite large for my experience level and it seems
>> I don't have enough understanding.
>>
>> A new file might contain some hush commands that are to be executed
>> from the U-Boot command line. I'd like to use "source" to process
>> these commands. The "source" command requires that its argument be
>> an image (I get this into memory via TFTP), so I'd like "make all"
>> to transform the text file containing the hush commands into the
>> image file. I'd also like "make clean" to delete the derived image
>> file.
>>
>> So, if my hush commands are in a text file called test.txt, I'd like
>> "make all" to apply mkimage so that a test.img is generated. I'd
>> also like "make clean" to delete test.img.
>>
>> I tried various changes to my Makefile, but the most likely seeming
>> changes are
>>
>> 8<---
>> IMG  = test.img
>>
>> obj-y := board.o
>>
>> board.o : $(IMG)
>>
>> %.img : %.txt
>>       $(srctree)/tools/mkimage -T script -n $* -C none -d $< $@
>>
>> CLEAN_FILES += $(IMG)
>> CLEAN_DIRS  += .
>> 8<---
>>
>> This doesn't work, nor has any other approach I've taken. mkimage is
>> never run for "make all" and test.img doesn't get deleted if I
>> create a fake one and run "make clean"
>>
>> Could someone offer a solution, either directly, or by pointing at
>> an existing board that does something similar?
>
> Off the top of my head, try throwing test.img into obj-y ?

Also you may want to add a command like cmd_img_txt (see Makefile.lib
for examples). Did you need to add anything to ALL-y?

Another option is to put this outside the U-Boot build system, and
just run mkimage later.

Regards,
Simon


More information about the U-Boot mailing list