From 788312ae298c61a530a828a33cb0e77e92d40c1e Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Fri, 15 Feb 2008 11:38:31 +0100 Subject: [PATCH] add alternating mechanism and flash scripts for ipe337 - add scripts to flash kernel & environment from U-Boot - add mechanism to check which of the two kernels to boot - add script to initialize the ageing partition - cosmetic changes to the init-scripts --- .gitattributes | 1 + board/ipe337/env/bin/_alternate | 9 +++++++++ board/ipe337/env/bin/magic.bin | 1 + board/ipe337/env/bin/reset_ageing | 27 +++++++++++++++++++++++++ board/ipe337/env/bin/update_application | 8 ++++++++ board/ipe337/env/bin/update_persistent | 8 ++++++++ board/ipe337/env/bin/update_system | 14 +++++++++++++ board/ipe337/env/bin/update_ubootenv | 8 ++++++++ 8 files changed, 76 insertions(+) create mode 100644 .gitattributes create mode 100644 board/ipe337/env/bin/_alternate create mode 100644 board/ipe337/env/bin/magic.bin create mode 100644 board/ipe337/env/bin/reset_ageing create mode 100644 board/ipe337/env/bin/update_application create mode 100644 board/ipe337/env/bin/update_persistent create mode 100644 board/ipe337/env/bin/update_system create mode 100644 board/ipe337/env/bin/update_ubootenv diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..c24dffe1b --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.bin -crlf -diff -merge diff --git a/board/ipe337/env/bin/_alternate b/board/ipe337/env/bin/_alternate new file mode 100644 index 000000000..10ae2134c --- /dev/null +++ b/board/ipe337/env/bin/_alternate @@ -0,0 +1,9 @@ +#!/bin/sh + +. /env/config + +alternate $ageing +if [ $? -lt 2 ]; then + echo "Error when accesing ageing-partition!" + exit 1 +fi diff --git a/board/ipe337/env/bin/magic.bin b/board/ipe337/env/bin/magic.bin new file mode 100644 index 000000000..f8bff393c --- /dev/null +++ b/board/ipe337/env/bin/magic.bin @@ -0,0 +1 @@ +(i \ No newline at end of file diff --git a/board/ipe337/env/bin/reset_ageing b/board/ipe337/env/bin/reset_ageing new file mode 100644 index 000000000..2c95ae762 --- /dev/null +++ b/board/ipe337/env/bin/reset_ageing @@ -0,0 +1,27 @@ +#!/bin/sh + +. /env/config + +image=/env/bin/magic.bin +part=$ageing + +if [ \! -e "$part" ]; then + echo "Partition $part does not exist" + exit 1 +fi + +unprotect $part + +echo +echo "Erasing partition $part" +erase $part + +echo +echo "Creating magic" +cp $image $part + +echo +echo "Testing partition" +. /env/bin/_alternate + +protect $part diff --git a/board/ipe337/env/bin/update_application b/board/ipe337/env/bin/update_application new file mode 100644 index 000000000..46ad210e3 --- /dev/null +++ b/board/ipe337/env/bin/update_application @@ -0,0 +1,8 @@ +#!/bin/sh + +. /env/config + +image=$appimage +part=/dev/nor0.application + +. /env/bin/_update $1 diff --git a/board/ipe337/env/bin/update_persistent b/board/ipe337/env/bin/update_persistent new file mode 100644 index 000000000..a869b2218 --- /dev/null +++ b/board/ipe337/env/bin/update_persistent @@ -0,0 +1,8 @@ +#!/bin/sh + +. /env/config + +image=$perimage +part=/dev/nor0.persistent + +. /env/bin/_update $1 diff --git a/board/ipe337/env/bin/update_system b/board/ipe337/env/bin/update_system new file mode 100644 index 000000000..ac2e3e89a --- /dev/null +++ b/board/ipe337/env/bin/update_system @@ -0,0 +1,14 @@ +#!/bin/sh + +. /env/config + +image=$jffs2 + +alternate $ageing +if [ $? = 2 ]; then + part=/dev/nor0.system0 +else + part=/dev/nor0.system1 +fi + +. /env/bin/_update $1 diff --git a/board/ipe337/env/bin/update_ubootenv b/board/ipe337/env/bin/update_ubootenv new file mode 100644 index 000000000..301072ff5 --- /dev/null +++ b/board/ipe337/env/bin/update_ubootenv @@ -0,0 +1,8 @@ +#!/bin/sh + +. /env/config + +image=$envimage +part=/dev/nor0.ubootenv + +. /env/bin/_update $1