From e44b91f7181fc46c4049d2451d57a9d0d785ca14 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 16 Jan 2010 13:36:27 +0000 Subject: [PATCH] add sysupgrade support for the Netgear WNR854T and Linksys WRT350N v2 - thanks Matthias Buecher SVN-Revision: 19166 --- .../orion/base-files/lib/upgrade/platform.sh | 23 ++++++++++++++ .../patches/100-openwrt_partition_map.patch | 31 ++++++++++++------- .../patches/101-wnr854t_partition_map.patch | 13 ++++++++ 3 files changed, 55 insertions(+), 12 deletions(-) create mode 100644 target/linux/orion/base-files/lib/upgrade/platform.sh create mode 100644 target/linux/orion/patches/101-wnr854t_partition_map.patch diff --git a/target/linux/orion/base-files/lib/upgrade/platform.sh b/target/linux/orion/base-files/lib/upgrade/platform.sh new file mode 100644 index 0000000000..def241d4b5 --- /dev/null +++ b/target/linux/orion/base-files/lib/upgrade/platform.sh @@ -0,0 +1,23 @@ +# use default "image" for PART_NAME +# use default for platform_do_upgrade() + +platform_check_image() { + [ "${ARGC}" -gt 1 ] && { echo 'Too many arguments. Only flash file expected.'; return 1; } + + local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo` + local magic="$(get_magic_word "$1")" + + case "${hardware}" in + # hardware with padded uImage + padded rootfs + 'Netgear WNR854T' | 'Linksys WRT350N v2') + [ "${magic}" != '2705' ] && { + echo "Invalid image type ${magic}." + return 1 + } + return 0 + ;; + esac + + echo "Sysupgrade is not yet supported on ${hardware}." + return 1 +} diff --git a/target/linux/orion/patches/100-openwrt_partition_map.patch b/target/linux/orion/patches/100-openwrt_partition_map.patch index 1fd4652b07..bef4a54e84 100644 --- a/target/linux/orion/patches/100-openwrt_partition_map.patch +++ b/target/linux/orion/patches/100-openwrt_partition_map.patch @@ -1,25 +1,32 @@ --- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c +++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c -@@ -58,19 +58,11 @@ static struct mtd_partition wrt350n_v2_n +@@ -58,11 +58,11 @@ static struct mtd_partition wrt350n_v2_nor_flash_partitions { .name = "kernel", .offset = 0x00000000, - .size = 0x00760000, -+ .size = 0x00100000, ++ .size = 0x00100000, // change to kernel mtd size here (1/3) }, { .name = "rootfs", - .offset = 0x001a0000, ++ .offset = 0x00100000, // change to kernel mtd size here (2/3) - .size = 0x005c0000, -- }, { -- .name = "lang", -- .offset = 0x00760000, -- .size = 0x00040000, -- }, { -- .name = "nvram", -- .offset = 0x007a0000, -- .size = 0x00020000, -+ .offset = 0x00100000, -+ .size = 0x00650000, ++ .size = 0x00650000, // adopt to kernel mtd size here (3/3) = 0x00750000 - }, { + .name = "lang", + .offset = 0x00760000, +@@ -75,6 +79,14 @@ static struct mtd_partition wrt350n_v2_nor_flash_partitions .name = "u-boot", .offset = 0x007c0000, + .size = 0x00040000, ++ }, { ++ .name = "eRcOmM_do_not_touch", ++ .offset = 0x00750000, ++ .size = 0x00010000, // erasesize ++ }, { ++ .name = "image", // for sysupgrade ++ .offset = 0x00000000, ++ .size = 0x00750000, + }, + }; + diff --git a/target/linux/orion/patches/101-wnr854t_partition_map.patch b/target/linux/orion/patches/101-wnr854t_partition_map.patch new file mode 100644 index 0000000000..4e96038ed7 --- /dev/null +++ b/target/linux/orion/patches/101-wnr854t_partition_map.patch @@ -0,0 +1,13 @@ +--- a/arch/arm/mach-orion5x/wnr854t-setup.c ++++ b/arch/arm/mach-orion5x/wnr854t-setup.c +@@ -67,6 +67,10 @@ static struct mtd_partition wnr854t_nor_flash_partitions + .name = "uboot", + .offset = 0x00760000, + .size = 0x00040000, ++ }, { ++ .name = "image", // for sysupgrade ++ .offset = 0x00000000, ++ .size = 0x00760000, + }, + }; + -- 2.25.1