Quantcast
Channel: Linux Device Hacking
Viewing all 47024 articles
Browse latest View live

Re: Flash NAND with bad blocks

$
0
0
kent_c,

> Yes, the plan is to flash U-Boot via the serial
> console. I can currently log into the stock OS via
> both the serial console and telnet.
> I am not sure about the source of the
> OpenWrt-provided U-Boot,...
>

If you can log into stock OS, then you can flash new u-boot image uboot.2017.07-tld-1.nsa310.mtd0.kwb in there. It is easier.

Stock dmesg
Bad eraseblock 116 at 0x000000e80000
Bad eraseblock 413 at 0x0000033a0000

These 2 bad blocks are way out of mtd0 (the 1st 1MB, i.e. blocks 0 to 7), which is where the new u-boot and its envs will be.

Stock dmesg
9 cmdlinepart partitions found on MTD device nand_mtd
Using command line partition definition
Creating 9 MTD partitions on "nand_mtd":
0x000000000000-0x000000100000 : "uboot"

So you can follow the instruction in the u-boot released thread and flash it in stock OS shell.

Right up front in Section A, you will also need to download the flashing binaries (stock OS does not have them).

Quote

A. Flashing Instruction:


Installation is the same for each u-Boot image, the instruction below is written to include all boxes. So choose the platform name that you are installing for, and copy/paste the appropriate commands.

If you are running kernel that do not provide mtd-utils and uboot-tools (fw_setenv, fw_printenv, flash_erase, nandwrite), you can download the NAND and U-Boot tools binaries here in this thread.

Re: Install Debian on old GoFlex Home

$
0
0
Hi Bodhi,

I will have to procure a usb to sata adapter to connect the sata drive to my Laptop for executing above maneuver, which I will order.

Is there an alternate way to copy the required rootfs files without having to physically remove the drive from Goflex-Home box? I was wondering since I can access the sata drive which is running on Goflex-home box, via ssh as root from laptop running mint, is it possible to just copy the fresh rootfs file to the appropriate directory on the sata HDD and untar it, enter the required parameters, remove the Boot USB from GoFlex-Home Box and reboot, hoping that fresh rootfs on sata will take over?

Here is what I am thinking:

Since I am running Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 with uboot.2017.07-tld-1.goflexhome.bodhi.tar, on my GoFlex Home Box, I should be able to:

1) Login as root on different Linux machine.
2) Download and Copy Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 to appropriate directory of Sata HDD attached to GoFlex-Home Box .
(sudo scp Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 root@192.168.x.x:/appropriate Directory)

3) SSH via terminal to Goflex-home box which is booting from usb drive and login as root.
4) Untar this Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 file to the same directory.
(cd /sda1/appropriate Directory
tar -xjf Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2)

5) If needed make any configuration changes to boot from this new HD drive.
6) Shutdown the Goflex-home box.
7) Remove the usb flash drive from Goflex-home box.
8) Reboot the Goflex-home box.
9) Hopefully boot into a fresh Debian install running on Gflex-home sata.
10) Freshly install needed apps i.e. samba, transmission etc.

can this work?

Regards,

Navi

Re: Flash NAND with bad blocks

$
0
0
I also looked now at the actual addresses of those 2 bad blocks. They are both far outside of bootloader's area, that's good, so I'm confident to try an install.

But I still have my original concern: what happens when I try to install a Linux system after the bootloader? With my pretty limited understanding, I see two main ways of doing this:
1. Flash a pre-made image directly, like I had in mind. I do not know the exact effect of the last 2 commands from my original post and whether the bad blocks would still be recognized afterwards.
2. Like the tutorial at http://projects.doozan.com/debian, by running fdisk, then creating filesystems, then copying over the files.

What would be a safe way for the installation?

Re: Flash NAND with bad blocks

$
0
0
kent_c,


> But I still have my original concern: what happens
> when I try to install a Linux system after the
> bootloader?

After the new u-boot is installed, you can install OpenWrt in NAND, or install Debian on USB. As long as you're not touching mtd0, it is safe to do any thing you want.

> 1. Flash a pre-made image directly, like I had in
> mind. I do not know the exact effect of the last 2
> commands from my original post and whether the bad
> blocks would still be recognized afterwards.

Since I'm not seeing the entire OpenWrt installation procedure here, I can only advise in general terms.

Generally speaking, when you format the ubi partition, UBIFS will manage the bad blocks correctly. And at a lower level, NAND driver also manages and skips the bad blocks properly. That is the reason why a good installtion procedure always has some empty area at the end of a NAND partition (to account for skipped bad blocks).

