Welcome! Log In Create A New Profile

Advanced

GoflexNet with corrupted init.d/rcS can't boot fully

Posted by atglabs 
GoflexNet with corrupted init.d/rcS can't boot fully
October 29, 2018 01:07PM
I was hacking my GoFlexNet pogoplug to install miniDLNA package and somehow I corrupted the /etc/init.d/rcS script file and when I boot, it gets to the point where the rcS script starts to run but it never completes the script. I had ssh access and have now got serial port working. I can break into uboot shell, and I'm hoping there is some way to use the serial port to break into the /bin/sh that is running the rcS script. Here's snippets of the serial port output:

U-Boot 1.1.4 Cloud Engines 1.1.2 (3.4.22) SATA PHYADDR=0
[ 0.880000] Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
[ 0.890000] serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 33) is a 16550A
[ 7.380000] Freeing init memory: 124K
init started: BusyBox v1.7.0 (2008-02-26 19:25:17 IST)
starting pid 264, tty '': '/etc/init.d/rcS'

My limited linux/unix skills lead me to believe that if I could use the uboot env vars so that the Busybox starts using the serial port so I could break into the shell running rcS. (Maybe I'm wrong that an RS-232 'break' sent to the shell should give me access to the shell so I can fix the corrupted rcS script.)

I'm hoping I can avoid having to flash a new uboot and create a USB flash drive with debian. I don't even know whether such a USB-launched linux can access the mtdblock file systems in the nand so I can edit the original rcS file. If anyone has a suggestion on how to edit the rcS file without creating the USB boot and OS, I would greatly appreciate it. On the other hand, it might be better to install a Debian or Arch on the box so I can more easily add packages.

Thanks in advance

Jerry
Re: GoflexNet with corrupted init.d/rcS can't boot fully
October 29, 2018 04:18PM
Jerry,

You try either:

1. Take the GFNet rootfs offline and mount it on another Linux box, being root on that box, you can fix the rcS file.

2. Use a spare USB flash drive, create this basic rootfs: Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 from my release thread and boot with it.

You don't need to install new u-boot if you append the DTB as described in step 4:

4. Create uImage with embedded DTB for booting with older u-boots (2012 or earlier). Skip this step if you have installed the latest U-Boot for Kirkwood (or are installing this u-boot at the same time). 

Please replace kirkwood-goflexnet.dtb below with the correct DTB name for your box (see the folder /media/sdb1/boot/dts for the exact spelling of your Kirkwood box name). 

Generate the uImage with DTB embedded inside: 
cd /media/sdb1/boot
cp -a zImage-4.12.1-kirkwood-tld-1  zImage.fdt
cat dts/kirkwood-goflexnet.dtb  >> zImage.fdt
mv uImage uImage.orig
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-4.12.1-kirkwood-tld-1 -d zImage.fdt  uImage
sync

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 01, 2018 08:04PM
Since I don't have GSNet, I've been trying various ways to find the kernel Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 (24 Jul 2017) to download, including trying to guess what your dropbox url might be for this, without success. Is there a url to wget it from, or someplace to download it?

I have a second PogoPlug Pro (PPP) that has ssh access and some USB plugs. If I understand the procedure, once I get the tarbal onto the PPP, I use the PPP to format a usb flash drive with the two ext2 file systems. Do I then then create a /boot directory on the first partition of the USB drive where I untar Debian...tar.bz2 ?

Step 1 of your procedure seems to suggest that I am saving backups of files that are on the PPP, but I'm trying to boot on the GoFlexNet and only have the serial console and uboot on that system. I presume I won't be able to back up the GoFlexNet /boot files, but that's OK if I'm able to boot using the existing uboot and the new USB flash drive.

Step 2 is untarring the tarbal but is this to a /boot dir on the newly partitioned USB drive, or where? My guess is that I want a boot dir in the root of the USB flash drive.

Step 3 doesn't seem to be done since my PPP doesn't have the command for:
apt-get remove flash-kernel
dpkg -i linux-image-4.19.0-kirkwood-tld-1_1.0_armel.deb

Step 4 also seems impossible to do since the PPP doesn't have the needed commands installed in busybox:
cd /media/sdb1/boot [I presume this is the root /boot on the new USB flash drive]
cp -a zImage-4.12.1-kirkwood-tld-1 zImage.fdt [from the untarred package, right?]
cat dts/kirkwood-goflexnet.dtb >> zImage.fdt
mv uImage uImage.orig [not needed because there was no uImage file in the new /boot dir]

mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-4.12.1-kirkwood-tld-1 -d zImage.fdt uImage
I don't have mkimage on the PPP, so that's out too.
sync

Obviously I must be not understanding something basic, but then I'm trying to build a USB drive that will let me boot my GoFlexPro from the drive using the factory uBoot so I can edit files on the internal flash mdtblock filesystem. Any suggestions what to grep for and improve my knowledge about this technique? I've read some other Debian install for pogoplug and I generally get the idea of how uboot works and how some uboot setenv commands can get the GoFlex to boot from the USB instead of the factory kernel.

Thanks in advance for any pointers.
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 01, 2018 08:11PM
atglabs Wrote:
-------------------------------------------------------
> Since I don't have GSNet, I've been trying various
> ways to find the kernel
> Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2
> (24 Jul 2017) to download, including trying to
> guess what your dropbox url might be for this,
> without success. Is there a url to wget it from,
> or someplace to download it?

Download link is in the released thread, 1st post.
https://forum.doozan.com/read.php?2,12096

Scroll down to 24 July 2017.


> I have a second PogoPlug Pro (PPP) that has ssh
> access and some USB plugs. If I understand the
> procedure, once I get the tarbal onto the PPP, I
> use the PPP to format a usb flash drive with the
> two ext2 file systems. Do I then then create a
> /boot directory on the first partition of the USB
> drive where I untar Debian...tar.bz2 ?
>
> Step 1 of your procedure seems to suggest that I
> am saving backups of files that are on the PPP,
> but I'm trying to boot on the GoFlexNet and only
> have the serial console and uboot on that system.
> I presume I won't be able to back up the GoFlexNet
> /boot files, but that's OK if I'm able to boot
> using the existing uboot and the new USB flash
> drive.

Pogo Pro is a different SoC. See that release thread:

https://forum.doozan.com/read.php?2,16044



> Step 2 is untarring the tarbal but is this to a
> /boot dir on the newly partitioned USB drive, or
> where? My guess is that I want a boot dir in the
> root of the USB flash drive.
>
> Step 3 doesn't seem to be done since my PPP
> doesn't have the command for:
> apt-get remove flash-kernel
> dpkg -i
> linux-image-4.19.0-kirkwood-tld-1_1.0_armel.deb
>
> Step 4 also seems impossible to do since the PPP
> doesn't have the needed commands installed in
> busybox:
> cd /media/sdb1/boot [I presume this is the
> root /boot on the new USB flash drive]
> cp -a zImage-4.12.1-kirkwood-tld-1 zImage.fdt
> [from the untarred package, right?]
> cat dts/kirkwood-goflexnet.dtb >> zImage.fdt
> mv uImage uImage.orig [not needed because
> there was no uImage file in the new /boot dir]
>
> mkimage -A arm -O linux -T kernel -C none -a
> 0x00008000 -e 0x00008000 -n
> Linux-4.12.1-kirkwood-tld-1 -d zImage.fdt uImage
> I don't have mkimage on the PPP, so that's out
> too.
> sync
>
> Obviously I must be not understanding something
> basic, but then I'm trying to build a USB drive
> that will let me boot my GoFlexPro from the drive

GoFlex Net is Kirkwod. Pogo Pro is OXNAS. They are 2 different boxes.

> using the factory uBoot so I can edit files on the
> internal flash mdtblock filesystem. Any
> suggestions what to grep for and improve my
> knowledge about this technique? I've read some
> other Debian install for pogoplug and I generally
> get the idea of how uboot works and how some uboot
> setenv commands can get the GoFlex to boot from
> the USB instead of the factory kernel.
>
> Thanks in advance for any pointers.

See the instruction in 1st post of the corresponding 2 release threads I posted above.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 11/01/2018 08:22PM by bodhi.
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 01, 2018 08:42PM
Bodhi,
Thanks for the pointers. I wasn't sure if you realized I was just using the PPPro as a "linux box" to create a USB Flash drive that I can take over to my GoFlexNet and boot from the uBoot prompt. It doesn't seem that I need the hardware-specific files for the PPPro any more than I would need files for a VM running Debian on a PC.

My primary issue is what to put onto the USB Flash drive that will be used to boot the GoFlexNet box since I can't get out of a hung init.d/rcS bug to get console access to the shell running the init script.
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 01, 2018 10:01PM
atglabs Wrote:
-------------------------------------------------------
> My primary issue is what to put onto the USB Flash
> drive that will be used to boot the GoFlexNet box
> since I can't get out of a hung init.d/rcS bug to
> get console access to the shell running the init
> script.

There is no need to deal with rcS. If you create the rootfs with Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 (24 Jul 2017) following the instruction it will boot to Debian.

If you want confirmation, post the log of how you did that. And the boot log when you attempt to boot the GoFlex Net here.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 11/01/2018 10:03PM by bodhi.
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 03, 2018 08:41PM
Again, sorry to be so ignorant about this stuff. So I have prepared a 2gb USB flash drive (using my PogoPro) with a single
partition and used mkfs.ext2 to create an empty file system. (My PogoPro used to create the USB files ystem didn't have
a Ext3 command, so I hope ext2 will work.

I then downloaded the Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 (24 Jul 2017) and untarred to the root of the USB
flash drive where it created the following file system:

drwxr-xr-x    2 root     root          4096 Nov  4 01:12 bin
drwxr-xr-x    3 root     root          4096 Nov  4 01:12 boot
drwxr-xr-x    5 root     root          4096 Nov  4 01:05 dev
drwxr-xr-x   57 root     root          4096 Nov  4 01:13 etc
drwxr-xr-x    2 root     root          4096 Jan 22  2012 home
drwxr-xr-x   14 root     root          4096 Nov  4 01:18 lib
drwx------    2 root     root         16384 Feb 24  2012 lost+found
drwxr-xr-x    2 root     root          4096 Feb 24  2012 media
drwxr-xr-x    2 root     root          4096 Feb 10  2015 mnt
drwxr-xr-x    2 root     root          4096 Feb 24  2012 opt
drwxr-xr-x    2 root     root          4096 Jan 22  2012 proc
drwx------    5 root     root          4096 Nov  4 01:05 root
drwxr-xr-x    2 root     root          4096 Feb  8  2013 run
drwxr-xr-x    2 root     root          4096 Nov  4 01:05 sbin
drwxr-xr-x    2 root     root          4096 Feb 24  2012 srv
drwxr-xr-x    2 root     root          4096 Jan  1  2011 sys
drwxrwxrwt    2 root     root          4096 Nov  4 01:13 tmp
drwxr-xr-x   10 root     root          4096 Nov  4 01:11 usr
drwxr-xr-x   11 root     root          4096 Nov  4 01:13 var

I edited the /etc/fstab to reflect that I could only format to ext2:
LABEL=rootfs / ext2 noatime,errors=remount-ro 0 1

I started doing step 4 in the /boot directory, but after creating the zImage with the correct ftd file, I can't do the mkImage because the linux box I'm doing this on (a PogoPro) doesn't have that command. It also doesn't have the apt-get command, and I even looked through the new rootfs just created to see if the executable for either of these commands were there.

Feel like I'm chasing my tail - is there some place I can download (to my PogoPro) the mkImage and apt-get executables so I can finish the USB flash drive and take it to my GoFlexNet and try to boot it? If I can get this to work, I'll flash your new uBoot on my GoFlexNet and the latest Debian

TIA.

Jerry
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 03, 2018 09:28PM
Jerry,

> Again, sorry to be so ignorant about this stuff.

Nah, we're all beginners about something really low level like this at one point in time :)

> So I have prepared a 2gb USB flash drive (using my
> PogoPro) with a single
> partition and used mkfs.ext2 to create an empty
> file system. (My PogoPro used to create the USB
> files ystem didn't have
> a Ext3 command, so I hope ext2 will work.

Yes it will work.

>
> I then downloaded the
> Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2
> (24 Jul 2017) and untarred to the root of the
> USB
> flash drive where it created the following file
> system

>
> I edited the /etc/fstab to reflect that I could
> only format to ext2:
> LABEL=rootfs / ext2
> noatime,errors=remount-ro 0 1
>


So far so good.

> I started doing step 4 in the /boot directory, but
> after creating the zImage with the correct ftd
> file, I can't do the mkImage because the linux box
> I'm doing this on (a PogoPro) doesn't have that
> command. It also doesn't have the apt-get
> command, and I even looked through the new rootfs
> just created to see if the executable for either
> of these commands were there.

The rootfs Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 has this command already (it is a full Debian system). So if the native environment does not have the command, you can always execute it directly.

Assumming the rootfs USB drive is mounted at /media/sdb1,
/media/sdb1/usr/bin/mkimage


BTW, you don't need it now, but it's good to mention. In the u-boot release thread, the installation instruction also refer to a bin pack that has all necessary flashing tools. This might be necessary when you install new u-boot from an old stock OS:

Quote
https://forum.doozan.com/read.php?3,12381
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.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 04, 2018 04:16PM
Another few layers of the onion have been peeled, but still no joy. I am having trouble with running mkimage to get the right dts embedded.
Quote

The rootfs Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 has this command already (it is a full Debian system). So if the native environment does not have the command, you can always execute it directly. Assumming the rootfs USB drive is mounted at /media/sdb1,
you can run it so: /media/sdb1/usr/bin/mkimage

Tried that and I get an error "Permission Denied" trying to run # ../mnt_sdb1/usr/bin/mkimage
-sh: ../mnt_sdb1/usr/bin/mkimage: Permission denied

The file has 755 access and both user/grp as root/root and I'm running as root, so I don't see what would cause the permission denied error. Then I realized that I'm running this on the PogoPro (OZNAS) which might have different binary requirements than the Kirkwood on the hung GoFlexNet I'm trying to repair. So I went to one of your threads and downloaded Debian-4.4.54-oxnas-tld-1-rootfs-bodhi.tar.bz2, which I figured would have the correct binary format to run on the PogoPro. After untarring, I still get the same "Permission Denied" error running the /usr/bin/mkimage from the untarred OZNAS rootfs.

So I'm stuck for ideas here, either how to fix Permission Denied error or how to get a GoFlexNet boot image with the specific GoFlexNet dts.

TIA for suggestions!
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 04, 2018 04:38PM
Jerry,

That mkimage can run on any Linux box (permission error does not make sense!).

If you have a Linux laptop, you can mount the rootfs on it and run it there (as root user). See if it works.

And post the log of what you are doing, too, so I can check it for you.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 04, 2018 05:58PM
Aha. Figured out the error msg. I had untarred the PogoPro rootfs into a subdir on another USB flash drive. When I tried to run mkimage from that mounted USB subdir, I got Permission Denied, even though the file execute bit was set. I found some comments online that perhaps the mounted filesystem needed a sudo or something. I then copied the mkimage executable to the PogoPro /usr/bin dir and voila, it runs and produces the new image in the boot dir of the USB flash drive I've been preparing to boot on my GoFlexNet box.

So now, I boot the GoFlexPro with the USB flash drive containing the full rootfs inserted and it does not automatically boot into the USB code. I rebooted and halted the uBoot so I can modify the env vars to tell it to boot to the USB instead of the internal flash. (I tried letting uBoot continue but it didn't seem to find and boot from the USB drive. I must be missing something else.

U-Boot 1.1.4  Cloud Engines 1.1.2 (3.4.22) SATA PHYADDR=0
U-Boot code: 00600000 -> 0067FFF0  BSS: -> 00691750
Soc: 88F6281 A0 (DDR2)
CPU running @ 1200Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz

DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000   size 128MB
DRAM Total size 128MB  16bit width
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:256 MB
Flash:  0 kB

CPU : Marvell Feroceon (Rev 1)
CLOUD ENGINES BOARD: DISCOVERY:0.1

Streaming disabled
Write allocate disabled

USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME]
Hit any key to stop autoboot:  0

NAND read: device 0 offset 0x100000, size 0x300000

Reading data from 0x3ff800 -- 100% complete.
 3145728 bytes read: OK
# Booting image at 00800000 ...
   Image Name:   Linux-2.6.22.18
   Created:      2010-10-19  23:05:02 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1979140 Bytes =  1.9 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux............................................................................................................................ done, booting the kernel.
[    0.000000] Linux version 2.6.22.18 (bdietrich@buildman) (gcc version 4.2.1) #81 Tue Oct 19 16:05:00 PDT 2010
[    0.000000] CPU: ARM926EJ-S [56251311] revision 1 (ARMv5TE), cr=00053977
[    0.000000] Machine: Feroceon-KW
[    0.000000] Using UBoot passing parameters structure
[    0.000000] CE: Received CE uboot parameters:
[    0.000000] CE:    BOARDID: DISCOVERY:0.1
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] CPU0: D VIVT write-back cache
[    0.000000] CPU0: I cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
[    0.000000] CPU0: D cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
[    0.000000] Built 1 zonelists.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/mtdblock2 ro
[    0.000000] PID hash table entries: 512 (order: 9, 2048 bytes)
[    0.000000] Console: colour dummy device 80x30
[    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: 128MB 0MB 0MB 0MB = 128MB total
[    0.000000] Memory: 125824KB available (3592K code, 253K data, 124K init)
[    0.240000] Mount-cache hash table entries: 512
[    0.240000] CPU: Testing write buffer coherency: ok
[    0.240000] NET: Registered protocol family 16
[    0.240000]
[    0.240000] CPU Interface
[    0.240000] -------------
[    0.240000] SDRAM_CS0 ....base 00000000, size 128MB
[    0.240000] SDRAM_CS1 ....disable
[    0.240000] SDRAM_CS2 ....disable
[    0.240000] SDRAM_CS3 ....disable
[    0.240000] PEX0_MEM ....base e8000000, size 128MB
[    0.240000] PEX0_IO ....base f2000000, size   1MB
[    0.240000] INTER_REGS ....base f1000000, size   1MB
[    0.240000] NFLASH_CS ....base fa000000, size   2MB
[    0.240000] SPI_CS ....base f4000000, size  16MB
[    0.240000] BOOT_ROM_CS ....no such
[    0.240000] DEV_BOOTCS ....no such
[    0.240000] CRYPT_ENG ....base f0000000, size   2MB
[    0.240000]
[    0.240000]   Marvell Development Board (LSP Version KW_LSP_4.2.7_patch21_with_rx_desc_tuned)-- SHEEVA PLUG  Soc: 88F6281 A0 LE
[    0.240000]
[    0.240000]  Detected Tclk 200000000 and SysClk 400000000
[    0.240000] MV Buttons Device Load
[    0.240000] Marvell USB EHCI Host controller #0: c0539600
[    0.740000] PEX0 interface detected no Link.
[    0.740000] PCI: bus0: Fast back to back transfers enabled
[    0.740000] SCSI subsystem initialized
[    0.740000] usbcore: registered new interface driver usbfs
[    0.740000] usbcore: registered new interface driver hub
[    0.740000] usbcore: registered new device driver usb
[    0.740000] NET: Registered protocol family 2
[    0.750000] Time: kw_clocksource clocksource has been installed.
[    0.840000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.840000] TCP established hash table entries: 4096 (order: 3, 32768 bytes)
[    0.840000] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
[    0.840000] TCP: Hash tables configured (established 4096 bind 4096)
[    0.840000] TCP reno registered
[    0.870000] RTC has been updated!!!
[    0.870000] RTC registered
[    0.870000] Use the XOR engines (acceleration) for enhancing the following functions:
[    0.870000]   o RAID 5 Xor calculation
[    0.870000]   o kernel memcpy
[    0.870000]   o kenrel memzero
[    0.870000] Number of XOR engines to use: 4
[    0.870000] cesadev_init(c00117b0)
[    0.870000] mvCesaInit: sessions=640, queue=64, pSram=f0000000
[    0.870000] MV Buttons Driver Load
[    0.870000] squashfs: version 3.3 (2007/10/31) Phillip Lougher
[    0.870000] squashfs: LZMA suppport for slax.org by jro
[    0.870000] JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    0.870000] io scheduler noop registered
[    0.870000] io scheduler anticipatory registered (default)
[    0.880000] Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
[    0.890000] serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 33) is a 16550A
[    0.910000] RAMDISK driver initialized: 16 RAM disks of 16384K size 1024 blocksize
[    0.910000] Loading Marvell Ethernet Driver:
[    0.920000]   o Cached descriptors in DRAM
[    0.920000]   o DRAM SW cache-coherency
[    0.930000]   o Single RX Queue support - ETH_DEF_RXQ=0
[    0.930000]   o Single TX Queue support - ETH_DEF_TXQ=0
[    0.940000]   o TCP segmentation offload enabled
[    0.940000]   o Receive checksum offload enabled
[    0.950000]   o Transmit checksum offload enabled
[    0.950000]   o Network Fast Processing (Routing) supported
[    0.960000]   o Driver ERROR statistics enabled
[    0.960000]   o Driver INFO statistics enabled
[    0.970000]   o Proc tool API enabled
[    0.970000]   o Rx descripors: q0=128
[    0.970000]   o Tx descripors: q0=532
[    0.980000]   o Loading network interface(s):
[    0.980000]     o eth0, ifindex = 1, GbE port = 0
[    0.990000]
[    0.990000] Warning: Giga 1 is Powered Off
[    0.990000]
[    0.990000] mvFpRuleDb (c7f15000): 1024 entries, 4096 bytes
[    1.000000] Intel(R) PRO/1000 Network Driver - version 7.3.20-k2-NAPI
[    1.010000] Copyright (c) 1999-2006 Intel Corporation.
[    1.010000] e100: Intel(R) PRO/100 Network Driver, 3.5.17-k4-NAPI
[    1.020000] e100: Copyright(c) 1999-2006 Intel Corporation
[    1.020000] Integrated Sata device found
[    1.050000] scsi0 : Marvell SCSI to SATA adapter
[    1.050000] scsi1 : Marvell SCSI to SATA adapter
[    1.060000] NFTL driver: nftlcore.c $Revision: 1.98 $, nftlmount.c $Revision: 1.41 $
[    1.070000] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron NAND 256MiB 3,3V 8-bit)
[    1.080000] Scanning device for bad blocks
[    1.150000] Bad eraseblock 1592 at 0x0c700000
[    1.170000] Using static partition definition
[    1.180000] Creating 4 MTD partitions on "nand_mtd":
[    1.180000] 0x00000000-0x00100000 : "u-boot"
[    1.190000] 0x00100000-0x00500000 : "uImage"
[    1.190000] 0x00500000-0x02500000 : "root"
[    1.200000] 0x02500000-0x10000000 : "data"
[    1.200000] ehci_marvell ehci_marvell.70059: Marvell Orion EHCI
[    1.210000] ehci_marvell ehci_marvell.70059: new USB bus registered, assigned bus number 1
[    1.240000] ehci_marvell ehci_marvell.70059: irq 19, io base 0xf1050100
[    1.260000] ehci_marvell ehci_marvell.70059: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
[    1.260000] usb usb1: configuration #1 chosen from 1 choice
[    1.270000] hub 1-0:1.0: USB hub found
[    1.270000] hub 1-0:1.0: 1 port detected
[    1.390000] USB Universal Host Controller Interface driver v3.0
[    1.670000] usb 1-1: new high speed USB device using ehci_marvell and address 2
[    1.820000] usb 1-1: configuration #1 chosen from 1 choice
[    1.820000] usbcore: registered new interface driver usblp
[    1.830000] drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver
[    1.840000] Initializing USB Mass Storage driver...
[    1.840000] scsi2 : SCSI emulation for USB Mass Storage devices
[    1.850000] usbcore: registered new interface driver usb-storage
[    1.850000] USB Mass Storage support registered.
[    1.860000] mice: PS/2 mouse device common for all mice
[    1.860000] i2c /dev entries driver
[    1.870000] Linux telephony interface: v1.00
[    1.870000] md: linear personality registered for level -1
[    1.880000] md: raid0 personality registered for level 0
[    1.880000] md: raid1 personality registered for level 1
[    2.060000] raid6: int32x1     98 MB/s
[    2.230000] raid6: int32x2    114 MB/s
[    2.400000] raid6: int32x4    122 MB/s
[    2.570000] raid6: int32x8    110 MB/s
[    2.570000] raid6: using algorithm int32x4 (122 MB/s)
[    2.570000] md: raid6 personality registered for level 6
[    2.580000] md: raid5 personality registered for level 5
[    2.580000] md: raid4 personality registered for level 4
[    2.590000] raid5: measuring checksumming speed
[    2.640000]    arm4regs  :  1084.400 MB/sec
[    2.690000]    8regs     :   754.800 MB/sec
[    2.740000]    32regs    :   900.000 MB/sec
[    2.740000] raid5: using function: arm4regs (1084.400 MB/sec)
[    2.750000] device-mapper: ioctl: 4.11.0-ioctl (2006-10-12) initialised: dm-devel@redhat.com
[    2.750000] dm_crypt using the OCF package.
[    2.760000] sdhci: Secure Digital Host Controller Interface driver
[    2.760000] sdhci: Copyright(c) Pierre Ossman
[    2.770000] usbcore: registered new interface driver usbhid
[    2.770000] drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
[    2.780000] TCP cubic registered
[    2.780000] NET: Registered protocol family 1
[    2.790000] NET: Registered protocol family 17
[    2.790000] md: Autodetecting RAID arrays.
[    2.800000] md: autorun ...
[    2.800000] md: ... autorun DONE.
[    4.620000] Empty flash at 0x00e54e48 ends at 0x00e55000
[    7.810000] VFS: Mounted root (jffs2 filesystem) readonly.
[    7.820000] Freeing init memory: 124K
[    7.830000] scsi 2:0:0:0: Direct-Access     Lexar    microSD RDR      0815 PQ: 0 ANSI: 6
[    8.470000] sd 2:0:0:0: [sda] 3866624 512-byte hardware sectors (1980 MB)
[    8.480000] sd 2:0:0:0: [sda] Write Protect is off
[    8.480000] sd 2:0:0:0: [sda] Assuming drive cache: write through
[    8.660000] sd 2:0:0:0: [sda] 3866624 512-byte hardware sectors (1980 MB)
[    8.730000] sd 2:0:0:0: [sda] Write Protect is off
[    8.740000] sd 2:0:0:0: [sda] Assuming drive cache: write through
[    8.740000]  sda: sda1
[    8.840000] sd 2:0:0:0: [sda] Attached SCSI removable disk
[    8.840000] sd 2:0:0:0: Attached scsi generic sg0 type 0
init started: BusyBox v1.7.0 (2008-02-26 19:25:17 IST)
starting pid 280, tty '': '/etc/init.d/rcS'

