From patchwork Fri Jul 17 17:18:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Randolf X-Patchwork-Id: 497232 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 25477140295 for ; Sat, 18 Jul 2015 03:19:01 +1000 (AEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 34E53284502; Fri, 17 Jul 2015 19:18:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 1C0FC2843EE for ; Fri, 17 Jul 2015 19:18:16 +0200 (CEST) X-policyd-weight: using cached result; rate:hard: -7.6 Received: from postler.einfach.org (postler.einfach.org [5.9.2.179]) by arrakis.dune.hu (Postfix) with ESMTP for ; Fri, 17 Jul 2015 19:18:16 +0200 (CEST) Received: from shiva.lan (unknown [46.25.203.84]) by postler.einfach.org (Postfix) with ESMTPA id 69B6CC43; Fri, 17 Jul 2015 17:18:39 +0000 (UTC) From: Bruno Randolf To: openwrt-devel@lists.openwrt.org Date: Fri, 17 Jul 2015 18:18:32 +0100 Message-Id: <1437153513-28082-1-git-send-email-br1@einfach.org> X-Mailer: git-send-email 1.9.1 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (postler.einfach.org [0.0.0.0]); Fri, 17 Jul 2015 17:18:40 +0000 (UTC) X-Virus-Scanned: clamav-milter 0.98.7 at bced1da0f74a X-Virus-Status: Clean Cc: Bruno Randolf Subject: [OpenWrt-Devel] [PATCH 1/2] CC: brcm2708: Add sysupgrade for Rasperry Pi X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" The upgrade procedure works similar to the x86 platforms: The configuration files (sysupgrade.tgz) are saved in the boot partition and moved to the standard place in a preinit script. Since the boot partition is FAT32 we need the vfat modules and dependencies. Signed-off-by: Bruno Randolf --- target/linux/brcm2708/Makefile | 3 ++- .../brcm2708/base-files/lib/preinit/79_move_config | 18 ++++++++++++++++++ .../linux/brcm2708/base-files/lib/upgrade/platform.sh | 17 +++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 target/linux/brcm2708/base-files/lib/preinit/79_move_config create mode 100644 target/linux/brcm2708/base-files/lib/upgrade/platform.sh diff --git a/target/linux/brcm2708/Makefile b/target/linux/brcm2708/Makefile index 30f6e1d..37ff204 100644 --- a/target/linux/brcm2708/Makefile +++ b/target/linux/brcm2708/Makefile @@ -19,7 +19,8 @@ SUBTARGETS:=bcm2708 bcm2709 KERNEL_PATCHVER:=3.18 include $(INCLUDE_DIR)/target.mk -DEFAULT_PACKAGES += brcm2708-gpu-fw kmod-usb-hid kmod-sound-core kmod-sound-arm-bcm2835 +DEFAULT_PACKAGES += brcm2708-gpu-fw kmod-usb-hid kmod-sound-core kmod-sound-arm-bcm2835 \ + kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 define Target/Description Build firmware image for Broadcom BCM2708/BCM2709 SoC devices. diff --git a/target/linux/brcm2708/base-files/lib/preinit/79_move_config b/target/linux/brcm2708/base-files/lib/preinit/79_move_config new file mode 100644 index 0000000..7bcea7b --- /dev/null +++ b/target/linux/brcm2708/base-files/lib/preinit/79_move_config @@ -0,0 +1,18 @@ +#!/bin/sh +# Copyright (C) 2015 OpenWrt.org + +BOOTPART=/dev/mmcblk0p1 + +move_config() { + if [ -b $BOOTPART ]; then + insmod nls_cp437 + insmod nls_iso8859-1 + insmod fat + insmod vfat + mount -t vfat -o rw,noatime $BOOTPART /mnt + [ -f /mnt/sysupgrade.tgz ] && mv -f /mnt/sysupgrade.tgz / + umount /mnt + fi +} + +boot_hook_add preinit_mount_root move_config diff --git a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh new file mode 100644 index 0000000..3e1ee00 --- /dev/null +++ b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh @@ -0,0 +1,17 @@ +platform_check_image() { + # i know no way to verify the image + return 0; +} + +platform_do_upgrade() { + sync + get_image "$1" | dd of=/dev/mmcblk0 bs=2M conv=fsync + sleep 1 +} + +platform_copy_config() { + mount -t vfat -o rw,noatime /dev/mmcblk0p1 /mnt + cp -af "$CONF_TAR" /mnt/ + sync + umount /mnt +}