Hello, Dear Everyone!
I'm trying to update firmware on my own board (MX28+NAND+OpenWrt). My partition is:
mtd0 | mtd1 | mtd2 | mtd3 | mtd4 | ||
MTD | uboot | uboot_env | fdt | kernel | root | |
Size | 3M | 256k | 128k | 5M | - | |
UBI | roofs | rootfs_data | ||||
Size | 40M | - |
My bootcmd:
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:
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
I believe it makes sense to post it also on mtd mail list
Memory Technology Device (MTD) Subsystem for Linux.
Best regards
igor
Thank you for suggestions. But I have read and tried that all already, wrote at openwrt and linux forums - no answer. =/
You might want to ask this on openwrt-devel or a related list. I'd run lsof on /dev/ubi0_0 and see what process is keeping the resource busy.
Already done. lsof | grep ubi - no output.
fuser /dev/ubi0_0 :
1 528 1741 ...
But I can't kill 1
1 is init. Maybe when you switch to ramdisk, rootfs is not unmounted (or unmounted properly) so the ubi update command cannot work on it. You can check the output of the "mount" command and see if the filesystem is still mounted. Maybe rootfs can never be unmounted, I don't know.
I think someone familiar with openwrt would be better equipped to answer this question.