 |
The Zaurus Message Board Zaurus forum and FAQ.
|
| View previous topic :: View next topic |
| Author |
Message |
singadriano
Joined: 14 Mar 2003 Posts: 6 Location: sydney
|
Posted: Thu Apr 10, 2003 3:25 am Post subject: How to read/mount/mofify initrd.bin |
|
|
Hi,
to read initrd.bin on your PC (maybe people know here, but in case...)
1- compile your kernel on your PC with right stuff:
> include jffs2 in your kernel
> in "Memory Technology Devices (MTD)" Enable MTD
support as a module.
> Activate "Direct char device access to MTD devices"
and "Caching block device access to MTD devices".
> In "Self-contained MTD device drivers", activate the
module "Test driver using RAM" with MTDRAM device
size=32768 and MTDRAM erase block size=256 and
the module "MTD emulation using block device".
> In the top-level section "Block Devices", enable the
module "Loopback device support"
That is what i have in my kernel (ZLIB/MTD/JFFS2):
# Memory Technology Devices (MTD)
CONFIG_MTD=m
# CONFIG_MTD_DEBUG is not set
CONFIG_MTD_PARTITIONS=m
CONFIG_MTD_CONCAT=m
# CONFIG_MTD_REDBOOT_PARTS is not set
CONFIG_MTD_CHAR=m
CONFIG_MTD_BLOCK=m
# CONFIG_MTD_BLOCK_RO is not set
# CONFIG_MTD_CFI is not set
# CONFIG_MTD_JEDECPROBE is not set
# CONFIG_MTD_GEN_PROBE is not set
# CONFIG_MTD_CFI_INTELEXT is not set
# CONFIG_MTD_CFI_AMDSTD is not set
CONFIG_MTD_RAM=m
CONFIG_MTD_ROM=m
CONFIG_MTD_ABSENT=m
# CONFIG_MTD_OBSOLETE_CHIPS is not set
# CONFIG_MTD_AMDSTD is not set
# CONFIG_MTD_SHARP is not set
# CONFIG_MTD_JEDEC is not set
# CONFIG_MTD_PHYSMAP is not set
# CONFIG_MTD_PNC2000 is not set
# CONFIG_MTD_SC520CDP is not set
# CONFIG_MTD_NETSC520 is not set
# CONFIG_MTD_SBC_GXX is not set
# CONFIG_MTD_ELAN_104NC is not set
# CONFIG_MTD_DILNETPC is not set
# CONFIG_MTD_MIXMEM is not set
# CONFIG_MTD_OCTAGON is not set
# CONFIG_MTD_VMAX is not set
# CONFIG_MTD_L440GX is not set
# CONFIG_MTD_AMD766ROM is not set
# CONFIG_MTD_ICH2ROM is not set
# CONFIG_MTD_PCI is not set
# Self-contained MTD device drivers
# CONFIG_MTD_PMC551 is not set
# CONFIG_MTD_SLRAM is not set
CONFIG_MTD_MTDRAM=m
CONFIG_MTDRAM_TOTAL_SIZE=32768
CONFIG_MTDRAM_ERASE_SIZE=256
CONFIG_MTD_BLKMTD=m
# CONFIG_MTD_DOC1000 is not set
# CONFIG_MTD_DOC2000 is not set
# CONFIG_MTD_DOC2001 is not set
# CONFIG_MTD_DOCPROBE is not set
CONFIG_MTD_NAND=m
CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_NAND_VERIFY_WRITE=y
CONFIG_JFFS2_FS=m
CONFIG_JFFS2_FS_DEBUG=1
CONFIG_ZLIB_INFLATE=m
CONFIG_ZLIB_DEFLATE=m
2- reboot...
3- Create some mtd devices:
# mkdir /dev/mtdblock
# cd /dev/mtdblock
# mknod 0 b 31 0
# mknod 1 b 31 1
# mknod 2 b 31 2
4- insert the appropriates modules:
# modprobe mtdram total_size=32768 erase_size=256 (32 Mb RAM)
# modprobe mtdblock
# modprob jffs2
5- mount the mtd device
dd if=initrd.bin of=/dev/mtdblock/0 (copy the root image to the device )
6- mount the mtd filesystem
mount -t jffs2 /dev/mtdblock/0 /mnt/mtd0
That should work...
# ll /mnt/mtd0
total 0
drwxr-sr-x 1 root root 0 May 20 2002 bin
drwxr-xr-x 1 root root 0 Jan 28 02:54 boot
drwxr-xr-x 1 root root 0 Jan 28 02:55 dev
lrwxrwxrwx 1 root root 9 Jan 28 02:54 etc -> /home/etc
drwxr-xr-x 1 root root 0 Jan 28 02:55 home
drwxr-xr-x 1 root root 0 Jan 28 02:56 lib
lrwxrwxrwx 1 root root 8 Jan 28 02:54 mnt -> /var/mnt
drwxr-xr-x 1 root root 0 Jan 28 02:56 opt
drwxr-xr-x 1 root root 0 Jan 28 02:54 proc
drwxr-xr-x 1 root root 0 Jan 28 02:58 root
drwxr-xr-x 1 root root 0 Jan 28 02:56 sbin
lrwxrwxrwx 1 root root 12 Jan 28 02:54 tmp -> /dev/shm/tmp
drwxr-sr-x 1 root root 0 Jan 28 02:56 usr
lrwxrwxrwx 1 root root 16 Jan 28 02:57 var -> /home/system/var
# df | grep mtd
/dev/mtdblock/0 32768 25260 7508 78% /mnt/mtd0
Cheers / singadriano |
|
| Back to top |
|
 |
singadriano
Joined: 14 Mar 2003 Posts: 6 Location: sydney
|
Posted: Fri Apr 11, 2003 10:38 pm Post subject: How to read/mount/mofify initrd.bin |
|
|
How to read/mount/mofify initrd.bin
Hi there,
just one think here, there is a mistake:
| Quote: | 4- insert the appropriates modules:
# modprobe mtdram total_size=32768 erase_size=256 (32 Mb RAM)
# modprobe mtdblock
# modprob jffs2
|
The mtdram module has to be loaded with the corresponding size and
eraze_size values extracted from /proc/mtd (got from the c700):
dev: size erasesize name
mtd0 006d0000 00020000 "Filesystem"
mtd1 00700000 00004000 "smf"
mtd2 01900000 00004000 "root"
mtd3 02000000 00004000 "home"
i.e. to mount "root":
# modprobe mtdram total_size=25600 erase_size=16
16(dec) = 4000(hex) / 1024(dec)
25600(dec) = 1900000(hex) / 1024(dec)
--------------------
Does anybody know what "Filesystem" and "smf" stand for (there are not in jffs2 format...) ?
Cheers / adriano |
|
| Back to top |
|
 |
blowkj
Joined: 03 May 2004 Posts: 1 Location: UK
|
Posted: Mon May 03, 2004 4:08 am Post subject: How to save modified initrd.ban |
|
|
| The
above works fine for and I can access the initrd,bin files. I've
modified them and want to create a new version of initrd.bin. The
ireverse dd command works fine but now I've increased the size I'm not
sure how many records to transfer. If I don't specify the count
paramater it creates a maximum size file which is not really needed.
Can i use du to simply work out the size? |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB 2.0.4 © 2001, 2002 phpBB Group
|