baudrate=115200
loads_echo=0
ipaddr=169.254.254.253
serverip=169.254.254.254
rootpath=/mnt/ARM_FS/
netmask=255.255.0.0
run_diag=yes
console=console=ttyS0,115200
CASset=min
MALLOC_len=1
ethprime=egiga0
bootargs_root=root=/dev/mtdblock2 ro
ethmtu=1500
usb0Mode=host
nandEcc=1bit
ethact=egiga0
ethaddr=00:10:75:26:24:C3
cesvcid=ZL9SNCS63FCEP79LLKNGRK5FKE
ceserialno=NA1Y08M6
ceboardver=DISCOVERY:0.1
bootcmd=nand read.e 0x800000 0x100000 0x300000; setenv bootargs $(console) $(bootargs_root); bootm 0x800000
stdin=serial
stdout=serial
stderr=serial
nandEnvBase=a0000
mainlineLinux=no
enaMonExt=no
enaCpuStream=no
enaWrAllo=no
pexMode=RC
disL2Cache=no
setL2CacheWT=yes
disL2Prefetch=yes
enaICPref=yes
enaDCPref=yes
sata_dma_mode=yes
netbsd_en=no
vxworks_en=no
bootdelay=3
disaMvPnp=no
pcieTune=no

Environment size: 793/131068 bytes

