AnsweredAssumed Answered

MX28 Linux upgrade

Question asked by Vladimir Ovseychuk on Mar 14, 2016
Latest reply on Mar 15, 2016 by Vladimir Ovseychuk

Hello, Dear Everyone!

I'm trying to update firmware on my own board (MX28+NAND+OpenWrt). My partition is:

mtd0mtd1mtd2mtd3mtd4
MTDubootuboot_envfdtkernelroot
Size3M256k128k5M-
UBIroofsrootfs_data
Size40M-

My bootcmd:

  • nand read 0x41000000 fdt ${filesize_fdt};
  • nand read 0x42000000 kernel ${filesize_kernel};
  • bootm 0x42000000 - 0x41000000

My bootargs:

console=ttyAPP4,115200 rootfstype=ubifs ubi.mtd=4 root=ubi0:rootfs rw mtdparts=gpmi-nand:3m(bootloader)ro,256k(environment),128k(fdt),5m(kernel),-(root)

I can update my system succesfully with U-Boot:

  • tftp 0x42000000 my_board.dtb ;       /* Device Tree */
  • nand erase.part fdt ;
  • nand write 0x42000000 fdt ${filesize} ;
  • tftp 0x42000000 openwrt-mxs-uImage ; /* Kernel */
  • nand erase.part kernel ;
  • nand write 0x42000000 kernel ${filesize} ;
  • tftp 0x42000000 rootfs.ubifs ;       /* UBIFS rootfs Image */
  • nand erase.part root ;
  • ubi part root ;
  • ubi create rootfs 0x2A00000 ;
  • ubi create rootfs_data ;
  • ubi write 0x42000000 rootfs ${filesize} ;

But I want to update the system on working Linux. I've read about sysupgrade and found that it doesn't support automatic upgrade.

So I'm trying to create a simple updating script. First of all, sysupgrade script was cutted to few functions:

#!/bin/sh

. /lib/functions.sh

. /lib/functions/system.sh

mkdir /tmp/root

kill_remaining TERM

sleep 3

kill_remaining KILL

v "Switching to ramdisk..."

run_ramfs

It works correctly, and I can switch to RAM.

Next step is updating volumes. fdt and kernel was updated correctly with mtd erase/write. But when I try to rewrite ubi0_0 (rootfs), I see:

@TestTest:/# ubiupdatevol dev/ubi0_0 /tmp/root/rootfs.ubifs

[  853.082273] UBI error: ubi_open_volume: cannot open device 0, volume 0, error -16

ubiupdatevol: can't open 'dev/ubi0_0': Device or resource busy

What's next? Can you help me with this issue?

Thanks in advance,

Vladimir

Outcomes