So suppose your ubi partition is 120MB, an image that resides in that partition should be a little less, eg. 115MB. When you write the 115MB image, it will take more than 115MB if there are bad blocks in the middle.

Re: Install Debian on old GoFlex Home

$
0
0
Navi,

> is it possible to just copy the
> fresh rootfs file to the appropriate directory on
> the sata HDD and untar it, enter the required
> parameters, remove the Boot USB from GoFlex-Home
> Box and reboot, hoping that fresh rootfs on sata
> will take over?

Yes. If it is the fresh rootfs then sure, it will work.

Your steps look good except step 4.

4) Untar this Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 file to the top directory. Assuming the HDD is mounted at /media/sda1.
cd /media/sda1
tar -xjf /media/sda1/appropriate Directory/Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2

Re: NETGEAR STORA - Bad Magic Number

$
0
0
Dirk,

kwboot again, and interrupt serial console, setenv for the DTB like you did, and also redefine mtdparts

setenv mtdparts 'mtdparts=orion_nand:1M(uboot),4M@(kernel),-(rootfs)'
and boot
boot

In Debian

cat /proc/mtd
And try flashing u-boot again.

Please post the entire serial console log if there were errors.

Re: Install Debian on old GoFlex Home

$
0
0
Hi Bodhi,

That worked. Now I am booting from HDD.

Regards,

Navi

Re: Flash NAND with bad blocks

$
0
0
bodhi, thank you for the info!
I plan to go ahead with OpenWrt, for now at least, as I'm more familiar with it (their installation procedure is at https://openwrt.org/toh/zyxel/nsa310b).

In any case, reading these forums, I can see that I am lucky with this device, as there is always a way to bring it back to life in case of problems, and the serial booting is a very nice feature.
And I plan to read some more about the low level details of flash memory.

Re: Install Debian on old GoFlex Home

$
0
0
Navi,

> 1) Should I upgrade to
> linux-4.20.6-kirkwood-tld-1-bodhi.tar.bz2 ?

Yes. There are a lot of benefits in running the latest kernel.

> 2) Is it possible to use some kind of splitter on
> Sata port to attach two HDDs to GoFlexHome?

What you can do is to connect a SATA to eSATA cable, and use an eSATA enclosure for 2 HDDs.

Re: NETGEAR STORA - Bad Magic Number

$
0
0
Hi Bodhi,
same issue...
Hit any key to stop autoboot:  0 
Netgear Stora> setenv dtb_file /boot/dts/kirkwood-netgear_stora_ms2000.dtb
Netgear Stora> setenv mtdparts 'mtdparts=orion_nand:1M(uboot),4M@(kernel),-(rootfs)'
Netgear Stora> printenv
arcNumber=2743
baudrate=115200
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm$load_uimage_addr; fi; fi
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
console=console=ttyS0,115200
device=0:1
devices=usb ide
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-netgear_stora_ms2000.dtb
ethact=egiga0
ethaddr=52:3b:20:9c:11:51
if_netconsole=ping $serverip
ipaddr=192.168.0.231
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_dtb_addr=0x1c00000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_initrd_addr=0x1100000
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
load_uimage_addr=0x800000
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(uboot),4M@(kernel),-(rootfs)
partition=nand0,2
preboot_nc=run if_netconsole start_netconsole
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 $load_uimage_addr /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
serverip=192.168.0.220
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
usb_ready_retry=15

Environment size: 2898/131068 bytes
Netgear Stora> boot
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 
Use USB retry period from the environment: 15 second(s)
1 Storage Device(s) found

Reset IDE: ide_preinit failed

Partition Map for USB device 0  --   Partition Type: DOS

Part	Start Sector	Num Sectors	UUID		Type
  1	2048      	30029824  	2384b32d-01	83

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0
loading envs from usb 0 ...
** File not found /boot/uEnv.txt **