Suggestions what to read about getting the new rootfs to be booted. I still have the original uBoot since I don't have shell control to update it yet.



Edited 1 time(s). Last edit at 11/04/2018 06:30PM by atglabs.
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 04, 2018 09:05PM
Hi,

Your uboot variables are still set to boot stock. Try this at the uboot prompt;

setenv load_initrd 'ext2load usb 0:1 0x2100000 /boot/uInitrd'
setenv load_uimage 'ext2load usb 0:1 0x800000 /boot/uImage'
setenv usb_boot 'usb start; run load_uimage; run load_initrd; bootm 0x800000 0x2100000'

boot

If you don't 'saveenv' this changes won't be persistent across boots, this should just boot once off the usb.

Note: you might also need to set mainlineLinux to yes, but try just these first.
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 05, 2018 12:13AM
Jerry,

Quote

Aha. Figured out the error msg. I had untarred the PogoPro rootfs into a subdir on another USB flash drive. When I tried to run mkimage from that mounted USB subdir, I got Permission Denied, even though the file execute bit was set. I found some comments online that perhaps the mounted filesystem needed a sudo or something. I then copied the mkimage executable to the PogoPro /usr/bin dir and voila, it runs and produces the new image in the boot dir of the USB flash drive I've been preparing to boot on my GoFlexNet box.

