From: Christian Lamparter Date: Mon, 14 Feb 2011 14:32:15 +0000 (+0100) Subject: carl9170 firmware build: simplify build process X-Git-Tag: 1.9.3~7^2 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=426e6ff2a4bb4ae1c19def78631e28a6cbcd845c;p=carl9170fw.git carl9170 firmware build: simplify build process Several users tried to use the generated carl9170.fw without applying the firmware descriptor first. This will obviously not work... Now cmake takes care of this step as well and I have to say that it now looks less confusing than before ;). Signed-off-by: Christian Lamparter --- diff --git a/autogen.sh b/autogen.sh index d61418c..56b8101 100755 --- a/autogen.sh +++ b/autogen.sh @@ -23,21 +23,15 @@ case "$1" in . ./.config - - if [ "$CONFIG_CARL9170FW_MAKE_RELEASE" = "y" ]; then - echo -n "Installing firmware..." - tmpfwfile=`mktemp` - cat carlfw/carl9170.fw carlfw/carl9170.dsc > $tmpfwfile - if [ "$CONFIG_CARL9170FW_BUILD_TOOLS" = "y" ] && - [ "$CONFIG_CARL9170FW_BUILD_MINIBOOT" = "y" ]; then - echo -n "Apply miniboot..." - tools/src/miniboot a $tmpfwfile minifw/miniboot.fw - fi - - sudo install $tmpfwfile /lib/firmware/carl9170-$CONFIG_CARL9170FW_RELEASE_VERSION.fw - rm $tmpfwfile - echo "done." + echo -n "Installing firmware..." + if [ "$CONFIG_CARL9170FW_BUILD_TOOLS" = "y" ] && + [ "$CONFIG_CARL9170FW_BUILD_MINIBOOT" = "y" ]; then + echo -n "Apply miniboot..." + tools/src/miniboot a carlfw/carl9170.fw minifw/miniboot.fw fi + + sudo install carlfw/carl9170.fw /lib/firmware/carl9170-$CONFIG_CARL9170FW_RELEASE_VERSION.fw + echo "done." ;; *) diff --git a/carlfw/CMakeLists.txt b/carlfw/CMakeLists.txt index f1dc23c..70eb237 100644 --- a/carlfw/CMakeLists.txt +++ b/carlfw/CMakeLists.txt @@ -36,14 +36,31 @@ set_target_properties(carl9170.elf PROPERTIES COMPILE_FLAGS " ${CARLFW_CFLAGS_DEF} ${CARLFW_CFLAGS_EXTRA} ${CARLFW_CFLAGS_AGGRESSIVE} ${CARLFW_CFLAGS_WARNING}") set_target_properties(carl9170.elf PROPERTIES LINK_FLAGS "-Tcarl9170.lds") -add_custom_target( - carl9170.fw ALL - ${OBJCOPY} --strip-unneeded -O binary -R .sram -R .eeprom -R .fwdsc carl9170.elf carl9170.fw - DEPENDS carl9170.elf) -add_custom_target( - carl9170.dsc ALL - ${OBJCOPY} --strip-unneeded -O binary -j .fwdsc carl9170.elf carl9170.dsc - DEPENDS carl9170.elf) +add_custom_target(firmware ALL) +add_custom_command( + SOURCE carl9170.elf + COMMAND ${OBJCOPY} + ARGS --strip-unneeded -O binary -R .sram -R .eeprom -R .fwdsc carl9170.elf carl9170.bin + TARGET firmware + OUTPUTS carl9170.bin) + +add_custom_command( + SOURCE carl9170.elf + COMMAND ${OBJCOPY} + ARGS --strip-unneeded -O binary -j .fwdsc carl9170.elf carl9170.dsc + TARGET firmware + OUTPUTS carl9170.dsc) + +add_custom_command( + SOURCE firmware + TARGET firmware + COMMAND cat + ARGS "carl9170.bin" "carl9170.dsc" > "carl9170.fw" + DEPENDS carl9170.elf carl9170.bin carl9170.dsc + OUTPUTS carl9170.fw) + +SET_DIRECTORY_PROPERTIES( + PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "carl9170.fw") diff --git a/tools/lib/carlfw.c b/tools/lib/carlfw.c index 44897e3..533abbc 100644 --- a/tools/lib/carlfw.c +++ b/tools/lib/carlfw.c @@ -409,19 +409,10 @@ struct carlfw *carlfw_load(const char *basename) init_list_head(&fw->desc_list); - snprintf(filename, sizeof(filename), "%s.dsc", basename); - err = __carlfw_load(&fw->hdr, filename, "r"); - - snprintf(filename, sizeof(filename), "%s.fw", basename); - err = __carlfw_load(&fw->fw, filename, "r"); - if (!err) - goto found; - err = __carlfw_load(&fw->fw, basename, "r"); if (err) goto err_out; -found: if (fw->hdr.name) hdr_file = &fw->hdr; else