carl9170 firmware build: simplify build process
authorChristian Lamparter <chunkeey@googlemail.com>
Mon, 14 Feb 2011 14:32:15 +0000 (15:32 +0100)
committerChristian Lamparter <chunkeey@googlemail.com>
Mon, 14 Feb 2011 14:41:42 +0000 (15:41 +0100)
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 <chunkeey@googlemail.com>
autogen.sh
carlfw/CMakeLists.txt
tools/lib/carlfw.c

index d61418c7999d10453f4c91c7adb382e6931f84f3..56b8101642fa66c0b902bb9be30375bdda4a3f0f 100755 (executable)
@@ -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."
        ;;
 
        *)
index f1dc23ca471c54bb3954f02613a08a38bd133886..70eb23784e5902395d7a3d6bac1abfb44c5f2e80 100644 (file)
@@ -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")
index 44897e39ef8ee07a1c0b464a1cc7857f303bb854..533abbca7c3e3c6412b421cd507ec412f3083343 100644 (file)
@@ -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