Yes, that's right :) glad you've figured out.

> Suggestions what to read about getting the new
> rootfs to be booted. I still have the original
> uBoot since I don't have shell control to update
> it yet.

Since you have serial console, what you should do at this point now that Debian rootfs has been created, is to start u-boot installation and skip the stock u-boot adjustment altogether (really not needed and kind of wasteful, if your goal is to install new u-boot). And the first thing is to boot with kwboot before flashing u-boot for real. This is to provide a rescue plan whenever things go bad and you would know you can always rescue the box.

With the new u-boot uboot.2017.07-tld-1.goflexnet.mtd0.kwb in the tarball uboot.2017.07-tld-1.goflexnet.bodhi.tar, try kwboot it. This example is using the NSA310S u-boot. The process is the same, but you should use uboot.2017.07-tld-1.goflexnet.mtd0.kwb:
https://forum.doozan.com/read.php?3,51739,51919#msg-51919

After you have kwboot it, you can then readjust the Debian rootfs to use the original uImage that you have backed up during the rootfs creation. I will show you that step if you're not sure. And that u-boot being loaded by kwboot should boot all the way into Debian.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 05, 2018 02:30PM
@bodhi - Thanks for the continued help. I think the reason I want to use the stock uBoot on the GoFlexNet to boot the USB drive with the Debian rootfs is that I only have a serial port connection with the box, and the stock linux hangs at the point where it starts a shell and runs init.d/rcS. Thus, I have no ssh access.

