1 Some of the Linux header files are not available on non Linux host
2 systems like FreeBSD or MacOSX.
4 The __le32 and __be32 types are only defined in Linux in
5 asm/byteorder.h, but not on all other BSD systems.
6 Use uint32_t instead of __le32 and __be32.
8 __swab32 is also a Linux only function, it looks like be32_to_cpu()
9 would be better here anyway.
17 -#include <asm/byteorder.h>
20 /* Define this to avoid #ifdefs later on */
21 @@ -317,13 +316,13 @@ enum {
22 * all data in network byte order (aka natural aka bigendian).
24 typedef struct image_header {
25 - __be32 ih_magic; /* Image Header Magic Number */
26 - __be32 ih_hcrc; /* Image Header CRC Checksum */
27 - __be32 ih_time; /* Image Creation Timestamp */
28 - __be32 ih_size; /* Image Data Size */
29 - __be32 ih_load; /* Data Load Address */
30 - __be32 ih_ep; /* Entry Point Address */
31 - __be32 ih_dcrc; /* Image Data CRC Checksum */
32 + uint32_t ih_magic; /* Image Header Magic Number */
33 + uint32_t ih_hcrc; /* Image Header CRC Checksum */
34 + uint32_t ih_time; /* Image Creation Timestamp */
35 + uint32_t ih_size; /* Image Data Size */
36 + uint32_t ih_load; /* Data Load Address */
37 + uint32_t ih_ep; /* Entry Point Address */
38 + uint32_t ih_dcrc; /* Image Data CRC Checksum */
39 uint8_t ih_os; /* Operating System */
40 uint8_t ih_arch; /* CPU architecture */
41 uint8_t ih_type; /* Image Type */
42 --- a/tools/mtk_image.h
43 +++ b/tools/mtk_image.h
45 union gen_boot_header {
55 @@ -32,14 +32,14 @@ union nand_boot_header {
63 - __le16 pages_of_block;
65 - __le16 writesize_shift;
66 - __le16 erasesize_shift;
69 + uint16_t addrcycles;
71 + uint16_t pages_of_block;
73 + uint16_t writesize_shift;
74 + uint16_t erasesize_shift;
76 uint8_t ecc_parity[28];
78 @@ -54,14 +54,14 @@ union nand_boot_header {
79 /* BootROM layout header */
80 struct brom_layout_header {
87 - __le32 header_size_2;
88 - __le32 total_size_2;
91 + uint32_t header_size;
92 + uint32_t total_size;
95 + uint32_t header_size_2;
96 + uint32_t total_size_2;
100 #define BRLYT_NAME "BRLYT"
101 @@ -90,8 +90,8 @@ struct gen_device_header {
102 struct gfh_common_header {
111 #define GFH_HEADER_MAGIC "MMM"
112 @@ -106,17 +106,17 @@ struct gfh_common_header {
113 struct gfh_file_info {
114 struct gfh_common_header gfh;
119 + uint16_t file_type;
127 - __le32 jump_offset;
129 + uint32_t load_addr;
130 + uint32_t total_size;
134 + uint32_t jump_offset;
135 + uint32_t processed;
138 #define GFH_FILE_INFO_NAME "FILE_INFO"
139 @@ -129,16 +129,16 @@ struct gfh_file_info {
142 struct gfh_common_header gfh;
147 struct gfh_brom_cfg {
148 struct gfh_common_header gfh;
150 - __le32 usbdl_by_auto_detect_timeout_ms;
152 + uint32_t usbdl_by_auto_detect_timeout_ms;
153 uint8_t unused[0x48];
154 - __le32 usbdl_by_kcol0_timeout_ms;
155 - __le32 usbdl_by_flag_timeout_ms;
156 + uint32_t usbdl_by_kcol0_timeout_ms;
157 + uint32_t usbdl_by_flag_timeout_ms;
161 @@ -157,15 +157,15 @@ struct gfh_anti_clone {
167 + uint32_t ac_offset;
171 struct gfh_brom_sec_cfg {
172 struct gfh_common_header gfh;
175 char customer_name[0x20];
180 #define BROM_SEC_CFG_JTAG_EN 1
181 @@ -184,11 +184,11 @@ struct gfh_header {
197 --- a/tools/zynqmpbif.c
198 +++ b/tools/zynqmpbif.c
199 @@ -517,7 +517,7 @@ static int bif_add_bit(struct bif_entry
200 debug("Bitstream Length: 0x%x\n", bitlen);
201 for (i = 0; i < bitlen; i += sizeof(uint32_t)) {
202 uint32_t *bitbin32 = (uint32_t *)&bitbin[i];
203 - *bitbin32 = __swab32(*bitbin32);
204 + *bitbin32 = be32_to_cpu(*bitbin32);