[OpenWrt-Devel] Raspberry Pi 2 sysupgrade

Matthias Schiffer mschiffer at universe-factory.net
Fri Jul 10 14:21:21 EDT 2015


On 07/08/2015 07:42 PM, Bruno Randolf wrote:
> 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.

I think it would be nice to put the gzip command into an
ifneq ($(CONFIG_TARGET_IMAGES_GZIP),) check. CONFIG_TARGET_IMAGES_GZIP
defaults to y, but is currently only respected on x86... I guess it
would make sense to handle it on other targets with ext4 images as well.

Matthias

> 
> 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
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20150710/c905fda4/attachment.sig>
-------------- next part --------------
_______________________________________________
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