I looked at using the kwboot, but it appears to require that my laptop used for the serial connection needs to be running Debian as well. Unfortunately, it's a Win10 OS and although I have CygWin installed, and although it can run tar and other standard utilities, it doesn't seem that kwboot will work in that environment.

Right now, I would like just to boot from the USB drive so I can fix the stock init.d/rcS problem, and then when I have ssh, I can do kwboot and upgrade the box to full Debian.

@jdwl101 suggested that I change boot env vars using uBoot as follows:
setenv load_initrd 'ext2load usb 0:1 0x2100000 /boot/uInitrd'
setenv load_uimage 'ext2load usb 0:1 0x800000 /boot/uImage'
setenv usb_boot 'usb start; run load_uimage; run load_initrd; bootm 0x800000 0x2100000'
boot

However, I didn't create a uInitrd image when I made the boot uImage. Do I need to do that as well, or should it boot with just uImage?

As usual, TIA.
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 05, 2018 02:58PM
The uInit will be needed for it to work, but I expect the default one Bohdi provides in the rootfs will work.

If not creating one takes 2 minutes.

You also need a kernel config line that tells the kernel what the root partition is called. I don’t see one in your printenv.

This should get you to boot;
setenv bootargs 'console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 earlyprintk=serial'



Edited 1 time(s). Last edit at 11/05/2018 03:14PM by jdwl101.
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 05, 2018 04:04PM
atglabs,

> However, I didn't create a uInitrd image when I
> made the boot uImage. Do I need to do that as
> well, or should it boot with just uImage?

It's already on the USB rootfs /boot folder.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 11, 2018 06:18PM
OK, after a bunch of attempts to boot from the USB flash drive, I spent some time learning generic UBoot to understand env vars and how booting occurs. I'm stuck trying to figure out why the boot components don't seem to work. Env vars defining stock boot from: onboard NAND
rootpath=/mnt/ARM_FS/
bootargs_root=root=/dev/mtdblock2 ro
bootcmd=nand read.e 0x800000 0x100000 0x300000; setenv bootargs $(console) $(bootargs_root); bootm 0x800000

Env vars I set to force boot to USB flash drive:
load_uimage=ext2load usb 0:1 0x800000 boot/uImage
load_initrd=ext2load usb 0:1 0x1100000 /boot/uInitrd
load_dtb=ext2load usb 0:1 0x1c00000 /boot/dts/kirkwood-goflexnet.dtb
usb_boot=usb start; run load_uimage; run load_initrd; run load_dtb; bootm 0x800000 0x1100000 0x1c00000;

If I then manually run usb_boot, I get:
CE>> run usb_boot
Unknown command 'usb' - try 'help'
** Block device usb 0 not supported
** Block device usb 0 not supported
** Block device usb 0 not supported
## Booting image at 00800000 ...
   Image Name:   Linux-2.6.22.18
   Created:      2010-10-19  23:05:02 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1979140 Bytes =  1.9 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK
## Loading Ramdisk Image at 01100000 ...
Bad Magic Number

U-Boot 1.1.4  Cloud Engines 1.1.2 (3.4.22) SATA PHYADDR=0

Breaking it down into steps, I try to manually run the components:
CE>> run load_uimage=ext2load usb 0:1 0x800000 boot/uImage
** Block device usb 0 not supported
CE>> run load_initrd=ext2load usb 0:1 0x1100000 /boot/uInitrd
** Block device usb 0 not supported
CE>> run  load_dtb=ext2load usb 0:1 0x1c00000 /boot/dts/kirkwood-goflexnet.dtb
** Block device usb 0 not supported

