[OpenWrt-Devel] Raspberry Pi 2 sysupgrade

Bruno Randolf br1 at einfach.org
Wed Jul 8 13:42:52 EDT 2015


Hi!

I have the below change to add rudimentary support for sysupgrade on the
Raspberry Pi. I looked at the way platform_copy_config() is implemented
for x86 and tried to do the same, but I get the following error on mount:

mount: mounting /dev/mmcblk0p2 on /mnt failed: Device or resource busy

I believe I'd need some way to re-read the partition table after the dd
command. How does it work on x86? Any ideas?

Also would it be OK to gzip the sdcard image to save space? It
compresses from 76M to 11M.

Below is the diff, but this is not a properly formatted patch, yet.

bruno

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..95ade38
--- /dev/null
+++ b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,19 @@
+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
+}
+
+## mount does not work. I think I'd need to re-read the partition table!
+#platform_copy_config() {
+#      echo "*** platform_copy_config called" > /dev/console
+#      mount -t ext4 -o rw,noatime /dev/mmcblk0p2 /mnt
+#      cp -af "$CONF_TAR" /mnt/
+#      umount /mnt
+#      echo "*** platform_copy_config done" > /dev/console
+#}
diff --git a/target/linux/brcm2708/image/Makefile
b/target/linux/brcm2708/image/Makefile
index e70bdd0..095cf0d 100644
--- a/target/linux/brcm2708/image/Makefile
+++ b/target/linux/brcm2708/image/Makefile
@@ -28,6 +28,7 @@ define Image/Build/RaspberryPi
        mcopy -i $(KDIR)/boot.img $(KDIR)/Image ::kernel.img  # Copy
OpenWrt built kernel
        ./gen_rpi_sdcard_img.sh
$(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img $(KDIR)/boot.img
$(KDIR)/root.$(1) \
                $(CONFIG_BRCM2708_SD_BOOT_PARTSIZE)
$(CONFIG_TARGET_ROOTFS_PARTSIZE)
+       gzip -k -f $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img
 endef

 define Image/Build
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list