Time to start a new thread, I think. Continued from: Experimental: NFI2CF
Using the tools from the link above, a backup to .nfi format should be possible. Compared to my earlier attempts, this should be pretty safe since it's working through the file system, and only the standard image making tools from OE is used.
The script:
Code
#! /usr/bin/python
# Backup /boot and / and create an nfi file
import sys, os
if len(sys.argv) < 2:
raise "Usage: %s FILE" % (sys.argv[0])
mnts = open("/proc/mounts", "r")
ignores = ''
for line in mnts.readlines():
mntpt = line.split()[1]
if mntpt == '/': continue
ignores += ' --ignore=' + mntpt
mnts.close()
os.environ['PATH'] += ':.'
os.system("mount -o ro,remount /")
# Awful, but just dumping the whole partition won't work
os.system("dd if=/dev/mtd/1 bs=32k of=secondstage.gz")
os.system("gunzip secondstage.gz")
os.system("gzip secondstage")
#
os.system("mkfs.jffs2 -v --root=/boot --faketime --output=boot.jffs2 --eraseblock=0x4000 -n -l")
os.system("mkfs.jffs2 -v --root=/ --faketime --output=root.jffs2 --eraseblock=0x4000 -n -l" + ignores)
os.system("buildimage secondstage.gz boot.jffs2 root.jffs2 dm7025 > " + sys.argv[1])
#
os.unlink("secondstage.gz")
os.unlink("boot.jffs2")
os.unlink("root.jffs2")
os.system("mount -o rw,remount /")
Alles anzeigen
It can only be run from a file system that is different from the root file system, e.g. from a harddisk partition.
Please find the complete tool-box (including this script) attached.
Does anybody care to test it and report back? I've only made a backup and unpacked the resulting nfi file, I have not tried to actually flash it yet.