Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Linker script macros to generate Image header fields.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (C) 2014 ARM Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #ifndef __ARM64_KERNEL_IMAGE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #define __ARM64_KERNEL_IMAGE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifndef LINKER_SCRIPT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #error This file should only be included in vmlinux.lds.S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/image.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  * There aren't any ELF relocations we can use to endian-swap values known only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  * at link time (e.g. the subtraction of two symbol addresses), so we must get
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)  * the linker to endian-swap certain values before emitting them.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)  * Note that, in order for this to work when building the ELF64 PIE executable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)  * (for KASLR), these values should not be referenced via R_AARCH64_ABS64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)  * relocations, since these are fixed up at runtime rather than at build time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)  * when PIE is in effect. So we need to split them up in 32-bit high and low
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)  * words.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #ifdef CONFIG_CPU_BIG_ENDIAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define DATA_LE32(data)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	((((data) & 0x000000ff) << 24) |	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	 (((data) & 0x0000ff00) << 8)  |	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	 (((data) & 0x00ff0000) >> 8)  |	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	 (((data) & 0xff000000) >> 24))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define DATA_LE32(data) ((data) & 0xffffffff)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define DEFINE_IMAGE_LE64(sym, data)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	sym##_lo32 = DATA_LE32((data) & 0xffffffff);		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	sym##_hi32 = DATA_LE32((data) >> 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define __HEAD_FLAG(field)	(__HEAD_FLAG_##field << \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 					ARM64_IMAGE_FLAG_##field##_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #ifdef CONFIG_CPU_BIG_ENDIAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define __HEAD_FLAG_BE		ARM64_IMAGE_FLAG_BE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #define __HEAD_FLAG_BE		ARM64_IMAGE_FLAG_LE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define __HEAD_FLAG_PAGE_SIZE	((PAGE_SHIFT - 10) / 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define __HEAD_FLAG_PHYS_BASE	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define __HEAD_FLAGS		(__HEAD_FLAG(BE)	| \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 				 __HEAD_FLAG(PAGE_SIZE) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 				 __HEAD_FLAG(PHYS_BASE))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)  * These will output as part of the Image header, which should be little-endian
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)  * regardless of the endianness of the kernel. While constant values could be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)  * endian swapped in head.S, all are done here for consistency.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #define HEAD_SYMBOLS						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	DEFINE_IMAGE_LE64(_kernel_size_le, _end - _text);	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	DEFINE_IMAGE_LE64(_kernel_flags_le, __HEAD_FLAGS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #endif /* __ARM64_KERNEL_IMAGE_H */