So there must obviously be something wrong with my env vars or the USB flash drive configuration with the ext2fs and the proper Debian filesystem on it.

1) Do I need to adjust any of the env vars:
baudrate=115200
loads_echo=0
ipaddr=169.254.254.253
serverip=169.254.254.254
rootpath=/mnt/ARM_FS/
netmask=255.255.0.0
run_diag=yes
console=console=ttyS0,115200
CASset=min
MALLOC_len=1
ethprime=egiga0
ethmtu=1500
usb0Mode=host
nandEcc=1bit
ethact=egiga0
ethaddr=00:10:75:26:24:C3
cesvcid=ZL9SNCS63FCEP79LLKNGRK5FKE
ceserialno=NA1Y08M6
ceboardver=DISCOVERY:0.1
bootcmd=nand read.e 0x800000 0x100000 0x300000; setenv bootargs $(console) $(bootargs_root); bootm 0x800000
load_uimage=ext2load usb 0:1 0x800000 boot/uImage
load_initrd=ext2load usb 0:1 0x1100000 /boot/uInitrd
load_dtb=ext2load usb 0:1 0x1c00000 /boot/dts/kirkwood-goflexnet.dtb
arcNumber=9
usb_boot=usb start; run load_uimage; run load_initrd; run load_dtb; bootm 0x800000 0x1100000 0x1c00000;
bootargs_root_bak=root=/dev/mtdblock2 ro
bootargs_root=root=LABEL=rootfs
stdin=serial
stdout=serial
stderr=serial
nandEnvBase=a0000
mainlineLinux=no
enaMonExt=no
enaCpuStream=no
enaWrAllo=no
pexMode=RC
disL2Cache=no
setL2CacheWT=yes
disL2Prefetch=yes
enaICPref=yes
enaDCPref=yes
sata_dma_mode=yes
netbsd_en=no
vxworks_en=no
bootdelay=3
disaMvPnp=no
pcieTune=no

I'm thinking the rootpath=/mnt/ARM_FS/ maybe should be something like /dev/usb0/?

2. I have tried @jdwl101's env var, with no joy.
setenv bootargs 'console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 earlyprintk=serial'

However, I did modify his suggestion and changed it to set bootargs_root=root=LABEL=rootfs with this result:
USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME]
Hit any key to stop autoboot:  0

NAND read: device 0 offset 0x100000, size 0x300000

Reading data from 0x3ff800 -- 100% complete.
 3145728 bytes read: OK
## Booting image at 00800000 ...
   Image Name:   Linux-2.6.22.18
   Created:      2010-10-19  23:05:02 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1979140 Bytes =  1.9 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux............................................................................................................................ done, booting the kernel.
