Question about board-specific Makefile actions
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?
Thanks
Jim
Signature · 3 lines
Jim Chargin AJA Video Systems [email protected] (530) 271-3334 http://www.aja.com
So, is no one willing to offer a hint?
Thanks,
Jim
Quoted 54 lines · James Chargin
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
Makefilelooks like8<---
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
Makefilecontents 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 are8<---
IMG = test.imgobj-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?
Thanks
Jim
Signature · 3 lines
Jim Chargin AJA Video Systems jimc at aja.com (530) 271-3334 http://www.aja.com
I could still use some help with this from someone who really knows how the make system works.
Tom and Simon provided hints that were helpful, as I note below.
Quoted 56 lines · James Chargin
So, is no one willing to offer a hint?
Thanks,
JimQuoted 50 lines · James Chargin
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
Makefilelooks like8<---
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
Makefilecontents 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 are8<---
IMG = test.imgobj-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?
Quoted 3 lines · Tom Rini
Off the top of my head, try throwing test.img into obj-y ?
Adding text.img to obj-y did cause the .img file to get generated, but it also added text.img to the list of files supplied to ld, causing the final u-boot link to fail
Quoted 2 lines · Simon Glass
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?
Your mention of Makefile.lib prompted my to look there for other targets I might use. I discovered extra-y and adding
extra-y := test.img
to my board's Makefile caused the correct operations.
As you suggest, I added cmd_my_mkimage, which while not actually needed, is a very nice way to have a non-verbose progress report in the make output.
Quoted 2 lines
Another option is to put this outside the U-Boot build system, and just run mkimage later.
I really want these steps to be part of the normal board make. Requiring a separate manual build step will inevitably result in that separate step being forgotten (most probably by me).
Is there any documentation you could point me at that might explain the way these Makefiles interact? I know most of this was derived from somewhere else (Linux kernel?) as part of the move to KConfig. But I have no experience with the kernel build system and following make's debug output is difficult, at best. Some overview of how makes are done would be quite helpful to me and maybe to other non-U-Boot-developers.
Remaining problems:
1) I can't figure out how to clean my newly created derived .img file. I've tried each of the following four lines (one at a time), but none worked CLEAN_FILES += board/aja/helo/helo_setupdeveloper.img CLEAN_FILES += test.imgCLEAN_FILES := test.img
clean-files += test.img
clean-files := test.img
2) More generally, I'd like to be able to add some arbitrary make steps that are peculiar to my boards Makefile, but I can't figure this out either, so far.
I've tried adding my_all to extra-y and then adding steps for my_all, similar to the following.
8<---
extra-y := test.img my_all
.PHONY my_allmy_all : test1.txt
# some arbitrary commands to be executed if test1.txt isn't present cp -f test.txt test1.txt 8<---
In this case, make reports an error
make[1]: *** No rule to make target board/my_board/my_all', needed by __build'. Stop.
make: *** [board/my_board] Error 2
Any help would be appreciated.
Thanks,
Jim
+Masahiro
Hi James,
Quoted 103 lines · James Chargin
I could still use some help with this from someone who really knows how the make system works.
Tom and Simon provided hints that were helpful, as I note below.
Quoted 58 lines · James Chargin
So, is no one willing to offer a hint?
Thanks,
JimQuoted 51 lines · James Chargin
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
Makefilelooks like8<---
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
Makefilecontents 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 are8<---
IMG = test.imgobj-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?
Quoted 4 lines · Tom Rini
Off the top of my head, try throwing test.img into obj-y ?
Adding text.img to obj-y did cause the .img file to get generated, but it also added text.img to the list of files supplied to ld, causing the final u-boot link to fail
Quoted 2 lines · Simon Glass
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?Your mention of Makefile.lib prompted my to look there for other targets I might use. I discovered extra-y and adding
extra-y := test.img
to my board's
Makefilecaused the correct operations.As you suggest, I added
cmd_my_mkimage, which while not actually needed, is a very nice way to have a non-verbose progress report in the make output.Quoted 2 lines
Another option is to put this outside the U-Boot build system, and just run mkimage later.
I really want these steps to be part of the normal board make. Requiring a separate manual build step will inevitably result in that separate step being forgotten (most probably by me).
Quoted 6 lines
Is there any documentation you could point me at that might explain the way these Makefiles interact? I know most of this was derived from somewhere else (Linux kernel?) as part of the move to KConfig. But I have no experience with the kernel build system and following make's debug output is difficult, at best. Some overview of how makes are done would be quite helpful to me and maybe to other non-U-Boot-developers.
Yes it is called Kbuild. You could try this:
https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt
Quoted 4 lines
Remaining problems:
Quoted 8 lines
1) I can't figure out how to clean my newly created derived .img file. I've tried each of the following four lines (one at a time), but none worked
CLEAN_FILES+= board/aja/helo/helo_setupdeveloper.imgCLEAN_FILES+= test.imgCLEAN_FILES:= test.img
clean-files += test.img
clean-files := test.img
You could try adding
$(warning CLEAN_FILES is $(CLEAN_FILES))
in a few places in the Makefile.
Quoted 17 lines
2) More generally, I'd like to be able to add some arbitrary make steps that are peculiar to my boards
Makefile, but I can't figure this out either, so far.I've tried adding
my_allto extra-y and then adding steps formy_all, similar to the following.8<---
extra-y := test.imgmy_all.PHONY
my_allmy_all: test1.txt# some arbitrary commands to be executed if test1.txt isn't present cp -f test.txt test1.txt 8<---
Quoted 7 lines
In this case, make reports an error
make[1]: *** No rule to make target
board/my_board/my_all', needed by__build'. Stop.
make: *** [board/my_board] Error 2Any help would be appreciated.
Maybe:
targets += test1.txt
Masahiro may know about this one.
Regards,
Simon
Hi Simon,
2015-03-13 3:55 GMT+09:00 Simon Glass <[email protected]>:
Quoted 23 lines
Quoted 23 lines
2) More generally, I'd like to be able to add some arbitrary make steps that are peculiar to my boards
Makefile, but I can't figure this out either, so far.I've tried adding
my_allto extra-y and then adding steps formy_all, similar to the following.8<---
extra-y := test.imgmy_all.PHONY
my_allmy_all: test1.txt# some arbitrary commands to be executed if test1.txt isn't present cp -f test.txt test1.txt 8<---In this case, make reports an error
make[1]: *** No rule to make target
board/my_board/my_all', needed by__build'. Stop.
make: *** [board/my_board] Error 2
Quoted 6 lines
Quoted 1 line
Any help would be appreciated.
Maybe:
targets += test1.txt
"targets" is necessary for including ".*.cmd" files, so it has nothing to do with the error here.
Moreover, as $(extra-y) is automatically added to "targets", you need not touch "targets" in most cases.
Signature · 2 lines
Best Regards Masahiro Yamada
Hi James,
2015-03-13 3:35 GMT+09:00 James Chargin <[email protected]>:
Quoted 57 lines
I could still use some help with this from someone who really knows how the make system works.
Tom and Simon provided hints that were helpful, as I note below.
Quoted 50 lines · James Chargin
So, is no one willing to offer a hint?
Thanks,
JimQuoted 43 lines · James Chargin
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
Makefilelooks like8<---
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
Makefilecontents 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 are8<---
IMG = test.imgobj-y := board.o
board.o : $(IMG)%.img : %.txt
$(srctree)/tools/mkimage -T script -n $* -C none -d $< $@
CLEAN_FILES+= $(IMG)CLEAN_DIRS+= .
8<---
I assume you put these lines into your own board/my_board/Makefile.
You cannot use CLEAN_FILES, CLEAN_DIRS in sub-directory Makefiles. They are only available@the top-level Makefile.
Instead, "clean-files" is available in sub Makefiles. but, it is redundant if you are willing to add it to extra-y because files in $(extra-y) are automatically cleaned up.
Quoted 11 lines
Quoted 6 lines
Quoted 6 lines
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?
Quoted 2 lines · Tom Rini
Quoted 6 lines
Quoted 2 lines
Off the top of my head, try throwing test.img into obj-y ?
Adding text.img to obj-y did cause the .img file to get generated, but it also added text.img to the list of files supplied to ld, causing the final u-boot link to fail
Right.
As you have already noticed, you should use extra-y for your purpose.
Quoted 11 lines · Simon Glass
Quoted 3 lines
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?Your mention of Makefile.lib prompted my to look there for other targets I might use. I discovered extra-y and adding
extra-y := test.img
Yes, this is correct.
Quoted 9 lines
to my board's
Makefilecaused the correct operations.As you suggest, I added
cmd_my_mkimage, which while not actually needed, is a very nice way to have a non-verbose progress report in the make output.Quoted 2 lines
Another option is to put this outside the U-Boot build system, and just run mkimage later.
Quoted 7 lines
I really want these steps to be part of the normal board make. Requiring a separate manual build step will inevitably result in that separate step being forgotten (most probably by me).
Is there any documentation you could point me at that might explain the way these Makefiles interact?
As Simon suggested, Documentation/kbuild/makefiles.txt of Linux Kernel is the best one.
Quoted 2 lines
I know most of this was derived from somewhere
else (Linux kernel?) as part of the move to KConfig. But I have no
To be precise, you should say Kbuild, not Kconfig. Kbuild and Kconfig should be considered separately.
Kbuild - build system
Kconfig - configuration system
They both originate in Linux Kernel.
U-Boot switched to Kbuild at 2014.04-rc1, and to Kconfig at 2014.10-rc1.
You mentioned you are using u-boot v2014.07.
So, you are building U-Boot with Kbuild,
but using the old, conventional configuration system (mkconfig + boards.cfg).
Your questions in this thread are all about Kbuild.
Quoted 5 lines
experience with the kernel build system and following make's debug output is difficult, at best. Some overview of how makes are done would be quite helpful to me and maybe to other non-U-Boot-developers.
Quoted 7 lines
Remaining problems:
1) I can't figure out how to clean my newly created derived .img file. I've tried each of the following four lines (one at a time), but none worked
CLEAN_FILES+= board/aja/helo/helo_setupdeveloper.imgCLEAN_FILES+= test.imgCLEAN_FILES:= test.img
CLEAN_FILES is only available at the top-level Makefile.
AddCLEAN_FILES += board/my_board/test.img
to the top-level Makefile, and it should work.
Quoted 2 lines
clean-files += test.img
clean-files := test.img
These are correct in sub-directory Makefiles in general, but unfortunately, "make clean" does not descend into board/ directory for some reason.
So, they do not work in board/*/Makefile
Quoted 16 lines
2) More generally, I'd like to be able to add some arbitrary make steps that are peculiar to my boards
Makefile, but I can't figure this out either, so far.I've tried adding
my_allto extra-y and then adding steps formy_all, similar to the following.8<---
extra-y := test.imgmy_all.PHONY
my_allmy_all: test1.txt# some arbitrary commands to be executed if test1.txt isn't present cp -f test.txt test1.txt 8<---
Quoted 8 lines
In this case, make reports an error
make[1]: *** No rule to make target
board/my_board/my_all', needed by__build'. Stop.
make: *** [board/my_board] Error 2Any help would be appreciated.
If you want to generate board/my_board/test1.txt from board/my_board/test.txt, the board/my_board/Makefile should look like this:
8<----
extra-y := test1.txt
$(obj)/test1.txt: $(src)/test.txt
cp -f $< $@
8<----
If you like the log to look more nicely,
you can write like below:
8<----
extra-y := test1.txt
quiet_cmd_copy = COPY $@
cmd_copy = cp -f $< $@
$(obj)/test1.txt: $(src)/test.txt
$(call cmd,copy)
8<-----
Add the following to the top-level Makefile
8<----CLEAN_FILES += board/my_board/test1.txt
8<----
I do not think you need to use PHONY target, but
if you really want use it, you can do like this.
8<----
__build: my_all
PHONY += my_all
my_all:
echo "Hello, World"
8<----
Signature · 2 lines
Best Regards Masahiro Yamada
Dear Masahiro,
Your help has enabled me to make my board Makefile do what I want (except for the clean target, see below).
Quoted 29 lines · Masahiro Yamada
Hi James,
2015-03-13 3:35 GMT+09:00 James Chargin <[email protected]>:
Quoted 26 lines
I could still use some help with this from someone who really knows how the make system works.
Tom and Simon provided hints that were helpful, as I note below.
Quoted 19 lines · James Chargin
So, is no one willing to offer a hint?
Thanks,
JimQuoted 12 lines · James Chargin
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
Makefilelooks like8<---
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".
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
...
Is there any documentation you could point me at that might explain the way these Makefiles interact?
As Simon suggested,
Documentation/kbuild/makefiles.txtof Linux Kernel is the best one.
This document has been very helpful. Thank you both for pointing it out.
Quoted 11 lines
Quoted 2 lines
I know most of this was derived from somewhere
else (Linux kernel?) as part of the move to KConfig. But I have no ...To be precise, you should say
Kbuild, notKconfig.KbuildandKconfigshould be considered separately.
Kbuild- build system
Kconfig- configuration systemThey both originate in Linux Kernel.
Quoted 7 lines
U-Boot switched to
Kbuildat 2014.04-rc1, and toKconfigat 2014.10-rc1.You mentioned you are using u-boot v2014.07.
So, you are building U-Boot withKbuild,
but using the old, conventional configuration system (mkconfig + boards.cfg).Your questions in this thread are all about
Kbuild.
I appreciate your clear explanation here.
I have watched the Kbuild and KConfig conversion threads in the mailing list for some time. But having been previously working with U-Boot 2010.12, this is my first experience with either. It will be useful to know they are separate in this way.
Quoted 14 lines
Quoted 6 lines
Remaining problems:
1) I can't figure out how to clean my newly created derived .img file. I've tried each of the following four lines (one at a time), but none worked
CLEAN_FILES+= test.imgCLEAN_FILES:= test.img
CLEAN_FILESis only available at the top-levelMakefile.Add
CLEAN_FILES+= board/my_board/test.img
to the top-levelMakefile, and it should work.
Quoted 8 lines
Quoted 2 lines
clean-files += test.img
clean-files := test.imgThese are correct in sub-directory Makefiles in general, but unfortunately, "make clean" does not descend into board/ directory for some reason.
So, they do not work in board/*/Makefile
Should this be considered a bug in the build system? Should make descend into the board directory? Or, at least, should there not be a way for a board directory to indicate which of any locally generated derived objects should be cleaned up?
I hesitate to add to the top level Makefile for my specific board.
Quoted 29 lines
Quoted 16 lines
2) More generally, I'd like to be able to add some arbitrary make steps that are peculiar to my boards
Makefile, but I can't figure this out either, so far.I've tried adding
my_allto extra-y and then adding steps formy_all, similar to the following.8<---
extra-y := test.imgmy_all.PHONY
my_allmy_all: test1.txt# some arbitrary commands to be executed if test1.txt isn't present cp -f test.txt test1.txt 8<---Quoted 8 lines
In this case, make reports an error
make[1]: *** No rule to make target
board/my_board/my_all', needed by__build'. Stop.
make: *** [board/my_board] Error 2Any help would be appreciated.
If you want to generate
board/my_board/test1.txtfromboard/my_board/test.txt, the board/my_board/Makefile should look like this:
Quoted 7 lines
8<----
extra-y := test1.txt
$(obj)/test1.txt: $(src)/test.txt
cp -f $< $@8<----
This is actually the fix for many of my problems. Prepending $(obj) and $(src) apparently allows make to see the file dependencies as I intend.
Quoted 6 lines
...
Add the following to the top-levelMakefile
8<----CLEAN_FILES+=board/my_board/test1.txt
8<----
Again, I hesitate to add to the top level Makefile.
Quoted 5 lines
I do not think you need to use PHONY target, but
if you really want use it, you can do like this.8<----
Quoted 7 lines
__build:my_allPHONY +=
my_all
my_all:
echo "Hello, World"
8<----
As you suggest, I did not use .PHONY.
This explanation might be a nice addition to the Kbuild makefile.txt.
Again, thank you very much for your attention.
Jim
Signature · 3 lines
Jim Chargin AJA Video Systems [email protected] (530) 271-3334 http://www.aja.com
Hi James,
2015-03-14 3:08 GMT+09:00 James Chargin <[email protected]>:
Quoted 8 lines
Quoted 5 lines
These are correct in sub-directory Makefiles in general, but unfortunately, "make clean" does not descend into board/ directory for some reason.
So, they do not work in board/*/Makefile
Should this be considered a bug in the build system?
Kind of.
I hope it will be solved in a long run.
In U-Boot, ARCH, VENDOR, BOARD directories are still treated specially for some historical reason.
Board directory is selected like follows:
libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/)
and it has made it difficult to descend into board/ by "make clean" because "make clean" should not expect the existing .config file.
If we could completely switched to "obj-$(CONFIG_FOO)" style in the future, this problem would go away. We need more effort to achieve this.
Quoted 2 lines
Should make descend
into the board directory?
Yes.
Quoted 4 lines
Or, at least, should there not be a way for a
board directory to indicate which of any locally generated derived objects should be cleaned up?
I hesitate to add to the top levelMakefilefor my specific board.
Sorry, I cannot suggest a good solution now.
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 46 lines · James Chargin
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
Makefilelooks like8<---
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
Makefilecontents 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 are8<---
IMG = test.imgobj-y := board.o
board.o : $(IMG)
%.img : %.txt
$(srctree)/tools/mkimage -T script -n $* -C none -d $< $@
CLEAN_FILES+= $(IMG)CLEAN_DIRS+= .
8<---
Quoted 6 lines
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 ?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150309/989de630/attachment.sig>
Hi,
Quoted 47 lines · Tom Rini
Quoted 46 lines · James Chargin
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
Makefilelooks like8<---
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
Makefilecontents 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 are8<---
IMG = test.imgobj-y := board.o
board.o : $(IMG)
%.img : %.txt
$(srctree)/tools/mkimage -T script -n $* -C none -d $< $@
CLEAN_FILES+= $(IMG)CLEAN_DIRS+= .
8<---
Quoted 8 lines
Quoted 6 lines
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