[Problem] Boot freezes on /sbin/init after repack

stefanoIT

Neuer User
Mitglied seit
11 Jul 2007
Beiträge
67
Punkte für Reaktionen
1
Punkte
0
I'm using Freetz revision 13373
I unpacked the firmware 6.30 for 7362SL using fwmod -u.
I made some modifications.
I repacked it with fwmod -p

I updated the FB with new firmware but during the reboot it freezes.
This is what I see using a serial cable.

Code:
    [    2.340000] [avmnet] [avmnet_swi_7port_disable_learning] Configuring CPU-port                                                                               to receive all unknown unicast frames 0x68
    [    2.350000] [avmnet] [avmnet_swi_7port_disable_learning] Configuring CPU-port                                                                               to receive all unknown multicast frames 0x68
    [    2.460000] [avmnet] [avmnet_links_port_update] Maximum port number 0 exceede                                                                              d with 2!
    [    2.470000] [avm_event_source_trigger]: not registered
    [    2.470000] [avmnet] [avmnet_links_port_update] Maximum port number 0 exceede                                                                              d with 2!
    [    5.130000] [avm_pa_multiplexer_init] start
    [    5.130000] [avm_pa_multiplexer_init] init complete
    [    5.140000] [avm_pa_multiplexer_register_instance]
    [    5.140000]  add:avmnet_7port_pce_add_session+0x0/0x5a0
    [    5.140000]  remove:avmnet_7port_pce_remove_session+0x0/0x80
    [    5.160000] kernel_init: basic setup done
    [    5.170000] SQUASHFS error: Can't find a SQUASHFS superblock on mtdblock3
    [    5.170000] yaffs: dev is 32505859 name is "mtdblock3" ro
    [    5.180000] yaffs: passed flags ""
    [    5.210000] VFS: Mounted root (yaffs filesystem) readonly on device 31:3.
    [    5.210000] Freeing unused kernel memory: 212k freed
    [    5.240000] Warning: unable to open an initial console.
    [    5.240000] trying /sbin/init

did I something wrong in repacking the firmware?
 
Zuletzt bearbeitet:
Not an easy question, for we are not sure about the mentioned "some modifications" you did...

One obvious point: Sure, your busybox is still containing "init" and the link at /sbin/init is still there?
 
I simply added a second languare.


I unpacked the new firmware and checked the link
Code:
lrwxrwxrwx  1 steve steve     14 Sep 14 20:49 ifconfig -> ../bin/busybox
lrwxrwxrwx  1 steve steve     14 Sep 14 20:49 ifdown -> ../bin/busybox
lrwxrwxrwx  1 steve steve     14 Sep 14 20:49 ifup -> ../bin/busybox
lrwxrwxrwx  1 steve steve     14 Sep 14 20:49 init -> ../bin/busybox
lrwxrwxrwx  1 steve steve     14 Sep 14 20:49 insmod -> ../bin/busybox
it is present.

Could be a glue the message "unable to open console" before it stucks?
 
I unpacked the new firmware and checked the link
I'd assume, you've checked the wrong "init" symlink.

The 7362SL is a NAND based box and the mounted root filesystem at the moment of the message "trying /sbin/init" is the yaffs2 filesystem from the wrapper partition. The associated /etc/inittab has to switch to the "core root filesystem" (that is the SquashFS image "filesystem_core.squashfs") now ... if you can start the device from the alternative partition set, you could inspect the content of the yaffs2 partition.
 
