build: add UIMAGE_MAGIC to device variables
Allow a device recipe to specify a custom UIMAGE_MAGIC value, as used by
OpenWrt's -M flag for mkimage. This allows to automatically customize
the magic bytes in all calls to Build/uImage for this device, similar to
the behaviour of UIMAGE_NAME. Since the -M argument is inserted before
the user arguments, it can be overriden.
The following example would use 0x87654321 for the KERNEL image, but
0x12345678 for the KERNEL_INITRAMFS image:
  define Device/MyDevice
    UIMAGE_MAGIC := 0x87654321
    KERNEL := ... | uImage lzma
    KERNEL_INITRAMFS := ... | uImage lzma -M 0x12345678
    ...
  endef
Fixes: df8e6be59a ("rtl838x: add new architecture")
[UIMAGE_MAGIC was not declared as a device variable]
Signed-off-by: Sander Vanheule <sander@svanheule.net>
[rebase, improve formatting of "Fixes"]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
			
			
This commit is contained in:
		 Sander Vanheule
					Sander Vanheule
				
			
				
					committed by
					
						 Adrian Schmutzler
						Adrian Schmutzler
					
				
			
			
				
	
			
			
			 Adrian Schmutzler
						Adrian Schmutzler
					
				
			
						parent
						
							9f574b1b87
						
					
				
				
					commit
					c20b8d690b
				
			| @@ -402,6 +402,7 @@ define Build/uImage | |||||||
| 		-a $(KERNEL_LOADADDR) \ | 		-a $(KERNEL_LOADADDR) \ | ||||||
| 		-e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ | 		-e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ | ||||||
| 		-n '$(if $(UIMAGE_NAME),$(UIMAGE_NAME),$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION))' \ | 		-n '$(if $(UIMAGE_NAME),$(UIMAGE_NAME),$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION))' \ | ||||||
|  | 		$(if $(UIMAGE_MAGIC),-M $(UIMAGE_MAGIC)) \ | ||||||
| 		$(wordlist 2,$(words $(1)),$(1)) \ | 		$(wordlist 2,$(words $(1)),$(1)) \ | ||||||
| 		-d $@ $@.new | 		-d $@ $@.new | ||||||
| 	mv $@.new $@ | 	mv $@.new $@ | ||||||
|   | |||||||
| @@ -400,6 +400,7 @@ define Device/Init | |||||||
|   SOC := |   SOC := | ||||||
|  |  | ||||||
|   BOARD_NAME := |   BOARD_NAME := | ||||||
|  |   UIMAGE_MAGIC := | ||||||
|   UIMAGE_NAME := |   UIMAGE_NAME := | ||||||
|   DEVICE_COMPAT_VERSION := 1.0 |   DEVICE_COMPAT_VERSION := 1.0 | ||||||
|   DEVICE_COMPAT_MESSAGE := |   DEVICE_COMPAT_MESSAGE := | ||||||
| @@ -419,7 +420,8 @@ DEFAULT_DEVICE_VARS := \ | |||||||
|   CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \ |   CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \ | ||||||
|   VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \ |   VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \ | ||||||
|   DEVICE_DTS_CONFIG DEVICE_DTS_DIR DEVICE_FDT_NUM SOC BOARD_NAME \ |   DEVICE_DTS_CONFIG DEVICE_DTS_DIR DEVICE_FDT_NUM SOC BOARD_NAME \ | ||||||
|   UIMAGE_NAME SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \ |   UIMAGE_MAGIC UIMAGE_NAME \ | ||||||
|  |   SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \ | ||||||
|   UBOOT_PATH IMAGE_SIZE \ |   UBOOT_PATH IMAGE_SIZE \ | ||||||
|   DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \ |   DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \ | ||||||
|   DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \ |   DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user