aboutsummaryrefslogtreecommitdiffstats
path: root/tools/kernel2minor/patches
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2017-01-06 00:25:04 +0100
committerFelix Fietkau <nbd@nbd.name>2017-01-06 15:34:28 +0100
commit476e77c3b7aa055fa5424a2f7ef843d307c4d20d (patch)
treefa5b5b0bcb5219fec9695503246ae8538eb821ed /tools/kernel2minor/patches
parent8782672b9019a52806d2824b451a78ceba107847 (diff)
downloadupstream-476e77c3b7aa055fa5424a2f7ef843d307c4d20d.tar.gz
upstream-476e77c3b7aa055fa5424a2f7ef843d307c4d20d.tar.bz2
upstream-476e77c3b7aa055fa5424a2f7ef843d307c4d20d.zip
tools/kernel2minor: fix endian conversion issues, allow creating little-endian images
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'tools/kernel2minor/patches')
-rw-r--r--tools/kernel2minor/patches/110-fix_endian_conv.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/kernel2minor/patches/110-fix_endian_conv.patch b/tools/kernel2minor/patches/110-fix_endian_conv.patch
new file mode 100644
index 0000000000..0d30d05b74
--- /dev/null
+++ b/tools/kernel2minor/patches/110-fix_endian_conv.patch
@@ -0,0 +1,33 @@
+--- a/k2m_biops.h
++++ b/k2m_biops.h
+@@ -10,7 +10,9 @@
+ */
+
+ //нужна ли конвертация. устанавливавется автоматически в 1 для НЕ big_endian систем
+-static int endian_need_conv = __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__;
++static int big_endian;
++
++#define endian_need_conv (!!big_endian ^ (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
+
+ /* конвертор из одного байтового порядка в обратный
+ x обязательно должна быть переменной но не выражением !
+--- a/kernel2minor.c
++++ b/kernel2minor.c
+@@ -76,7 +76,7 @@ void print_help(void){
+ char *usage[] =
+ { "-k", "Path to kernel file", kernel_file,
+ "-r", "Path to result file", res_file,
+- "-e", "Enable endian convert", endian_need_conv ? "Yes" : "No",
++ "-e", "Enable endian convert to big-endian", big_endian ? "Yes" : "No",
+ "-c", "Use ECC", use_ecc ? "Yes" : "No",
+ "-s", "FLASH Unit(Chunk) size", chunk_size_str,
+ "-i", "Add image info block", add_image_info_block ? info_block_size_str : "No",
+@@ -595,7 +595,7 @@ int main(int argc, char *argv[]){
+ case 'k': snprintf(kernel_file, sizeof(kernel_file) - 1, "%s", optarg); break;
+ case 'r': snprintf(res_file, sizeof(res_file) - 1, "%s", optarg); break;
+ case 'c': use_ecc = 1; break;
+- case 'e': endian_need_conv = 1; break;
++ case 'e': big_endian = 1; break;
+ case 's': chunk_size = atoi(optarg); break;
+ case 'i': add_image_info_block = 1; align_size = atoi(optarg); break;
+ case 'p': strncpy(platform_name, optarg, sizeof(platform_name)); break;