mount image file’s partition
fdisk -ul image.img You must set cylinders. You can do this from the extra functions menu. Disk image-sda: 0 MB, 0 bytes 255 heads, 63 sectors/track, 0 cylinders, total 0 sectors Units = sectors of 1 * 512 = 512 bytes Device Boot Start End Blocks Id System image.img * 63 78140159 39070048+ 7 HPFS/NTFS Partition 1 has different physical/logical endings: phys=(1023, 254, 63) logical=(4863, 254, 63)
# mount -o loop,offset='''32256''' -t auto image.img mnt/
JFFS2
-----
#!/bin/bash
if [ $# -eq 0 ]; then
echo $0 JFFS2_IMAGE_FILE
exit
fi
modprobe mtdram total_size=44576 erase_size=128
modprobe mtdblock
dd if="$1" of=/dev/mtdblock0
mount -t jffs2 /dev/mtdblock0 m
———
cat /proc/mtd for information of mtd device
.——————-
unpack: rootfs
cat rootfs.gz | lzma -d | cpio -id -H newc
or
cat rootfs.gz | gunzip -c | cpio -id -H newc
pack:
dd if=/dev/zero of=rootfs1 bs=1k count=8192
mke2fs -q -F -m 0 -i 1024 rootfs1
mkdir -p rfs
sudo mount -t ext2 -o loop rootfs1 rfs
cd rfs
tar –exclude=”*/lib*\.a” –exclude=”*/man/*” –exclude=”*/include/*” -cpf – * | \
sudo tar -C rfs -xf –
// sudo chown -h -R 0:0 rfs
find ./rfs | cpio -o -H newc | gzip -9 > rootfs.gz
sudo umount rfs
//gzip -9 -c rootfs1 > rootfs.gz
better to unpack with
cpio -id --no-absolute-filenames
or you will smash your linux…