[    0.000000] Linux version 2.6.22.18 (bdietrich@buildman) (gcc version 4.2.1) #81 Tue Oct 19 16:05:00 PDT 2010
   (This puts things into a kernel panic loop of rebooting and panic.

It seems that I might have to build a small Debian PC that can verify that the USB flash drive is correctly formatted (my PogoPro box died trying to install needed linux apps like e2label from the Debian OXNAS root file system downloaded from your site.

Suggestions?
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 11, 2018 11:38PM
atglabs,

There are too many wrong steps in what you were doing. That's why I suggested to start kwboot in this post:
https://forum.doozan.com/read.php?2,71494,72234#msg-72234

It's simpler to go the route I described: kwboot with new u-boot, and boot straigth to USB Debian rootfs.

Anyhow, since you've chosen to get it booting with stock u-boot. Here are the corrections.

> load_dtb=ext2load usb 0:1 0x1c00000
> /boot/dts/kirkwood-goflexnet.dtb

Booting with stock u-boot, this DTB is not needed. In fact, it is not supported by stock u-boot.

> usb_boot=usb start; run load_uimage; run
> load_initrd; run load_dtb; bootm 0x800000
> 0x1100000 0x1c00000;

Therefore, the command above is wrong for stock u-boot.


> CE>> run load_uimage=ext2load usb 0:1 0x800000
> boot/uImage

You would not run an env like that. It should just be
run load_uimage
run load_initrd

> I'm thinking the rootpath=/mnt/ARM_FS/ maybe
> should be something like /dev/usb0/?

No, that has nothing to do with booting Debian.


> NAND read: device 0 offset 0x100000, size
> 0x300000
>
> Reading data from 0x3ff800 -- 100% complete.
> 3145728 bytes read: OK
> ## Booting image at 00800000 ...
> Image Name: Linux-2.6.22.18
> Created: 2010-10-19 23:05:02 UTC
> Image Type: ARM Linux Kernel Image
> (uncompressed)
> Data Size: 1979140 Bytes = 1.9 MB
> Load Address: 00008000
> Entry Point: 00008000
> Verifying Checksum ... OK
> OK

In the above, you were booting into stock OS in NAND.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 12, 2018 02:58PM
@bodhi - I could not find a version of kermit 95 with the ssh capability to download to my windoz PC, and my Putty doesn't have any way to support the kermit protocol (xmodem, probably). If I can't get GoFlexNet to boot from USB using env vars, I'll have to put Debian on an old laptop and hope that it has kermit built into the OS.

Sorry about the corrupted code I posted - somehow putty overwrote some output over previous stuff and I didn't notice when I cut/pasted. Here is the current attempt to use the old uBoot:
printenv gives:
   load_uimage=ext2load usb 0:1 0x800000 boot/uImage
   load_initrd=ext2load usb 0:1 0x1100000 /boot/uInitrd

manual run of these env vars gives:
CE>> run load_uimage
** Block device usb 0 not supported
CE>> run load_initrd
** Block device usb 0 not supported

I presume something is wrong in the declaration of the load_* env vars above, and until these work, no use trying to go further.

Jerry
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 12, 2018 03:46PM
Jerry,

> ** Block device usb 0 not supported

At the u-boot prompt, bring up up the drive:

usb start

See if it is recognized, and then

run load_uimage

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 12, 2018 04:14PM
Hmmm. The GoFlexNet uBoot doesn't seem to have the 'usb' command built in.
CE>> usb start
Unknown command 'usb' - try 'help'

CE>> run usb start
## Error: "usb" not defined


I do see looking at a boot of the NAND kernel that the USB stuff is loaded and recognized. Here is a snippet of the log:
[    1.180000] Creating 4 MTD partitions on "nand_mtd":
[    1.180000] 0x00000000-0x00100000 : "u-boot"
[    1.190000] 0x00100000-0x00500000 : "uImage"
[    1.190000] 0x00500000-0x02500000 : "root"
[    1.200000] 0x02500000-0x10000000 : "data"

[    1.200000] ehci_marvell ehci_marvell.70059: Marvell Orion EHCI
[    1.210000] ehci_marvell ehci_marvell.70059: new USB bus registered, assigned bus number 1
[    1.240000] ehci_marvell ehci_marvell.70059: irq 19, io base 0xf1050100
[    1.260000] ehci_marvell ehci_marvell.70059: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
[    1.260000] usb usb1: configuration #1 chosen from 1 choice
[    1.270000] hub 1-0:1.0: USB hub found
[    1.270000] hub 1-0:1.0: 1 port detected
[    1.390000] USB Universal Host Controller Interface driver v3.0
[    1.670000] usb 1-1: new high speed USB device using ehci_marvell and address 2
[    1.820000] usb 1-1: configuration #1 chosen from 1 choice
[    1.820000] usbcore: registered new interface driver usblp
[    1.830000] drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver
[    1.840000] Initializing USB Mass Storage driver...
[    1.840000] scsi2 : SCSI emulation for USB Mass Storage devices
[    1.850000] usbcore: registered new interface driver usb-storage
[    1.850000] USB Mass Storage support registered.

Since the uBoot doesn't have a USB command, it looks like I'll have to figure out how to use kwboot to update the uBoot on the box.

Jerry
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 12, 2018 04:24PM
Jerry,

You can also use tftp to load uImage and uInitrd. But that also requires a Linux box (or a Linux VM) running somewhere in your network.

At the console prompt, see which commands are available:

help

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 12, 2018 09:44PM
OK, so I have TFTP server set up on my PC and GoFlexNet can run "TFTP" from uboot CLI. Should I try to load kwboot? I found the boot version in my box is 1.11, not 1.21, and it sounds like kwboot won't work.

Shoud I go directly to loading the uImage and uInitrd binaries from the goflexnet tarball? I can use cygwin to extract them into the tftp server dir, but don't know the addresses to load them into.

Jerry
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 12, 2018 10:10PM
Jerry,

> OK, so I have TFTP server set up on my PC and
> GoFlexNet can run "TFTP" from uboot CLI. Should I
> try to load kwboot? I found the boot version in my
> box is 1.11, not 1.21, and it sounds like kwboot
> won't work.

kwboot is for UART booting only. A serial console is required.

>
> Shoud I go directly to loading the uImage and
> uInitrd binaries from the goflexnet tarball? I can
> use cygwin to extract them into the tftp server
> dir, but don't know the addresses to load them
> into.

The same addresses would be OK. But it's better with stock u-boot to use a ittle more. So change uInitrd to 0x2100000.

0x800000 uImage
0x2100000 uInitrd

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 13, 2018 01:09PM
Some progress - TFTP server has downloaded three files from the Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 tarball:
   tftp 0x800000 uImage
   tftp 0x1100000 uInitrd
   tftp 0x1c00000 kirkwood-goflexnet.dtb

I then try to boot these memory images:
 CE>> bootm 0x800000 0x1100000 0x1c00000
## Booting 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 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK
## Loading Ramdisk 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 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK

Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Error: unrecognized/unsupported machine ID (r1 = 0x0000020f).

Available machine support:
ID (hex)        NAME
ffffffff        Generic DT based system
ffffffff        Marvell Kirkwood (Flattened Device Tree)

Please check your kernel config and/or bootloader.

Note that I just extracted the three files from Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar and I couldn't use mkimage to reconstruct the files since my only linux box (the PogoPro) is now torked.

I must be doing something not quite right since the dtb doesn't look like it's identifying the goflexnet box. Perhaps an env var?

Jerry
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 13, 2018 05:02PM
Jerry,

See step 4 in the installation instruction.

Quote
https://forum.doozan.com/read.php?2,12096,12096#msg-12096
Updated 24 Jul 2017:

Basic Debian stretch Kirkwood rootfs for most Kirwood plugs:

- tarball size: 188M
- install size: 488M
- The init system used in this rootfs is sysvinit . To boot with systemd, see note 2 below.
- Installed packages: nano, avahi, ntp, busybox-syslogd (log to RAM), htop, isc-dhcp-client, dialog, bzip2, nfs server/client, iperf, ethtool, sysvinit-core, sysvinit, and sysvinit-utils.
- see LED controls in /etc/rc.local, and /etc/init.d/halt
- see some useful aliases in /root/.profile
- root password: root

Download at Dropbox:

Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2

md5:
bf3d29569943875df348fb5ca03b348c
sha256:
4ed5714fdb123cdb40e973f3d0754e91cd199b75a9874018f2b5dc9cfa8ae8bb

And remember to check the hash of what you download, as always.

Installation:

Installation can be done on any Linux box, with a fresh USB drive (SD card or HDD would work fine too).

Note: all steps below must be done while logging in as root user (not sudo). If you are not the root user then don't continue, because the rootfs will not work.

1. Format a new USB drive with a single Ext3 partition, and label it rootfs. If you are running the latest U-Boot for Kirkwood then you can use Ext4.

2. Mount the drive on a Linux box. cd to top level directory and extract it. It is assuming the USB drive is mounted at /media/sdb1
cd /media/sdb1
tar -xjf Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2

3. Adjust fstab (optional).

Edit /media/sdb1/etc/fstab entry for root device to match the rootfstype of your rootfstype if you use Ext4 or Ext2. However, you can keep it as is without problem in booting since the kernel will figure out which file system the rootfs was formatted.

LABEL=rootfs / ext3 noatime,errors=remount-ro 0 1

4. Create uImage with embedded DTB for booting with older u-boots (2012 or earlier). Skip this step if you have installed the latest U-Boot for Kirkwood (or are installing this u-boot at the same time).

Please replace kirkwood-goflexnet.dtb below with the correct DTB name for your box (see the folder /media/sdb1/boot/dts for the exact spelling of your Kirkwood box name).

Generate the uImage with DTB embedded inside:
cd /media/sdb1/boot
cp -a zImage-4.12.1-kirkwood-tld-1 zImage.fdt
cat dts/kirkwood-goflexnet.dtb >> zImage.fdt
mv uImage uImage.orig
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-4.12.1-kirkwood-tld-1 -d zImage.fdt uImage
sync

If your Linux box does not have mkimage, then install it

apt-get install u-boot-tools

5. Done. Take this USB rootfs to your plug and cold start. After booted into Debian, see Note1 and Note2 below. It is very important that you do Note1 steps to secure your box.


You need another Linux box to run mkimage.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 11/13/2018 05:04PM by bodhi.
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 13, 2018 07:40PM
Thanks @bodhi. Instead of getting another linux box working, I found out that the Pogo uboot could use tftp to update the uboot in flash, so I installed the latest doozan uboot and voila, I can now boot from the USB drive. It didn't give me a way to save the original uboot using tftp back to my laptop, but looks like the new uboot is working pretty well.

So my next task is to mount the original GoFlexNet root fs as r/w so I can edit the init.d/rcS script that lurched the box initially. Watching Debian boot over serial port, I see some info that should tell me where and how to mount the mtdblock devs.
[    6.624641] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    6.632254] Scanning device for bad blocks
[    6.806721] Bad eraseblock 1592 at 0x00000c700000
[    6.860142] 4 ofpart partitions found on MTD device orion_nand
[    6.866042] Creating 4 MTD partitions on "orion_nand":
[    6.871229] 0x000000000000-0x000000100000 : "u-boot"
[    6.877520] 0x000000100000-0x000000500000 : "uImage"
[    6.883877] 0x000000500000-0x000002500000 : "pogoplug"
[    6.890544] 0x000002500000-0x00000fd00000 : "root"

Here's the output of the mount command before I try to mount the old mtdblock file systems:
root@debian:~# mount
/dev/sda1 on /             type ext4 (rw,noatime,block_validity,delalloc,barrier,user_xattracl,errors=remount-ro)
devtmpfs  on /dev       type devtmpfs (rw,relatime,size=58248k,nr_inodes=14562,mode=75)
sysfs        on /sys        type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs       on /run         type tmpfs (rw,nosuid,noexec,relatime,size=11752k,mode=755)
tmpfs       on /run/lock  type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc         on /proc       type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs       on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=23500k)
devpts     on /dev/pts   type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmoe=000)
tmpfs       on /tmp        type tmpfs (rw,relatime)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw,relatime)

