mirror of https://github.com/hak5/openwrt.git
firmware-utils: mkfwimage: enable extra compiler checks and fix them
Let's enforce additional automatic checks enforced by the compiler in order to catch possible errors during compilation. Signed-off-by: Petr Štetiar <ynezz@true.cz>master
parent
9c0c1c4401
commit
83e60f0df6
|
@ -12,7 +12,13 @@ include $(INCLUDE_DIR)/host-build.mk
|
||||||
include $(INCLUDE_DIR)/kernel.mk
|
include $(INCLUDE_DIR)/kernel.mk
|
||||||
|
|
||||||
define cc
|
define cc
|
||||||
$(HOSTCC) $(HOST_CFLAGS) -include endian.h $(HOST_LDFLAGS) -o $(HOST_BUILD_DIR)/bin/$(firstword $(1)) $(foreach src,$(1),src/$(src).c) $(2)
|
$(HOSTCC) \
|
||||||
|
$(HOST_CFLAGS) \
|
||||||
|
-Wno-unused-parameter \
|
||||||
|
-include endian.h $(HOST_LDFLAGS) \
|
||||||
|
-o $(HOST_BUILD_DIR)/bin/$(firstword $(1)) \
|
||||||
|
$(foreach src,$(1),src/$(src).c) \
|
||||||
|
$(2)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Host/Compile
|
define Host/Compile
|
||||||
|
@ -32,7 +38,7 @@ define Host/Compile
|
||||||
$(call cc,mkzynfw)
|
$(call cc,mkzynfw)
|
||||||
$(call cc,lzma2eva,-lz)
|
$(call cc,lzma2eva,-lz)
|
||||||
$(call cc,mkcasfw)
|
$(call cc,mkcasfw)
|
||||||
$(call cc,mkfwimage,-lz -Wall)
|
$(call cc,mkfwimage,-lz -Wall -Werror -Wextra)
|
||||||
$(call cc,mkfwimage2,-lz)
|
$(call cc,mkfwimage2,-lz)
|
||||||
$(call cc,imagetag imagetag_cmdline cyg_crc32)
|
$(call cc,imagetag imagetag_cmdline cyg_crc32)
|
||||||
$(call cc,add_header)
|
$(call cc,add_header)
|
||||||
|
|
|
@ -262,7 +262,8 @@ static void usage(const char* progname)
|
||||||
|
|
||||||
static void print_image_info(const image_info_t* im)
|
static void print_image_info(const image_info_t* im)
|
||||||
{
|
{
|
||||||
int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
INFO("Firmware version: '%s'\n"
|
INFO("Firmware version: '%s'\n"
|
||||||
"Output file: '%s'\n"
|
"Output file: '%s'\n"
|
||||||
"Part count: %u\n",
|
"Part count: %u\n",
|
||||||
|
@ -279,8 +280,6 @@ static void print_image_info(const image_info_t* im)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static u_int32_t filelength(const char* file)
|
static u_int32_t filelength(const char* file)
|
||||||
{
|
{
|
||||||
FILE *p;
|
FILE *p;
|
||||||
|
@ -336,7 +335,7 @@ static int create_image_layout(const char* kernelfile, const char* rootfsfile, c
|
||||||
*/
|
*/
|
||||||
static int validate_image_layout(image_info_t* im)
|
static int validate_image_layout(image_info_t* im)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (im->part_count == 0 || im->part_count > MAX_SECTIONS)
|
if (im->part_count == 0 || im->part_count > MAX_SECTIONS)
|
||||||
{
|
{
|
||||||
|
@ -383,7 +382,7 @@ static int build_image(image_info_t* im)
|
||||||
char* ptr;
|
char* ptr;
|
||||||
u_int32_t mem_size;
|
u_int32_t mem_size;
|
||||||
FILE* f;
|
FILE* f;
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
// build in-memory buffer
|
// build in-memory buffer
|
||||||
mem_size = sizeof(header_t);
|
mem_size = sizeof(header_t);
|
||||||
|
|
Loading…
Reference in New Issue