no IDE devices available
running scan_disk ...
Scan device usb
device usb 0:1
1 bytes read in 692 ms (0 Bytes/s)
Found bootable drive on usb 0
loading uImage ...
3821592 bytes read in 817 ms (4.5 MiB/s)
loading uInitrd ...
7245696 bytes read in 793 ms (8.7 MiB/s)
loading DTB /boot/dts/kirkwood-netgear_stora_ms2000.dtb ...
11869 bytes read in 2614 ms (3.9 KiB/s)
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   Linux-4.12.1-kirkwood-tld-1
   Created:      2017-07-20   8:11:24 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3821528 Bytes = 3.6 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 01100000 ...
   Image Name:   initramfs-4.12.1-kirkwood-tld-1
   Created:      2017-07-24   0:18:23 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    7245632 Bytes = 6.9 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 01c00000
   Booting using the fdt blob at 0x1c00000
   Loading Kernel Image ... OK
   Loading Ramdisk to 03917000, end 03ffff40 ... OK
   Loading Device Tree to 03911000, end 03916e5c ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.12.1-kirkwood-tld-1 (root@tldDebian) (gcc version 4.9.2 (Debian 4.9.2-10) ) #1 PREEMPT Sat Jul 15 21:40:50 PDT 2017
[    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: NETGEAR MS2000 / MS2110 aka Stora
[    0.000000] Memory policy: Data cache writeback
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=orion_nand:1M(uboot),4M@(kernel),-(rootfs)
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Memory: 109420K/131072K available (8192K kernel code, 716K rwdata, 1972K rodata, 1024K init, 288K bss, 21652K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc8800000 - 0xff800000   ( 880 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0900000   (9184 kB)
[    0.000000]       .init : 0xc0c00000 - 0xc0d00000   (1024 kB)
[    0.000000]       .data : 0xc0d00000 - 0xc0db3274   ( 717 kB)
[    0.000000]        .bss : 0xc0db9b9c - 0xc0e01e60   ( 289 kB)
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns
[    0.000009] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 10737418237ns
[    0.000051] Switching to timer-based delay loop, resolution 5ns
[    0.000619] Console: colour dummy device 80x30
[    0.000661] Calibrating delay loop (skipped), value calculated using timer frequency.. 400.00 BogoMIPS (lpj=2000000)
[    0.000689] pid_max: default: 32768 minimum: 301
[    0.000923] Security Framework initialized
[    0.001073] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.001096] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.002133] CPU: Testing write buffer coherency: ok
[    0.003359] Setting up static identity map for 0x100000 - 0x100058
[    0.003686] mvebu-soc-id: MVEBU SoC ID=0x6281, Rev=0x3
[    0.007640] devtmpfs: initialized
[    0.012959] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.012992] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.013465] prandom: seed boundary self test passed
[    0.017973] prandom: 100 self tests passed
[    0.017988] pinctrl core: initialized pinctrl subsystem
[    0.019382] NET: Registered protocol family 16
[    0.019944] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.021981] cpuidle: using governor ladder
[    0.022069] cpuidle: using governor menu
[    0.022594] Feroceon L2: Enabling L2
[    0.022650] Feroceon L2: Cache support initialised.
[    0.023084] [Firmware Info]: /ocp@f1000000/ethernet-controller@72000/ethernet0-port@0: local-mac-address is not set
[    0.029196] No ATAGs?
[    0.040434] vgaarb: loaded
[    0.040826] SCSI subsystem initialized
[    0.041395] usbcore: registered new interface driver usbfs
[    0.041487] usbcore: registered new interface driver hub
[    0.041593] usbcore: registered new device driver usb
[    0.042945] clocksource: Switched to clocksource orion_clocksource
[    0.150617] VFS: Disk quotas dquot_6.6.0
[    0.150710] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.163477] NET: Registered protocol family 2
[    0.164352] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.164383] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.164409] TCP: Hash tables configured (established 1024 bind 1024)
[    0.164514] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.164544] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.164757] NET: Registered protocol family 1
[    0.165253] RPC: Registered named UNIX socket transport module.
[    0.165267] RPC: Registered udp transport module.
[    0.165276] RPC: Registered tcp transport module.
[    0.165285] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.165566] Unpacking initramfs...
[    0.958519] Freeing initrd memory: 7076K
[    0.958684] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.959834] audit: initializing netlink subsys (disabled)
[    0.960425] Initialise system trusted keyrings
[    0.960486] Key type blacklist registered
[    0.960617] audit: type=2000 audit(0.957:1): state=initialized audit_enabled=0 res=1
[    0.960726] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    0.960809] zbud: loaded
[    0.961980] NFS: Registering the id_resolver key type
[    0.962014] Key type id_resolver registered
[    0.962025] Key type id_legacy registered
[    0.962046] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.962059] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    0.962295] jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
[    0.962529] fuse init (API version 7.26)
[    0.963058] orangefs_debugfs_init: called with debug mask: :none: :0:
[    0.963363] orangefs_init: module version upstream loaded
[    0.963376] SGI XFS with ACLs, security attributes, realtime, no debug enabled
[    2.552953] random: fast init done
[    8.015786] Key type asymmetric registered
[    8.015806] Asymmetric key parser 'x509' registered
[    8.015885] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[    8.015898] io scheduler noop registered
[    8.015908] io scheduler deadline registered
[    8.016008] io scheduler cfq registered (default)
[    8.017501] kirkwood-pinctrl f1010000.pin-controller: registered pinctrl driver
[    8.019774] mvebu-pcie mbus@f1000000:pcie-controller@82000000: PCI host bridge to bus 0000:00
[    8.019799] pci_bus 0000:00: root bus resource [io  0x1000-0xfffff]
[    8.019815] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xefffffff]
[    8.019832] pci_bus 0000:00: root bus resource [bus 00-ff]
[    8.020231] PCI: bus0: Fast back to back transfers disabled
[    8.020259] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    8.020451] PCI: bus1: Fast back to back transfers enabled
[    8.020542] pci 0000:00:01.0: PCI bridge to [bus 01]
[    8.021194] mv_xor f1060800.xor: Marvell shared XOR driver
[    8.083997] mv_xor f1060800.xor: Marvell XOR (Registers Mode): ( xor cpy sg intr )
[    8.084259] mv_xor f1060900.xor: Marvell shared XOR driver
[    8.143855] mv_xor f1060900.xor: Marvell XOR (Registers Mode): ( xor cpy sg intr )
[    8.144373] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    8.145959] console [ttyS0] disabled
[    8.146037] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 26, base_baud = 12500000) is a 16550A
[    8.797550] console [ttyS0] enabled
[    8.811320] loop: module loaded
[    8.815222] sata_mv f1080000.sata: slots 32 ports 2
[    8.823547] scsi host0: sata_mv
[    8.827239] scsi host1: sata_mv
[    8.830680] ata1: SATA max UDMA/133 irq 33
[    8.834860] ata2: SATA max UDMA/133 irq 33
[    8.839871] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xda
[    8.846379] nand: Samsung NAND 256MiB 3,3V 8-bit
[    8.851019] nand: 256 MiB, MLC, erase size: 4096 KiB, page size: 4096, OOB size: 128
[    8.858833] nand: WARNING: f4000000.nand: the ECC used on your system is too weak compared to the one required by the NAND chip
[    8.870392] Scanning device for bad blocks
[    8.878685] 3 cmdlinepart partitions found on MTD device orion_nand
[    8.885008] Creating 3 MTD partitions on "orion_nand":
[    8.890185] 0x000000000000-0x000000100000 : "uboot"
[    8.895114] mtd: partition "uboot" doesn't end on an erase block -- force read-only
[    8.904401] 0x000000000000-0x000000400000 : "kernel"
[    8.910904] 0x000000400000-0x000010000000 : "rootfs"
[    8.918980] libphy: Fixed MDIO Bus: probed
[    8.924200] libphy: orion_mdio_bus: probed
[    8.928340] [Firmware Warn]: /ocp@f1000000/mdio-bus@72004/ethernet-phy@8: Whitelisted compatible string. Please remove
[    8.945225] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
[    9.174441] ata1: SATA link down (SStatus 0 SControl F300)
[    9.524425] ata2: SATA link down (SStatus 0 SControl F300)
[   10.054546] mv643xx_eth_port mv643xx_eth_port.0 eth0: port 0 with MAC address 52:3b:20:9c:11:51
[   10.063465] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   10.070053] ehci-pci: EHCI PCI platform driver
[   10.074622] ehci-orion: EHCI orion driver
[   10.078902] orion-ehci f1050000.ehci: EHCI Host Controller
[   10.084603] orion-ehci f1050000.ehci: new USB bus registered, assigned bus number 1
[   10.092522] orion-ehci f1050000.ehci: irq 30, io mem 0xf1050000
[   10.122987] orion-ehci f1050000.ehci: USB 2.0 started, EHCI 1.00
[   10.129307] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[   10.136166] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   10.143453] usb usb1: Product: EHCI Host Controller
[   10.148355] usb usb1: Manufacturer: Linux 4.12.1-kirkwood-tld-1 ehci_hcd
[   10.155111] usb usb1: SerialNumber: f1050000.ehci
[   10.160606] hub 1-0:1.0: USB hub found
[   10.164494] hub 1-0:1.0: 1 port detected
[   10.169182] usbcore: registered new interface driver usb-storage
[   10.175689] mousedev: PS/2 mouse device common for all mice
[   10.522987] usb 1-1: new high-speed USB device number 2 using orion-ehci
[   10.734529] usb 1-1: New USB device found, idVendor=0781, idProduct=5583
[   10.741293] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   10.748510] usb 1-1: Product: Ultra Fit
[   10.752372] usb 1-1: Manufacturer: SanDisk
[   10.756512] usb 1-1: SerialNumber: 4C530000041215115005
[   10.762781] usb-storage 1-1:1.0: USB Mass Storage device detected
[   10.769373] scsi host2: usb-storage 1-1:1.0
[   11.202979] rtc-mv f1010300.rtc: internal RTC not ticking
[   11.208622] i2c /dev entries driver
[   11.219276] rtc-pcf8563 0-0051: rtc core: registered rtc-pcf8563 as rtc0
[   11.229410] hidraw: raw HID events driver (C) Jiri Kosina
[   11.235365] drop_monitor: Initializing network drop monitor service
[   11.241954] NET: Registered protocol family 17
[   11.246557] Key type dns_resolver registered
[   11.251777] registered taskstats version 1
[   11.255936] Loading compiled-in X.509 certificates
[   11.260819] zswap: loaded using pool lzo/zbud
[   11.277471] Key type big_key registered
[   11.292804] Key type encrypted registered
[   11.300046] rtc-pcf8563 0-0051: setting system clock to 2019-02-04 20:54:52 UTC (1549313692)
[   11.313198] Freeing unused kernel memory: 1024K
Loading, please wait...
starting version 232
[   11.846136] usbcore: registered new interface driver uas
[   11.853137] scsi 2:0:0:0: Direct-Access     SanDisk  Ultra Fit        1.00 PQ: 0 ANSI: 6
[   11.871479] sd 2:0:0:0: [sda] 30031872 512-byte logical blocks: (15.4 GB/14.3 GiB)
[   11.885979] sd 2:0:0:0: [sda] Write Protect is off
[   11.897200] sd 2:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[   11.920517]  sda: sda1
[   11.927968] sd 2:0:0:0: [sda] Attached SCSI removable disk
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... done.
Warning: fsck not present, so skipping root file system
[   22.591856] EXT4-fs (sda1): INFO: recovery required on readonly filesystem
[   22.598983] EXT4-fs (sda1): write access will be enabled during recovery
[   22.712022] EXT4-fs (sda1): recovery complete
[   22.723608] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
done.
Begin: Running /scripts/local-bottom ... done.
Begin: Running /scripts/init-bottom ... done.
INIT: version 2.88 booting
[info] Using makefile-style concurrent boot in runlevel S.
[ ok ] Setting hostname to 'debian'...done.
[....] Starting the hotplug events dispatcher: systemd-udevdstarting version 232
. ok 
[....] Synthesizing the initial hotplug events...[   25.007122] input: gpio-keys as /devices/platform/gpio-keys/input/input0
done.
[....] Waiting for /dev to be fully populated...[   25.339644] lm75 0-0048: hwmon0: sensor 'lm75'
[   25.412100] orion_wdt: Initial timeout 21 sec
[   25.520205] marvell-cesa f1030000.crypto: CESA device successfully registered
[   25.635451] sd 2:0:0:0: Attached scsi generic sg0 type 0
done.
[   26.616258] random: crng init done
[ ok ] Activating swap:.
[   26.974762] EXT4-fs (sda1): re-mounted. Opts: (null)
[....] Will now check root file system:fsck from util-linux 2.29.2
[/sbin/fsck.ext3 (1) -- /] fsck.ext3 -y -C0 /dev/sda1 
e2fsck 1.43.4 (31-Jan-2017)
rootfs: clean, 14569/940240 files, 230352/3753728 blocks
. ok 
[   27.291288] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[ ok ] Will now activate lvm and md swap:done.
[info] Will now check all file systems.
fsck from util-linux 2.29.2
Checking all file systems.
LABEL=rootfs is mounted
[....] Done checking file systems. A log is being saved in /var/log/fsck/checkfs if that location is wr[ ok e..
[ ok ] Cleaning up temporary files...[....] Cleaning /tmp...done.
[ ok .
[ ok ] Will now mount local filesystems:.
[ ok ] Will now activate swapfile swap:done.
[ ok ] Checking minimum space in /tmp...done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting kernel variables...done.
[ ok ] Initializing random number generator...done.
[....] Configuring network interfaces...Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/52:3b:20:9c:11:51
Sending on   LPF/eth0/52:3b:20:9c:11:51
Sending on   Socket/fallback
DHCPREQUEST of 192.168.2.7 on eth0 to 255.255.255.255 port 67
[   34.252808] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 1000 Mb/s, full duplex, flow control disabled
[   37.559228] NET: Registered protocol family 10
[   37.567029] Segment Routing with IPv6
DHCPREQUEST of 192.168.2.7 on eth0 to 255.255.255.255 port 67
DHCPACK of 192.168.2.7 from 192.168.2.50
bound to 192.168.2.7 -- renewal in 2372 seconds.
done.
[ ok ] Starting RPC port mapper daemon: rpcbind.
[ ok ] Starting NFS common utilities: statd idmapd.
[ ok ] Cleaning up temporary files....
INIT: Entering runlevel: 2
[info] Using makefile-style concurrent boot in runlevel 2.
[....] Starting busybox' syslogd implementation : syslogdStarting /sbin/syslogd...
1326 (syslogd)
. ok 
[ ok ] Starting system message bus: dbus.
[ ok ] Starting NFS common utilities: statd idmapd.
[ ok ] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
[warn] Not starting NFS kernel daemon: no exports. ... (warning).
[ ok ] Starting NTP server: ntpd.
[....] Starting busybox' klogd implementation : klogdStarting /sbin/klogd...
1329 (klogd)
. ok 
[ ok ] Starting OpenBSD Secure Shell server: sshd.
[ ok ] Running local boot scripts (/etc/rc.local).

Debian GNU/Linux 9 debian ttyS0

debian login: root
Password: 
Last login: Mon Feb  4 12:47:11 PST 2019 on ttyS0
Linux debian 4.12.1-kirkwood-tld-1 #1 PREEMPT Sat Jul 15 21:40:50 PDT 2017 armv5tel

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@debian:~# cat /etc/fw_env.config
root@debian:~# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00100000 00400000 "uboot"
mtd1: 00400000 00400000 "kernel"
mtd2: 0fc00000 00400000 "rootfs"
root@debian:~# cd tools
root@debian:~/tools# ./flash_erase /dev/mtd0 0 4
flash_erase: error!: /dev/mtd0
             error 13 (Permission denied)

Dirk Pitt

Re: NETGEAR STORA - Bad Magic Number

$
0
0
Still something not right here. I am wondering if the NAND chip was misidentified. Most of the STORA log that I've seen, the Samsung chip is SLC and the erased block size is 128K.

[    8.909289] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xda
[    8.915788] nand: Samsung NAND 256MiB 3,3V 8-bit
[    8.920476] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64

Your boot log:
[    8.839871] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xda
[    8.846379] nand: Samsung NAND 256MiB 3,3V 8-bit
[    8.851019] nand: 256 MiB, MLC, erase size: 4096 KiB, page size: 4096, OOB size: 128
[    8.858833] nand: WARNING: f4000000.nand: the ECC used on your system is too weak compared to the one required by the NAND chip
[    8.870392] Scanning device for bad blocks
[    8.878685] 3 cmdlinepart partitions found on MTD device orion_nand
[    8.885008] Creating 3 MTD partitions on "orion_nand":
[    8.890185] 0x000000000000-0x000000100000 : "uboot"
[    8.895114] mtd: partition "uboot" doesn't end on an erase block -- force read-only
[    8.904401] 0x000000000000-0x000000400000 : "kernel"
[    8.910904] 0x000000400000-0x000010000000 : "rootfs"

That could be a problem.

Try to play with some nand commands in u-boot prompt to see if you can find out more info about the nand chip/partition.

At u-boot prompt,
help
nand info

Re: NETGEAR STORA - Bad Magic Number

$
0
0
Hi Bodhi,
some progress....
I've make some search.. The nand partition must start and end up with a multiple of erase size.
My stora have
[    8.840842] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xda
[    8.847357] nand: Samsung NAND 256MiB 3,3V 8-bit
[    8.851997] nand: 256 MiB, MLC, erase size: 4096 KiB, page size: 4096, OOB size: 128
I've modify the mtdpart like this
setenv mtdparts 'mtdparts=orion_nand:12288K(uboot),53248k@12288k(kernel),-(rootfs)'
An after kwboot this is the boot log..
[    8.871600] Scanning device for bad blocks
[    8.879893] 3 cmdlinepart partitions found on MTD device orion_nand
[    8.886215] Creating 3 MTD partitions on "orion_nand":
[    8.891392] 0x000000000000-0x000000c00000 : "uboot"
[    8.897877] 0x000000c00000-0x000004000000 : "kernel"
[    8.904455] 0x000004000000-0x000010000000 : "rootfs"
Now I've follow your guide..
Erase partition
root@debian:~/tools# ./flash_erase /dev/mtd0 0 4
Erasing 4096 Kibyte @ 800000 -- 50 % complete libmtd: error!: bad eraseblock number 3, mtd0 has 3 eraseblocks
flash_erase: error!: /dev/mtd0: MTD get bad block failed
             error 22 (Invalid argument)
root@debian:~/tools# ./flash_erase /dev/mtd0 0 3
Erasing 4096 Kibyte @ 800000 -- 100 % complete
Write uboot to NAND
root@debian:~/tools# ./nandwrite /dev/mtd0 uboot.2017.07-tld-1.netgear_ms2110.mtd0.kwb 
Writing data to block 0 at offset 0x0
Erase and write env to NAND
root@debian:~/tools# ./flash_erase /dev/mtd0 0xc0000 1
Erasing 4096 Kibyte @ 0 -- 100 % complete 
root@debian:~/tools# ./nandwrite -s 786432 /dev/mtd0 uboot.2016.05-tld-1.environment.img
Writing data to block 0 at offset 0x0
Reboot

The stora won't boot :(

I think that the large erase size delete too much data.
Can I change the erase size?

Other suggestions??

Thank a lot.

Dirk Pitt

OPS... I've find the same... too late.

Re: NETGEAR STORA - Bad Magic Number

$
0
0
Dirk,

Assuming the NAND info is correct in the kernel boot log, we can try this.

All we care is the mtd0 for u-boot. And we don't care about the envs yet at this point.

kwboot again, in serial console,

setenv mtdparts 'mtdparts=orion_nand:4M(uboot),-(rootfs)'
and boot into Debian.

There should be 2 mtd partitions
cat /proc/mtd

And flash it.

./flash_erase /dev/mtd0 0 0
./nandwrite /dev/mtd0 uboot.2017.07-tld-1.netgear_ms2110.mtd0.kwb

And reboot.

If there was error during the nandwrite above, we'll adjust to it.

Re: NETGEAR STORA - Bad Magic Number

Re: NETGEAR STORA - Bad Magic Number

$
0
0
Hi Bodhi,
I was writing about my discovery and you had already found it.
This is the uboot log
Netgear Stora> help
?       - alias for 'help'
base    - print or set address offset
bdinfo  - print Board Info structure
boot    - boot default, i.e., run 'bootcmd'
bootd   - boot default, i.e., run 'bootcmd'
bootefi - Boots an EFI payload from memory
bootelf - Boot from an ELF image in memory
bootm   - boot application image from memory
bootp   - boot image via network using BOOTP/TFTP protocol
bootvx  - Boot vxWorks from an ELF image
bootz   - boot Linux zImage image from memory
chpart  - change active partition
cmp     - memory compare
coninfo - print console devices and information
cp      - memory copy
crc32   - checksum calculation
date    - get/set/reset date & time
dhcp    - boot image via network using DHCP/TFTP protocol
diskboot- boot from IDE device
dns     - lookup the IP of a hostname
echo    - echo args to console
editenv - edit environment variable
env     - environment handling commands
exit    - exit script
ext2load- load binary file from a Ext2 filesystem
ext2ls  - list files in a directory (default /)
ext4load- load binary file from a Ext4 filesystem
ext4ls  - list files in a directory (default /)
ext4size- determine a file's size
false   - do nothing, unsuccessfully
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls   - list files in a directory (default /)
fatsize - determine a file's size
fdt     - flattened device tree utility commands
fsinfo  - print information about jffs filesystems
fsload  - load binary file from a jffs filesystem image
fsls    - list jffs files in a directory (default /)
fstype  - Look up a filesystem type
go      - start application at address 'addr'
gpio    - query and control gpio pins
gpt     - GUID Partition Table
help    - print command description/usage
ide     - IDE sub-system
iminfo  - print header information for application image
imxtract- extract a part of a multi-image
itest   - return true/false on integer compare
load    - load binary file from a filesystem
loadb   - load binary file over serial line (kermit mode)
loads   - load S-Record file over serial line
loadx   - load binary file over serial line (xmodem mode)
loady   - load binary file over serial line (ymodem mode)
loop    - infinite loop on address range
ls      - list files in a directory (default /)
md      - memory display
mii     - MII utility commands
mm      - memory modify (auto-incrementing address)
mtdparts- define flash/nand partitions
mw      - memory write (fill)
nand    - NAND sub-system
nboot   - boot from NAND device
nfs     - boot image via network using NFS protocol
nm      - memory modify (constant address)
ping    - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
save    - save file to a filesystem
saveenv - save environment variables to persistent storage
setenv  - set environment variables
setexpr - set environment variable as the result of eval expression
showvar - print local hushshell variables
size    - determine a file's size
sleep   - delay execution for some time
sntp    - synchronize RTC via network
source  - run script from memory
test    - minimal test like /bin/sh
tftpboot- boot image via network using TFTP protocol
true    - do nothing, successfully
ubi     - ubi commands
ubifsload- load file from an UBIFS filesystem
ubifsls - list files in a directory
ubifsmount- mount UBIFS volume
ubifsumount- unmount UBIFS volume
usb     - USB sub-system
usbboot - boot from USB device
version - print monitor, compiler and linker version
Netgear Stora> nand info

Device 0: nand0, sector size 128 KiB
  Page size       2048 b
  OOB size          64 b
  Erase size    131072 b
  subpagesize      512 b
  options     0x4000101c
  bbt options 0x00008000
Netgear Stora>
It seems that the nand have 128k of erase size...
This is the printenv..
Netgear Stora> printenv
arcNumber=2743
baudrate=115200
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm$load_uimage_addr; fi; fi
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
console=console=ttyS0,115200
device=0:1
devices=usb ide
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-netgear_stora_ms2000
ethact=egiga0
ethaddr=52:3b:20:9c:11:51
if_netconsole=ping $serverip
ipaddr=192.168.0.231
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_dtb_addr=0x1c00000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_initrd_addr=0x1100000
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
load_uimage_addr=0x800000
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1m(uboot),4m@1m(kernel),251m@5m(rootfs) rw
nand_erasesize=20000
nand_oobsize=40
nand_writesize=800
partition=nand0,2
preboot_nc=run if_netconsole start_netconsole
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 $load_uimage_addr /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
serverip=192.168.0.220
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
usb_ready_retry=15

Environment size: 2967/131068 bytes
Try to change erase size??
Dirk Pitt

Re: NETGEAR STORA - Bad Magic Number

Re: NETGEAR STORA - Bad Magic Number

$
0
0
Hi,
1:
Netgear Stora> setenv dtb_file /boot/dts/kirkwood-netgear_stora_ms2000.dtb
Netgear Stora> setenv mtdparts 'mtdparts=orion_nand:4M(uboot),-(rootfs)'
2:
[    8.877633] 2 cmdlinepart partitions found on MTD device orion_nand
[    8.883958] Creating 2 MTD partitions on "orion_nand":
[    8.889134] 0x000000000000-0x000000400000 : "uboot"
[    8.895615] 0x000000400000-0x000010000000 : "rootfs"
3:
root@debian:~/tools# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00400000 00400000 "uboot"
mtd1: 0fc00000 00400000 "rootfs"
4:
root@debian:~/tools# ./flash_erase /dev/mtd0 0 0
Erasing 4096 Kibyte @ 0 -- 100 % complete 
root@debian:~/tools# ./nandwrite /dev/mtd0 uboot.2017.07-tld-1.netgear_ms2110.mtd0.kwb
Writing data to block 0 at offset 0x0
root@debian:~/tools# reboot

No boot....
DP

Re: GoFlex Home Battery Replacement

$
0
0
Maybe we should put this in the uboot env img... Dockstar / pogoe02 /etc --- no RTC,
goflex home / net --- battery problem... this will help.

Re: NETGEAR STORA - Bad Magic Number

$
0
0
dirk,

Please post the full serial console log or at least dmesg.

Booting Zyxel NSA-325v2 from USB Stick

$
0
0
Hi everybody,

after years of ignoring my Zyxel-NAS, I want to revive this part of hardware with a up-to-date Linux and NAS System. I read a lot about uBoot, get root access and so on. Now I want to install this Kirkwood Kernel file to a bootable USB memory stick, which I found here in the forum.

The problem is, that I dont know, how to setup the USB stick to manage the boot and rootfs partitions and which file has to be where?

Is there a good tutorial to create a bootable USB device with the files I mentioned above?

Kind regards
Rick
Viewing all 47024 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>