aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-03-20 08:49:08 +0000
committerJohn Crispin <blogic@openwrt.org>2015-03-20 08:49:08 +0000
commit5ca24d776ac144b91015cec44537f21ad2a1aa2d (patch)
tree615568ecc2f4c9ce4f045a56f711c01bfb31eaf1 /target
parent22417246f0c33ed065319f552a54b55c2f954481 (diff)
downloadmaster-187ad058-5ca24d776ac144b91015cec44537f21ad2a1aa2d.tar.gz
master-187ad058-5ca24d776ac144b91015cec44537f21ad2a1aa2d.tar.bz2
master-187ad058-5ca24d776ac144b91015cec44537f21ad2a1aa2d.zip
octeon: add er8 sysupgrade support
Signed-off-by: John Crispin <blogic@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@44902 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/octeon/Makefile2
-rwxr-xr-xtarget/linux/octeon/base-files/lib/upgrade/platform.sh61
-rw-r--r--target/linux/octeon/config-3.185
-rw-r--r--target/linux/octeon/image/Makefile46
-rw-r--r--target/linux/octeon/patches-3.18/160-cmdline-hack.patch47
5 files changed, 119 insertions, 42 deletions
diff --git a/target/linux/octeon/Makefile b/target/linux/octeon/Makefile
index fb5360a7f4..e1739e70e5 100644
--- a/target/linux/octeon/Makefile
+++ b/target/linux/octeon/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
ARCH:=mips64
BOARD:=octeon
BOARDNAME:=Cavium Networks Octeon
-FEATURES:=squashfs jffs2 ext4 pci usb
+FEATURES:=squashfs jffs2 ext4 initramfs pci usb
CPU_TYPE:=octeon
CPU_CFLAGS_octeon:=-march=octeon -mabi=64
MAINTAINER:=John Crispin <blogic@openwrt.org>
diff --git a/target/linux/octeon/base-files/lib/upgrade/platform.sh b/target/linux/octeon/base-files/lib/upgrade/platform.sh
index ad075d5652..4cb03bc984 100755
--- a/target/linux/octeon/base-files/lib/upgrade/platform.sh
+++ b/target/linux/octeon/base-files/lib/upgrade/platform.sh
@@ -35,36 +35,50 @@ platform_copy_config() {
esac
}
+platform_do_flash() {
+ local tar_file=$1
+ local board=$2
+ local kernel=$3
+ local rootfs=$4
+
+ mkdir -p /boot
+ mount -t vfat /dev/$kernel /boot
+
+ [ -f /boot/vmlinux.64 -a ! -L /boot/vmlinux.64 ] && {
+ mv /boot/vmlinux.64 /boot/vmlinux.64.previous
+ mv /boot/vmlinux.64.md5 /boot/vmlinux.64.md5.previous
+ }
+
+ echo "flashing kernel to /dev/$kernel"
+ tar xf $tar_file sysupgrade-$board/kernel -O > /boot/vmlinux.64
+ md5sum /boot/vmlinux.64 | cut -f1 -d " " > /boot/vmlinux.64.md5
+ echo "flashing rootfs to ${rootfs}"
+ tar xf $tar_file sysupgrade-$board/root -O | dd of="${rootfs}" bs=4096
+ sync
+ umount /boot
+}
+
platform_do_upgrade() {
+ local tar_file="$1"
local board=$(octeon_board_name)
local rootfs="$(platform_get_rootfs)"
+ local kernel=
[ -b "${rootfs}" ] || return 1
-
case "$board" in
erlite)
- local tar_file="$1"
- local kernel_length=`(tar xf $tar_file sysupgrade-erlite/kernel -O | wc -c) 2> /dev/null`
- local rootfs_length=`(tar xf $tar_file sysupgrade-erlite/root -O | wc -c) 2> /dev/null`
-
- mkdir -p /boot
- mount -t vfat /dev/sda1 /boot
-
- [ -f /boot/vmlinux.64 -a ! -L /boot/vmlinux.64 ] && {
- mv /boot/vmlinux.64 /boot/vmlinux.64.previous
- mv /boot/vmlinux.64.md5 /boot/vmlinux.64.md5.previous
- }
-
- tar xf $tar_file sysupgrade-erlite/kernel -O > /boot/vmlinux.64
- md5sum /boot/vmlinux.64 | cut -f1 -d " " > /boot/vmlinux.64.md5
- tar xf $tar_file sysupgrade-erlite/root -O | dd of="${rootfs}" bs=4096
- sync
- umount /boot
- return 0
+ kernel=sda1
+ ;;
+ er)
+ kernel=mmcblk0p1
;;
+ *)
+ return 1
esac
- return 1
+ platform_do_flash $tar_file $board $kernel $rootfs
+
+ return 0
}
@@ -72,10 +86,11 @@ platform_check_image() {
local board=$(octeon_board_name)
case "$board" in
- erlite)
+ erlite | \
+ er)
local tar_file="$1"
- local kernel_length=`(tar xf $tar_file sysupgrade-erlite/kernel -O | wc -c) 2> /dev/null`
- local rootfs_length=`(tar xf $tar_file sysupgrade-erlite/root -O | wc -c) 2> /dev/null`
+ local kernel_length=`(tar xf $tar_file sysupgrade-$board/kernel -O | wc -c) 2> /dev/null`
+ local rootfs_length=`(tar xf $tar_file sysupgrade-$board/root -O | wc -c) 2> /dev/null`
[ "$kernel_length" = 0 -o "$rootfs_length" = 0 ] && {
echo "The upgarde image is corrupt."
return 1
diff --git a/target/linux/octeon/config-3.18 b/target/linux/octeon/config-3.18
index 032146e804..44a154aeb7 100644
--- a/target/linux/octeon/config-3.18
+++ b/target/linux/octeon/config-3.18
@@ -16,7 +16,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
CONFIG_ARCH_WANT_OLD_COMPAT_IPC=y
-# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set
CONFIG_BINFMT_ELF32=y
CONFIG_BLK_DEV_SD=y
CONFIG_BLOCK_COMPAT=y
@@ -126,6 +125,7 @@ CONFIG_HZ=250
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
CONFIG_HZ_PERIODIC=y
+CONFIG_IMAGE_CMDLINE_HACK=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_IOMMU_HELPER=y
CONFIG_IRQCHIP=y
@@ -146,7 +146,6 @@ CONFIG_MIPS32_O32=y
CONFIG_MIPS_L1_CACHE_SHIFT=7
CONFIG_MIPS_L1_CACHE_SHIFT_7=y
# CONFIG_MIPS_MACHINE is not set
-# CONFIG_MIPS_PARAVIRT is not set
CONFIG_MIPS_PGD_C0_CONTEXT=y
CONFIG_MMC=y
CONFIG_MMC_BLOCK=y
@@ -154,6 +153,7 @@ CONFIG_MMC_OCTEON=y
# CONFIG_MMC_TIFM_SD is not set
CONFIG_MODULES_USE_ELF_REL=y
CONFIG_MODULES_USE_ELF_RELA=y
+CONFIG_MTD_BLOCK2MTD=y
# CONFIG_MTD_CFI_INTELEXT is not set
CONFIG_MTD_CMDLINE_PARTS=y
# CONFIG_MTD_COMPLEX_MAPPINGS is not set
@@ -204,7 +204,6 @@ CONFIG_SCSI=y
CONFIG_SECCOMP=y
CONFIG_SECCOMP_FILTER=y
CONFIG_SERIAL_8250_DW=y
-CONFIG_SERIAL_EARLYCON=y
CONFIG_SMP=y
CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_STATIC=y
diff --git a/target/linux/octeon/image/Makefile b/target/linux/octeon/image/Makefile
index f06dd6bcfe..24bca9b48d 100644
--- a/target/linux/octeon/image/Makefile
+++ b/target/linux/octeon/image/Makefile
@@ -7,30 +7,46 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
-define Image/BuildKernel
+define Image/BuildKernel/Template
# Workaround pre-SDK-1.9.0 u-boot versions not handling the .notes section
- $(TARGET_CROSS)strip -R .notes $(KDIR)/vmlinux.elf -o $(BIN_DIR)/$(IMG_PREFIX)-vmlinux.elf
- $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
- dd if=$(KDIR)/vmlinux.bin.l7 of=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux.lzma bs=65536 conv=sync
- $(CP) $(KDIR)/vmlinux.elf $(BIN_DIR)/vmlinux.64
- md5sum $(BIN_DIR)/vmlinux.64 | cut -d " " -f 1 | tee $(BIN_DIR)/vmlinux.64.md5
+ $(TARGET_CROSS)strip -R .notes $(KDIR)/vmlinux.elf -o $(BIN_DIR)/$(IMG_PREFIX)-$(1)-vmlinux.64
+ $(STAGING_DIR_HOST)/bin/patch-cmdline $(BIN_DIR)/$(IMG_PREFIX)-$(1)-vmlinux.64 '$(strip $(2))'
+ md5sum $(BIN_DIR)/$(IMG_PREFIX)-$(1)-vmlinux.64 | cut -d " " -f 1 | tee $(BIN_DIR)/$(IMG_PREFIX)-$(1)-vmlinux.64.md5
endef
-define Image/Build/squashfs
- $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
+define Image/BuildKernel/Initramfs/Template
+ $(TARGET_CROSS)strip -R .notes $(KDIR)/vmlinux-initramfs.elf -o $(BIN_DIR)/$(IMG_PREFIX)-$(1)-vmlinux-initramfs.elf
+ $(STAGING_DIR_HOST)/bin/patch-cmdline $(BIN_DIR)/$(IMG_PREFIX)-$(1)-vmlinux-initramfs.elf '$(strip $(2))'
+endef
+
+ER_CMDLINE:=-mtdparts=phys_mapped_flash:640k(boot0)ro,640k(boot1)ro,64k(eeprom)ro block2mtd.block2mtd=/dev/mmcblk0p2,65536,rootfs,5 root=/dev/mtdblock3 rootfstype=squashfs rootwait
+
+define Image/BuildKernel
+ $(call Image/BuildKernel/Template,generic,)
+ $(call Image/BuildKernel/Template,er,$(ER_CMDLINE))
endef
-define Image/Build/ext4/erlite
- mkdir -p $(KDIR)/sysupgrade-erlite/
- echo "BOARD=erlite" > $(KDIR)/sysupgrade-erlite/CONTROL
- $(CP) $(KDIR)/vmlinux.elf $(KDIR)/sysupgrade-erlite/kernel
- $(CP) $(KDIR)/root.ext4 $(KDIR)/sysupgrade-erlite/root
+define Image/BuildKernel/Initramfs
+ $(call Image/BuildKernel/Initramfs/Template,generic,)
+ $(call Image/BuildKernel/Initramfs/Template,er,$(ER_CMDLINE))
+endef
+
+define Image/Build/sysupgrade
+ mkdir -p $(KDIR)/sysupgrade-$(1)/
+ echo "BOARD=er" > $(KDIR)/sysupgrade-$(1)/CONTROL
+ $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(2)-vmlinux.64 $(KDIR)/sysupgrade-$(1)/kernel
+ $(CP) $(KDIR)/root.$(3) $(KDIR)/sysupgrade-$(1)/root
(cd $(KDIR); $(TAR) cvf \
- $(BIN_DIR)/$(IMG_PREFIX)-erlite-sysupgrade.tar sysupgrade-erlite)
+ $(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.tar sysupgrade-$(1))
endef
define Image/Build/ext4
- $(call Image/Build/ext4/erlite)
+ $(call Image/Build/sysupgrade,erlite,generic,ext4)
+endef
+
+define Image/Build/squashfs
+ $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
+ $(call Image/Build/sysupgrade,er,er,squashfs)
endef
define Image/Build
diff --git a/target/linux/octeon/patches-3.18/160-cmdline-hack.patch b/target/linux/octeon/patches-3.18/160-cmdline-hack.patch
new file mode 100644
index 0000000000..39b8a99ae5
--- /dev/null
+++ b/target/linux/octeon/patches-3.18/160-cmdline-hack.patch
@@ -0,0 +1,47 @@
+--- a/arch/mips/cavium-octeon/setup.c
++++ b/arch/mips/cavium-octeon/setup.c
+@@ -609,6 +609,35 @@
+ write_c0_derraddr1(0);
+ }
+
++#ifdef CONFIG_IMAGE_CMDLINE_HACK
++extern char __image_cmdline[];
++
++static int __init octeon_use_image_cmdline(void)
++{
++ char *p = __image_cmdline;
++ int replace = 0;
++
++ if (*p == '-') {
++ replace = 1;
++ p++;
++ }
++
++ if (*p == '\0')
++ return 0;
++
++ if (replace) {
++ strlcpy(arcs_cmdline, p, sizeof(arcs_cmdline));
++ } else {
++ strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));
++ strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));
++ }
++
++ return 1;
++}
++#else
++static inline int octeon_use_image_cmdline(void) { return 0; }
++#endif
++
+ /**
+ * Early entry point for arch setup
+ */
+@@ -798,6 +827,8 @@
+ }
+ }
+
++ octeon_use_image_cmdline();
++
+ if (strstr(arcs_cmdline, "console=") == NULL) {
+ #ifdef CONFIG_CAVIUM_OCTEON_2ND_KERNEL
+ strcat(arcs_cmdline, " console=ttyS0,115200");