The files under filesystem_core are very similar:
Code:
drwxr-x---  2 steve steve 4096 Jul 13 15:37 .
drwxrwxrwx 11 steve steve 4096 Sep  7 16:54 ..
lrwxrwxrwx  1 steve steve    8 Sep 14 20:49 ar7login_frominternet -> ar7login
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 arp -> ../bin/busybox
lrwxrwxrwx  1 steve steve   17 Sep 14 20:49 blkid -> ../usr/sbin/blkid
lrwxrwxrwx  1 steve steve    4 Sep 14 20:49 dsltest -> dsld
-rwxr-x--x  1 steve steve 6470 Jul 13 15:37 flash_update
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 halt -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 ifconfig -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 ifdown -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 ifup -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 init -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 insmod -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 localize -> /sbin/eventadd
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 lsmod -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 modprobe -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 pivot_root -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 poweroff -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 reboot -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 rmmod -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 route -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 setconsole -> ../bin/busybox
lrwxrwxrwx  1 steve steve   18 Sep 14 20:49 showaddrs -> /./sbin/showroutes
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 switch_root -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 sysctl -> ../bin/busybox
lrwxrwxrwx  1 steve steve   14 Sep 14 20:49 vconfig -> ../bin/busybox

I have one doubt now: the modifications must be done under filesystem or under filesystem_core or both? The filesystem_core is untouched.
This is the script I created to do the modifications I need.

Code:
#!/bin/bash
WORKDIR="$1"
SCNDSRC="$2"
ORG=$WORKDIR/original/filesystem
SRC=$SCNDSRC/original/filesystem
DST=$WORKDIR/modified/filesystem

DEFSRC=$SRC/etc/default.Fritz_Box_HW196
DEFDST=$DST/etc/default.Fritz_Box_HW203

