mxs: fix image build issues
[openwrt/openwrt.git] / tools / kernel2minor / patches / 110-fix_endian_conv.patch
1 --- a/k2m_biops.h
2 +++ b/k2m_biops.h
3 @@ -10,7 +10,9 @@
4 */
5
6 //нужна ли конвертация. устанавливавется автоматически в 1 для НЕ big_endian систем
7 -static int endian_need_conv = __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__;
8 +static int big_endian;
9 +
10 +#define endian_need_conv (!!big_endian ^ (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
11
12 /* конвертор из одного байтового порядка в обратный
13 x обязательно должна быть переменной но не выражением !
14 --- a/kernel2minor.c
15 +++ b/kernel2minor.c
16 @@ -76,7 +76,7 @@ void print_help(void){
17 char *usage[] =
18 { "-k", "Path to kernel file", kernel_file,
19 "-r", "Path to result file", res_file,
20 - "-e", "Enable endian convert", endian_need_conv ? "Yes" : "No",
21 + "-e", "Enable endian convert to big-endian", big_endian ? "Yes" : "No",
22 "-c", "Use ECC", use_ecc ? "Yes" : "No",
23 "-s", "FLASH Unit(Chunk) size", chunk_size_str,
24 "-i", "Add image info block", add_image_info_block ? info_block_size_str : "No",
25 @@ -595,7 +595,7 @@ int main(int argc, char *argv[]){
26 case 'k': snprintf(kernel_file, sizeof(kernel_file) - 1, "%s", optarg); break;
27 case 'r': snprintf(res_file, sizeof(res_file) - 1, "%s", optarg); break;
28 case 'c': use_ecc = 1; break;
29 - case 'e': endian_need_conv = 1; break;
30 + case 'e': big_endian = 1; break;
31 case 's': chunk_size = atoi(optarg); break;
32 case 'i': add_image_info_block = 1; align_size = atoi(optarg); break;
33 case 'p': strncpy(platform_name, optarg, sizeof(platform_name)); break;