I want to modify my ZyXEL P-2812HNU-F1 dsl router by storing some extra files in /etc. However, /etc is mounted as tmpfs so changes are lost on reboot. But there's probably a way around it ;)
# cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / yaffs2 ro,relatime 0 0
tmpfs /etc tmpfs rw,relatime 0 0
[..snip..]
/dev/mtdblock4 /mnt/Config yaffs2 rw,relatime 0 0
/dev/mtdblock3 /mnt/firmware yaffs2 rw,relatime 0 0
# touch /am-i-really-mounted-rw
touch: /am-i-really-mounted-rw: Read-only file system
# cat /proc/mtd
dev: size erasesize name
mtd0: 01e00000 00020000 "rootfs,kernel1"
mtd1: 01e00000 00020000 "rootfs,kernel2"
mtd2: 00ac0000 00020000 "reserve"
mtd3: 02cc0000 00020000 "firmware"
mtd4: 00aa0000 00020000 "config"
mtd5: 00040000 00020000 "mrd_cert1"
mtd6: 00040000 00020000 "mrd_cert2"
# cat /proc/cmdline
root=/dev/mtdblock0 rootfstype=yaffs2 console=ttyS0,115200 phym=128M mem=126M panic=1 vpe1_load_addr=0x87e00000M vpe1_mem=2M vpe1_wired_tlb_entries=0
# uname -a
Linux router 2.6.32.42 #25 Mon Oct 5 14:41:26 CST 2015 mips unknown
So,
- Why is / mounted rw but actually read-only?
- Why are there two rootfs/kernel partitions? So the router can flash itself while running and then switch to the other upon boot?
- Can I safely copy the running kernel/rootfs to the other mtdblock by using dd?
- How do I boot from the other mtblock? I got a USB FTDI cable already.
- Or, is there another way to write persistent files to /etc here?
/etc/mtab
and/proc/mounts
?mount
usually does is just printing contents of/etc/mtab
while the kernel has its own partition table stored in/proc/mounts
. These days/etc/mtab
is usually just a symlink to/proc/mounts
but your mileage may vary.