#modified
mkdir -p $WORKDIR/modified
cp -a $WORKDIR/original/* $WORKDIR/modified/
touch $WORKDIR/.modified

#libreria
cp -af $SRC/lib/libtiinterpreter.so.0.0.0 $DST/lib/

#html
cp -af $SRC/etc/htmltext_*.db $DST/etc/
rm -f $DST/etc/htmltext.db
ln -sf /etc/htmltext_en.db $DST/etc/htmltext.db

#language
cp -af $SRC/etc/*.language $DST/etc/

#default
cp -af $SRC/etc/default.0* $DST/etc/
cp -af $SRC/etc/default.99 $DST/etc/
ln -sf internal_memory_default_de $DST/etc/internal_memory_default_en
ln -sf internal_memory_default_de $DST/etc/internal_memory_default_es
ln -sf internal_memory_default_de $DST/etc/internal_memory_default_it
ln -sf internal_memory_default_de $DST/etc/internal_memory_default_fr
ln -sf internal_memory_default_de $DST/etc/internal_memory_default_pl

#default.Fritz
rm -rf $DEFDST/1und1
mv $DEFDST/avm $DEFDST/avme
cp -af $DEFSRC/avme/it $DEFDST/avme/
cp -af $DEFSRC/avme/en $DEFDST/avme/
cp -af $DEFSRC/avme/es $DEFDST/avme/
cp -af $DEFSRC/avme/fr $DEFDST/avme/
cp -af $DEFSRC/avme/pl $DEFDST/avme/
cp -af $DEFSRC/avme/de $DEFDST/avme/
cp -af $DEFSRC/avme/provider* $DEFDST/avme/

#www
rm -rf $DST/usr/www/1und1
rm -rf $DST/usr/www.myfritz/1und1
rm -rf $DST/usr/www.nas/1und1
mv  $DST/usr/www/avm $DST/usr/www/avme
mv $DST/usr/www.myfritz/avm $DST/usr/www.myfritz/avme
mv $DST/usr/www.nas/avm $DST/usr/www.nas/avme
rm -rf $DST/usr/www.myfritz/avme/*
rm -rf $DST/usr/www.nas/avme/*
cp -rxv  $SRC/usr/www.myfritz/avme/* $DST/usr/www.myfritz/avme
cp -rxv  $SRC/usr/www.nas/avme/* $DST/usr/www.nas/avme

#tam
rm -rf $DST/usr/share/tam/msg/default/*
cp -xrv $SRC/usr/share/tam/msg/default/* $DST/usr/share/tam/msg/default

#add telnetd
ln -sf ../../bin/busybox $DST/usr/sbin/telnetd
 
Zuletzt bearbeitet:
I noticed an importan difference on boot.

The working boot (original kernel) uses mtdblock1
Code:
[    5.170000] kernel_init: basic setup done
[    5.170000] SQUASHFS error: Can't find a SQUASHFS superblock on mtdblock1
[    5.180000] yaffs: dev is 32505857 name is "mtdblock1" ro
[    5.180000] yaffs: passed flags ""
[    5.210000] VFS: Mounted root (yaffs filesystem) readonly on device 31:1.
[    5.210000] Freeing unused kernel memory: 212k freed
[    5.260000] trying /sbin/init
[    5.470000] [squashfs] use zip compression

The not working one (repacked) uses mtdblock3 (it freezes after last line)
Code:
[    5.160000] kernel_init: basic setup done
[    5.170000] SQUASHFS error: Can't find a SQUASHFS superblock on mtdblock3
[    5.170000] yaffs: dev is 32505859 name is "mtdblock3" ro
[    5.180000] yaffs: passed flags ""
[    5.210000] VFS: Mounted root (yaffs filesystem) readonly on device 31:3.
[    5.220000] Freeing unused kernel memory: 212k freed
[    5.240000] Warning: unable to open an initial console.
[    5.240000] trying /sbin/init

Why mtdblock changes when I repack the firmware?
It could be a bug in freetz trunk revision 13386.
This is the repacking phase
Code:
STEP 1: UNPACK
unpacking firmware image
Skipping 0 Bytes garbage...unpacking update image
    Reading a different endian SQUASHFS filesystem on ../FRITZ.Box_7362_SL.131.06.30.image.mod/original/firmware/var/tmp/filesystem.image
    Filesystem on ../FRITZ.Box_7362_SL.131.06.30.image.mod/original/firmware/var/tmp/filesystem.image is gzip compressed (3:0)
    Parallel unsquashfs: Using 1 processor
    184 inodes (485 blocks) to write
    created 7 files
    created 11 directories
    created 91 symlinks
    created 86 devices
    created 0 fifos
unpacking filesystem image
    Reading a different endian SQUASHFS filesystem on ../FRITZ.Box_7362_SL.131.06.30.image.mod/original/filesystem_core/filesystem_core.squashfs
    Filesystem on ../FRITZ.Box_7362_SL.131.06.30.image.mod/original/filesystem_core/filesystem_core.squashfs is gzip compressed (3:0)
    Parallel unsquashfs: Using 1 processor
    3777 inodes (4264 blocks) to write
    created 3179 files
    created 217 directories
    created 512 symlinks
    created 86 devices
    created 0 fifos
unpacking var.tar
done.

detected firmware 7362-SL_de 131.06.30 rev30889 (13.07.2015 15:36:42)

STEP 3: PACK
WARNING: Modifications (STEP 2) and this step should never
         ever be run with different configurations!
         This can result in invalid images!!!
  checking for left over Subversion directories
  integrate freetz info file into image
packing var.tar
creating filesystem image
  SquashFS block size: 64 kB (65536 bytes)
copying kernel image
  kernel image size: 1.9 MB, max 4.0 MB, free 2.1 MB (2233088 bytes)
copying filesystem image
  filesystem image size: 19.9 MB, max 48.0 MB, free 28.1 MB (29413376 bytes)
packing dl/fw/FRITZ.Box_7362_SL.131.06.30.image.mod/7362_-.de_20150923-123444.image
  image file size: 22.5 MB
done.

If I unpack the new firmware I will find more files than in the original one.

Code:
STEP 1: UNPACK
unpacking firmware image
Skipping 0 Bytes garbage...unpacking update image
    Reading a different endian SQUASHFS filesystem on ../7362SL.image.mod/original/firmware/var/tmp/filesystem.image
    Filesystem on ../7362SL.image.mod/original/firmware/var/tmp/filesystem.image is gzip compressed (3:0)
    Parallel unsquashfs: Using 1 processor
    184 inodes (424 blocks) to write
    created 93 files
    created 11 directories
    created 91 symlinks
    created 0 devices
    created 0 fifos

93 files insteaf of 7 in the first part and this is really strange.
The files are present in unpacked firmware and this is the list of files present in filesystem_core

Code:
./sbin/flash_update
./tmp/mtab
./bin/busybox
./filesystem_core.squashfs
./etc/inittab
./dev/avm_net_trace0
./dev/avm_net_trace162
./dev/loop2
./dev/mtdblock3
./dev/avm_net_trace163
./dev/ttyp2
./dev/mtd1
./dev/avm_net_trace138
./dev/avm_net_trace129
./dev/avm_net_trace160
./dev/mtd0
./dev/loop7
./dev/avm_net_trace131
./dev/avm_net_trace130
./dev/ttyS1
./dev/loop5
./dev/avm_net_trace140
./dev/tty
./dev/led
./dev/mtdblock1
./dev/mtdblock0
./dev/ttyp1
./dev/mtd2
./dev/mtdblock12
./dev/mtdblock2
./dev/mtd12
./dev/mtdblock7
./dev/mem
./dev/mtdblock14
./dev/mtd5
./dev/mtd14
./dev/avm_net_trace135
./dev/loop3
./dev/mtdblock15
./dev/mtdblock10
./dev/null
./dev/mtd13
./dev/avm_net_trace136
./dev/mtd8
./dev/avm_net_trace134
./dev/mtdblock8
./dev/loop1
./dev/loop6
./dev/mtdblock11
./dev/avm_net_trace137
./dev/mtd3
./dev/mtd15
./dev/mtdblock4
./dev/mtd9
./dev/mtdblock5
./dev/tty0
./dev/console
./dev/avm_net_trace143
./dev/mtdblock13
./dev/ttyp0
./dev/loop4
./dev/loop0
./dev/avm_net_trace141
./dev/mtdblock6
./dev/mtd10
./dev/pts/0
./dev/pts/6
./dev/pts/3
./dev/pts/7
./dev/pts/1
./dev/pts/5
./dev/pts/2
./dev/pts/4
./dev/tiatm
./dev/avm_net_trace128
./dev/avm_net_trace132
./dev/mtd6
./dev/mtdblock9
./dev/avm_net_trace161
./dev/avm_net_trace142
./dev/zero
./dev/mtd11
./dev/ttyS0
./dev/avm_net_trace133
./dev/kmem
./dev/urandom
./dev/avm_net_trace139
./dev/mtd4
./dev/random
./dev/mtd7
./dev/ptmx
./lib/libuClibc-0.9.33.2.so
./lib/ld-uClibc-0.9.33.2.so
 
Zuletzt bearbeitet:
It's normal behavior and Freetz isn't responsible, which partition will be used.

The 7362SL device contains two independent partition sets (MTD0/1 and MTD2/3), each of them containing a filesystem partition (mtdblock1 or mtdblock3) and a kernel partition (mtdblock0 or mtdblock2).

If you use the update script from vendor (Freetz uses this too), the currently inactive set will be written to and after the update was completed successfully, the system will be switch (with an environment variable via /proc/sys/urlader/environment) to the other partition set.

I've no idea, what went wrong with your own image ... but it has (my opinion) nothing to do with the "hot flash capability" of the 7362SL. If the box comes up to the WLAN initialization with your own image (the LED behavior described would suggest this), you should be able to get some log infos from the device before it's restarted (usually by a watchdog timer).

By the way ... if you only want the original system to be "repacked", you could use "modfs" too ... the embedded README file is rather old and does not consider the latest changes, but you could read the (german) thread here (you could try to use an automatic translator) and if there will remain any questions, you can write in english there (there're some other postings in english already).
 
Zuletzt bearbeitet:
Just for the records. The device never restarts. It remains blocked on trying /sbin/init for ever.

In your opinion, the numer of files present in filesystem_code is important? Thanks.
 
I found the devices under /dev are not properly created during packing.
I can't fix this because it's a fwmod behavior
 
Zuletzt bearbeitet:
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.