I have the following mtdblock devs:
/dev/mtdblock0  /dev/mtdblock1  /dev/mtdblock2  /dev/mtdblock3

So I'm guessing that mtdblocks are:
0x000000000000-0x000000100000 : "u-boot"      [The new uboot I installed over tftp]
0x000000100000-0x000000500000 : "uImage"    [Original GoFlexNet kernel]
0x000000500000-0x000002500000 : "pogoplug" [Original GoFlexNet pogo-specific code]
0x000002500000-0x00000fd00000 : "root"           [Original ro root filesystem that should contain init.d/rcS]
[[/code]

Do I need to fix up /etc/fstab or just use a mount cmd?  
# /etc/fstab: static file system information.
# <file system> <mount point>   <type>  <options>                      <dump>  <pass>
LABEL=rootfs    /                         ext2    noatime,errors=remount-ro 0             1
tmpfs                 /tmp                   tmpfs   defaults                               0             0

I don't remember the output of the mount cmd on the original GoFlexNet, and am kinda lost on how to run mount to put the old filesystem on something like /oldfs. Suggestions as to 'type' and 'file system' args to mount?

TIA Jerry
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 13, 2018 08:59PM
Jerry,

> Thanks @bodhi. Instead of getting another linux
> box working, I found out that the Pogo uboot could
> use tftp to update the uboot in flash, so I
> installed the latest doozan uboot

Which u-boot? Jeff's old u-boot? or my released u-boot? at console prompt,

ver
printenv


> and voila, I can
> now boot from the USB drive. It didn't give me a
> way to save the original uboot using tftp back to
> my laptop, but looks like the new uboot is working
> pretty well.

When there is a will, there is a way :)

> I have the following mtdblock devs:
>
> /dev/mtdblock0  /dev/mtdblock1  /dev/mtdblock2 
> /dev/mtdblock3
>
>

> 0x000002500000-0x00000fd00000 : "root"
> [Original ro root filesystem that should contain
> init.d/rcS]
>

That's mtd3. But for sanity, confirm the mtd number in Debian:

cat /proc/mtd

> I don't remember the output of the mount cmd on the original GoFlexNet,
> and am kinda lost on how to run mount to put the old filesystem on something like /oldfs.

When you run new kernel in Debian rootfs, It does not have anything to do with how stock GoFlexNet OS is loaded by stock kernel or u-boot. The mtd blocks are mounted with special commands in userspace.

The root partition on GoFlex Net is JFFS2. So,

mkdir -p /tmp/gfnroot/
mknod /dev/mtdblock3 b 31 2
mount -t jffs2 /dev/mtdblock2 /tmp/gfnroot/

Now a warning. After you mounted and modified this stock rootfs, you will have trouble booting stock OS, if you are going to run stock u-boot. The default compression algorithms are not the same between a really old system 2.6.x like stock, and the latest kernel. (There is a way to access it, but it's too much trouble for little gain, pardon me in advance if I will not spend much time to help in this potential issue, unless you have a really rood reason why you want to preserve stock :).

At this point, if you don't need to save stock rootfs (mtd3) for some personal reason, then I would say you should consider that stock rootfs is gone. And you still like to run stock, you can get a forum member to upload this mtd3 so you can use it.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 14, 2018 03:04PM
Bodhi, I installed your latest uboot (2017.07-tld-1) for the GoFlexNet using the tftp method and now I can boot from the USB flash drive with Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi. Interestingly, trying to access the original GoFlex rootfs in nand shows that the mknod command doesn't seem to be needed as I already have all four mtdblocks and can mount the rootfs using the jffs2 type:
root@debian:/# mknod /dev/mtdblock2 b 31 2
mknod: /dev/mtdblock2: File exists
root@debian:/# mount -t jffs2 /dev/mtdblock3 /tmp/gfnroot
[63444.734338] jffs2: notice: (3459) jffs2_build_xattr_subsystem: complete xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead,) found.

So I edit and fix the broken /etc/init.d/rcS file on the GFN in mtdblock3 and then power down, remove the USB flash drive, and reboot, hoping to get the original GFN kernel loaded. However, looking at the env vars set as default by your uboot install, I don't see any way to boot the original kernel as the only boot devices seem to be USB, Hard Drive, and MMC. So this has turned into a question of how to get uboot 2017.07-tld-1 to boot to the rootfs on /dev/mtdblock2.

Looking at the env vars, after trying to find a rootfs on USB, hard disk, and mmc and failing, the fail-over is a reset that repeats the loop. Seems like the problem is how to add to the init list in uenv_init_devices.
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;

printenv
CASset=min
MALLOC_len=1
arcNumber=3089
baudrate=115200
bootargs_root=root=/dev/mtdblock2 ro
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=4
bootdev=usb
ceboardver=DISCOVERY:0.1
ceserialno=NA1Y08M6
cesvcid=ZL9SNCS63FCEP79LLKNGRK5FKE
console=console=ttyS0,115200
device=0:1
devices=usb ide
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-goflexnet.dtb
ethact=egiga0
ethaddr=52:3b:20:9c:11:51
ethmtu=1500
ethprime=egiga0
if_netconsole=ping $serverip
init_ide=ide reset
init_mmc=mmc rescan
init_usb=usb start
ipaddr=192.168.0.14
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
loads_echo=0
mainlineLinux=yes
mtddevname=rootfs
mtddevnum=2
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
nandEnvBase=a0000
partition=nand0,2
preboot_nc=run if_netconsole start_netconsole
rootpath=/mnt/ARM_FS/
run_diag=yes
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.6
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_loaded=0
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
usb0Mode=host
usb_ready_retry=15

Environment size: 3283/131068 bytes

Can I create an env var init_nand with any operations needed to add the mtdblock2 into the list, or am I hopelessly unable to reboot the original gfn code? Suggestions welcome.

TIA

Jerry



Edited 1 time(s). Last edit at 11/14/2018 04:45PM by atglabs.
Re: GoflexNet with corrupted init.d/rcS can't boot fully
November 14, 2018 06:39PM
Bohdi basically answered that question in his last post.

Give up on stock, the Debian install you have built is infinitely more capable.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: