Ticket #8183: trunk_orion_flexible_kernel_mtd_support.patch
| File trunk_orion_flexible_kernel_mtd_support.patch, 6.5 KB (added by maddes, 7 years ago) |
|---|
-
target/linux/orion/image/Config.in
1 config KERNEL_OPENWRT_KERNEL_MTD_SIZE 2 int 3 prompt "Kernel MTD partition size in KB (832 - 2048)" 4 range 832 2048 5 depends TARGET_orion 6 default 1088 if KERNEL_KALLSYMS && !LINUX_2_6_32 && !LINUX_2_6_34 7 default 1024 8 help 9 Defines the size of the kernel's MTD partition in KB (1KB = 1024 bytes). 10 This value is used in the device patches for defining the MTD partitions. 11 Make sure that all patches for all devices make use of this value. 12 The value is also used in the image file for correct padding and more. 13 It is recommended to choose a size in 64KB steps (biggest erase size). 14 Before kernel 2.6.35: 1024KB 15 Since kernel 2.6.35: 1088KB for kernel with symbols -
target/linux/orion/image/generic.mk
5 5 # See /LICENSE for more information. 6 6 # 7 7 8 ## convert value from KB to bytes (in decimal) for dd and other commands 9 CONFIG_KERNEL_OPENWRT_KERNEL_MTD_SIZE:=$(shell echo $$(( $(CONFIG_KERNEL_OPENWRT_KERNEL_MTD_SIZE) * 1024 )) ) 10 8 11 define Image/Prepare 9 12 cp $(LINUX_DIR)/arch/arm/boot/uImage $(KDIR)/uImage 10 13 endef … … 34 37 $(STAGING_DIR_HOST)/bin/mkfs.jffs2 -m none -p -l -q -e 128KiB -o $(KDIR)/wnr854t-uImage.jffs2 -d $(KDIR)/netgear_image 35 38 rm -rf $(KDIR)/netgear_image 36 39 ( \ 37 dd if=$(KDIR)/wnr854t-uImage.jffs2 bs= 1024kconv=sync; \40 dd if=$(KDIR)/wnr854t-uImage.jffs2 bs=$(CONFIG_KERNEL_OPENWRT_KERNEL_MTD_SIZE) conv=sync; \ 38 41 dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \ 39 42 ) > $(BIN_DIR)/openwrt-$(2)-$(1).img 40 43 $(STAGING_DIR_HOST)/bin/add_header $(3) $(BIN_DIR)/openwrt-$(2)-$(1).img $(BIN_DIR)/openwrt-$(2)-$(1)-webupgrade.img … … 44 47 # Orion Linksys Images 45 48 # sysupgrade image 46 49 ( \ 47 dd if="${KDIR}/$2-uImage" bs=$ 5conv=sync; \50 dd if="${KDIR}/$2-uImage" bs=$(CONFIG_KERNEL_OPENWRT_KERNEL_MTD_SIZE) conv=sync; \ 48 51 dd if="${KDIR}/root.$1" bs=64k conv=sync; \ 49 52 ) > "${BIN_DIR}/openwrt-$2-$1.img" 50 53 # recovery image and webupgrade image for stock firmware 51 54 rm -rf "${TMP_DIR}/$2_webupgrade" 52 55 mkdir "${TMP_DIR}/$2_webupgrade" 53 56 # create parameter file 54 echo ":kernel $ 5${BIN_DIR}/openwrt-$2-uImage" >"${TMP_DIR}/$2_webupgrade/$2.par"57 echo ":kernel $(CONFIG_KERNEL_OPENWRT_KERNEL_MTD_SIZE) ${BIN_DIR}/openwrt-$2-uImage" >"${TMP_DIR}/$2_webupgrade/$2.par" 55 58 echo ":rootfs 0 ${KDIR}/root.$1" >>"${TMP_DIR}/$2_webupgrade/$2.par" 56 59 [ ! -f "$(STAGING_DIR_HOST)/share/wrt350nv2-builder/u-boot.bin" ] || ( \ 57 60 echo ":u-boot 0 $(STAGING_DIR_HOST)/share/wrt350nv2-builder/u-boot.bin" >>"${TMP_DIR}/$2_webupgrade/$2.par"; ) … … 73 76 $(call Image/Build/$(1),$(1)) 74 77 $(call Image/Build/Netgear,$(1),wnr854t,NG_WNR854T,$(1)) 75 78 # Leave WRT350Nv2 at last position due to webimage dependency for zip 76 # 5th parameter is kernel mtd size, e.g. 0x00100000 = 1048576 or 0x001A0000 = 1703936 77 $(call Image/Build/Linksys,$(1),wrt350nv2,WNR350Nv2,$(1),1048576) 79 $(call Image/Build/Linksys,$(1),wrt350nv2,WNR350Nv2,$(1)) 78 80 endef 79 81 80 82 define Image/Build/squashfs 81 83 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) 82 84 ( \ 83 dd if=$(KDIR)/uImage bs= 1024kconv=sync; \85 dd if=$(KDIR)/uImage bs=$(CONFIG_KERNEL_OPENWRT_KERNEL_MTD_SIZE) conv=sync; \ 84 86 dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \ 85 87 ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).img 86 88 endef -
target/linux/orion/patches/020-flexible_kernel_mtd_support.patch
1 --- a/arch/arm/mach-orion5x/Kconfig 2 +++ b/arch/arm/mach-orion5x/Kconfig 3 @@ -147,6 +147,13 @@ config MACH_RD88F6183AP_GE 4 Say 'Y' here if you want your kernel to support the 5 Marvell Orion-1-90 (88F6183) AP GE RD. 6 7 +config OPENWRT_KERNEL_MTD_SIZE 8 + int 9 + prompt "OpenWrt: Kernel MTD partition size in KB" 10 + default 1024 11 + help 12 + Defines the size of the kernel's MTD partition in KB (1KB = 1024 bytes). 13 + This is just a help construct for OpenWrt to pass a value to the kernel build process. 14 endmenu 15 16 endif -
target/linux/orion/patches/100-wrt350nv2_openwrt_partition_map.patch
5 5 .name = "kernel", 6 6 .offset = 0x00000000, 7 7 - .size = 0x00760000, 8 + .size = 0x00100000, // change to kernel mtd size here (1/3)8 + .size = (CONFIG_OPENWRT_KERNEL_MTD_SIZE * 1024), // original was 0x001A0000 (1664KB) 9 9 }, { 10 10 .name = "rootfs", 11 11 - .offset = 0x001a0000, 12 12 - .size = 0x005c0000, 13 + .offset = 0x00100000, // change to kernel mtd size here (2/3)14 + .size = 0x00650000, // adopt to kernel mtd size here (3/3) = 0x00750000 - <kernel mtd size>13 + .offset = (CONFIG_OPENWRT_KERNEL_MTD_SIZE * 1024), // original was 0x001A0000 (1664KB) 14 + .size = (0x00750000 - (CONFIG_OPENWRT_KERNEL_MTD_SIZE * 1024)), 15 15 }, { 16 16 .name = "lang", 17 17 .offset = 0x00760000, -
target/linux/orion/patches/101-wnr854t_partition_map.patch
1 1 --- a/arch/arm/mach-orion5x/wnr854t-setup.c 2 2 +++ b/arch/arm/mach-orion5x/wnr854t-setup.c 3 @@ -67,6 +67,10 @@ static struct mtd_partition wnr854t_nor_ 3 @@ -58,15 +58,19 @@ static struct mtd_partition wnr854t_nor_ 4 { 5 .name = "kernel", 6 .offset = 0x00000000, 7 - .size = 0x00100000, 8 + .size = (CONFIG_OPENWRT_KERNEL_MTD_SIZE * 1024), 9 }, { 10 .name = "rootfs", 11 - .offset = 0x00100000, 12 - .size = 0x00660000, 13 + .offset = (CONFIG_OPENWRT_KERNEL_MTD_SIZE * 1024), 14 + .size = (0x00760000 - (CONFIG_OPENWRT_KERNEL_MTD_SIZE * 1024)), 15 }, { 4 16 .name = "uboot", 5 17 .offset = 0x00760000, 6 18 .size = 0x00040000,
