thosoo / pwn-CheckPoint-EDGE

This project is about taking control over the Check Point UTM-1 EDGE Series
5 stars 0 forks source link

CheckPoint 1000n info #1

Open walterav1984 opened 3 years ago

walterav1984 commented 3 years ago

CheckPoint Safe@Office 1000n:

Quite similar just with slower 300MHz CPU and SFP connector but without WLAN. Discovered the same internal serial tty config as you did this morning (j14 jumper short, j2 ground, rx, tx, 3,3v) since external serial and ssh is useless (lacks expert mode). Also tried todo a setenv bf=bootoct $(flash_unused_addr) forceboot numcores=$(numcores) init=$(/bin/sh) but failed.

Will try your root Arr0w combo soon but could you share your uartboot.script to load OpenWrt?

U-Boot 1.1.1  SDK 1.9 (Development build) (Build time: Feb  2 2011 - 12:54:14)

row bits: 13, col bits: 10, banks: 4, ranks: 1, dram width: 16, size: 128 MB
CUST_N100 board revision major:2, minor:0, serial #: unknown
OCTEON CN5010-SCP pass 1.1, Core clock: 300 MHz, DDR clock: 331 MHz (662 Mhz data rate)
Warning: Board descriptor tuple not found in eeprom, using defaults
PAL rev: 0.00, MCU rev: 0.00, CPU voltage: 0.00
w83l786g_gpio_mode_setting emtry
w83l786g_gpio_1_5_output_mode_control emtry
w83l786g_gpio_1_7_output_default emtry
w83l786g_gpio_io_def emtry
DRAM:  128 MB
Clearing DRAM...... done
Flash:  2 MB
BIST check passed.
Starting PCI
PCI Status: PCI 32-bit
PCI BAR 0: 0x00000000, PCI BAR 1: Memory 0x00000000  PCI 0xf8000000
Net:   octeth0, octeth1, octeth2
 Bus 0 (CF Card): not available  

SofaWare debug level: 1

                          Yyy                 yyY    
                           YYYYYYYyyyyyyyYYYYYYY     
                            YYYYY#########YYYYY      
                             YYY#    ???  #YYY       
                              YY#   ( O)  #YY        
                               Y#    ~~   #Y         
                               YY#########YY         
                          @@@  YYYYYYYYYYYYY  @@@    
                          @@@@ YYYYYYYYYYYYY @@@@    
                          @@@@ YYYYYYYYYYYYY @@@@    
                           @@@@@@@@@@@@@@@@@@@@@     
                            @@@@@@@@@@@@@@@@@@@      
                            VVV@@@@@@@@@@@@@VVV      
                            VV               VV      
                            V                 V      
                              SofaWare Embedded!     
                                    Sbox4  

                Boot Code Version: 15 (Build time: Feb  2 2011 - 12:53:34)

<<***** BLOB Details *****>>
LAN MAC                : REDACTED 
DMZ MAC                : REDACTED 
WAN MAC                : REDACTED
License Key            : REDACTED
Activation Key         : REDACTED
Serial Num             : N/A 
Part Num               : REDACTED 
Vendor Mask            : 0x00002000 
Number of SFP Ports    : 1 
Number of USB Ports    : 2 
Number of Switch Ports : 4 
DSL Modem              : Yes 
ANNEX                  : B 

 0 
Read primary dsl header from flash
VNAND: vnand_scan(): initialize Virtual NAND driver v1.2 25/10/09
VNAND: build_translate_table(): NAND bad block at 271 (oob bad block type = 0x0)
VNAND: build_translate_table(): NAND bad block at 567 (oob bad block type = 0x0)
VNAND: build_translate_table(): bad block 271 remap to block 1004
VNAND: build_translate_table(): bad block 567 remap to block 1005
VNAND: build_translate_table(): NAND check did find bad blocks
128 MiB
dsl main firmware is OK
Reading PRIMARY firmware header from 43384832...
Image  size: 12360587 bytes
Reading PRIMARY firmware...
Verify PRIMARY firmware ...
PRIMARY firmware OK

<<***** SofaWare PRIMARY Image Details *****>>
Vendor Mask             : 0x2020
Version Num             : "8.2.33"
File Type               : "SofaWare Firmware" (1) 
Total File Size         : 0x00bc9ae3
Image Size              : 0x00bc9a63
Run Image Size          : 0x0033aa63
Unzipped Run Image Size : 0x00741cfb
Zip Type                : "GZIP"
Run Address             : 0x02800000

Unzip image to address 0x02800000 ...
Running image from address 0x02800000 (cores 1)...
argv[2]: numcores=1
argv[3]: mtdparts=phys_mapped_flash:64k@0x7d0000(cfgfile)
ELF file is 64 bit
Attempting to allocate memory for ELF segment: addr: 0xffffffff80100000 (adjusted to: 0x0000000000100000), size 0x621dd8
Allocated memory for ELF segment: addr: 0xffffffff80100000, size 0x621dd8
Processing PHDR 0
  Loading 5f2980 bytes at ffffffff80100000
  Clearing 2f458 bytes at ffffffff806f2980
## Loading Linux kernel with entry point: 0xffffffff8053f210 ...
** SofaWare boot information (core 0) ** 
* license (blob):           "REDACTED"
* activation key (blob):    "REDACTED"
* vendor mask (blob):       0x2000
* pn (blob):                "REDACTED"
* sn (blob):                ""
* SFP ports (blob):         0x1
* USB ports (blob):         0x2
* Switch ports (blob):      0x4
* DSL Modem (blob):                "Yes"
* ANNEX (blob):                "B"
* extra params 1 (blob):    ""
* extra params 2 (blob):    ""
* extra params 3 (blob):    ""
* extra params 4 (blob):    ""
* extra params 5 (blob):    ""
* extra params 6 (blob):    ""
* extra params 7 (blob):    ""
* extra params 8 (blob):    ""
* default ip:               192.168.10.1
* sub model:                0x0
* image version:            "8.2.33"
* firmware file name:       "firm1"
* kernel image size:        7609595
* firmware image offset:           12451840
* romdisk offset:           3386123
* image crc:                0xEC45BA61
* loader ver:               15
* test mode:                0
* debug:                    1
* safe@ user source:        1
* safe@ kernel source:      1
* default lan ip:           ""
* default wan ip:           ""
* debug host ip:            ""
* debug host port:          "0"
**************************************** 
Bootloader: Done loading app on coremask: 0x1
Linux version 2.6.27.7-Cavium-Octeon (rapson@apu.sofaware.com) (gcc version 4.3.3 (Cavium Networks Version: 1_9_0 build 80) ) #4 SMP Thu Ja1
CVMSEG size: 2 cache lines (256 bytes)
CPU revision is: 000d0601 (Cavium Octeon)
Checking for the multiply/shift bug... no.
Checking for the daddiu bug... no.
Determined physical RAM map:
 memory: 0000000007400000 @ 0000000000800000 (usable)
Wasting 114688 bytes for tracking 2048 unused pages
Initrd not found or empty - disabling initrd
Zone PFN ranges:
  DMA      0x00000800 -> 0x00100000
  Normal   0x00100000 -> 0x00100000
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
    0: 0x00000800 -> 0x00007c00
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 29290
Kernel command line:  bootoctlinux 0x02800000 numcores=1 mtdparts=phys_mapped_flash:64k@0x7d0000(cfgfile) console=ttyS1,115200
Primary instruction cache 32kB, virtually tagged, 4 way, 64 sets, linesize 128 bytes.
Primary data cache 16kB, 64-way, 2 sets, linesize 128 bytes.
PID hash table entries: 512 (order: 9, 4096 bytes)
Console: colour dummy device 80x25
console [ttyS1] enabled
Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
Memory: 114800k/118784k available (4393k kernel code, 3820k reserved, 1490k data, 206k init, 0k highmem)
Calibrating delay using timer specific routine.. 600.89 BogoMIPS (lpj=3004461)
Mount-cache hash table entries: 256
Checking for the daddi bug... no.
Brought up 1 CPUs
net_namespace: 1208 bytes
xor: measuring software checksum speed
   8regs     :   488.800 MB/sec
   8regs_prefetch:   451.600 MB/sec
   32regs    :   684.400 MB/sec
   32regs_prefetch:   633.600 MB/sec
xor: using function: 32regs (684.400 MB/sec)
NET: Registered protocol family 16
Enabling Octeon big bar support
PCI Status: PCI 32-bit
PCI Clock: 66 MHz
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
pci 0000:00:01.0: PCI bridge, secondary bus 0000:01
pci 0000:00:01.0:   IO window: disabled
pci 0000:00:01.0:   MEM window: disabled
pci 0000:00:01.0:   PREFETCH window: disabled
bus: 00 index 0 io port: [4000, ffffffff]
bus: 00 index 1 mmio: [11b00f0000000, 11b0130000000]
bus: 01 index 0 mmio: [0, 0]
bus: 01 index 1 mmio: [0, 0]
bus: 01 index 2 mmio: [0, 0]
bus: 01 index 3 mmio: [0, 0]
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 1, 8192 bytes)
TCP established hash table entries: 4096 (order: 4, 65536 bytes)
TCP bind hash table entries: 4096 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
NET: Registered protocol family 1
/proc/octeon_perf: Octeon performace counter interface loaded
Octeon watchdog driver loaded with a timeout of 14316 ms.
OcteonUSB: Detected 1 ports
OcteonUSB OcteonUSB.0: Octeon Host Controller
OcteonUSB OcteonUSB.0: new USB bus registered, assigned bus number 1
OcteonUSB OcteonUSB.0: irq 64, io mem 0x00000000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: Octeon Host Controller
usb usb1: Manufacturer: Linux 2.6.27.7-Cavium-Octeon Octeon USB
usb usb1: SerialNumber: OcteonUSB.0
OcteonUSB: Registered HCD for port 0 on irq 64
HugeTLB registered 2 MB page size, pre-allocated 0 pages
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
squashfs: version 3.4 (2008/08/26) Phillip Lougher
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
fuse init (API version 7.9)
msgmni has been set to 224
async_tx: api initialized (sync-only)
io scheduler noop registered
io scheduler cfq registered (default)
pci_hotplug: PCI Hot Plug PCI Core version: 0.5
fakephp: Fake PCI Hot Plug Controller Driver
Generic LED driver initialize
usb 1-1: new high speed USB device using OcteonUSB and address 2
usb 1-1: configuration #1 chosen from 1 choice
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
usb 1-1: New USB device found, idVendor=0409, idProduct=005a
usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
SofaWare LED driver initialize 
usb 1-1.1: new high speed USB device using OcteonUSB and address 3
Initialize DSL driver 
Serial: 8250/16550 driver2 ports, IRQ sharing disabled
loop: module loaded
PPP generic driver version 2.4.2
PPP Deflate Compression module registered
PPP BSD Compression module registered
NET: Registered protocol family 24
PPPoL2TP kernel driver, V1.0
IMQ driver loaded successfully.
        Hooking IMQ before NAT on PREROUTING.
        Hooking IMQ after NAT on POSTROUTING.
Init ADSL control eth device
cavium-ethernet: Cavium Networks Octeon SDK version 1.9.0, build 312
Interface 0 has 3 ports (RGMII)
Enabling packet I/O on interface 0
i2c /dev entries driver
eth1: 100 Mbps Full duplex, port  0, queue  0
Uniform Multi-Platform E-IDE driver
Driver 'sd' needs updating - please use bus_type methods
Driver 'sr' needs updating - please use bus_type methods
Fusion MPT base driver 3.04.07
Copyright (c) 1999-2008 LSI Corporation
Fusion MPT SPI Host driver 3.04.07
physmap platform flash device: 00200000 at 1fa00000
physmap-flash physmap-flash.0: map_probe failed
NAND flash(on Octeon BootBus) driver for linux by GIGABYTE
Something found on bootbus: 8-bit, base=1c000000
VNAND: vnand_scan(): initialize Virtual NAND driver v1.2 25/10/09
NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 271 at 0x021e0000
Bad eraseblock 567 at 0x046e0000
VNAND: build_translate_table(): NAND bad block at 271 (oob bad block type = 0x0)
VNAND: build_translate_table(): NAND bad block at 567 (oob bad block type = 0x0)
VNAND: build_translate_table(): bad block 271 remap to block 1004
VNAND: build_translate_table(): bad block 567 remap to block 1005
VNAND: build_translate_table(): NAND check did find bad blocks
Using static partition definition
Creating 10 MTD partitions on "nand_flash":
0x00000000-0x00040000 : "Config_File"
usb 1-1.1: configuration #1 chosen from 1 choice
0x00040000-0x00d80000 : "SofaWare_JFFS"
usb 1-1.1: New USB device found, idVendor=090c, idProduct=1000
usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.1: SerialNumber: 12102458004345
0x01b60000-0x01d60000 : "Sec_DSL_Image"
0x01d60000-0x01d80000 : "Pri_DSL_Image_Hdr"
0x01d80000-0x04b80000 : "SofaWare_Image_1"
0x01d80000-0x04b80000 : "ROMDISK"
0x01d80000-0x04b80000 : "SofaWare_Image_0"
0x06380000-0x07d80000 : "SofaWare_MMAP"
0x04b800a8-0x06380000 : "CTERA"
mtd: partition "CTERA" doesn't start on an erase block boundary -- force read-only
0x04b80000-0x06380000 : "CTIMAGE"
usbcore: registered new interface driver cdc_acm
cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
usbcore: registered new interface driver usblp
usbcore: registered new interface driver cdc_wdm
Initializing USB Mass Storage driver...
usb_usual_check_type 0x00000000
scsi0 : SCSI emulation for USB Mass Storage devices
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver libusual
usbcore: registered new interface driver usbserial
usbserial: USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
usbserial: USB Serial support registered for cp2101
usbcore: registered new interface driver cp2101
cp2101: Silicon Labs CP2101/CP2102 RS232 serial adaptor driver v0.07
usbserial: USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver ftdi_sio
ftdi_sio: v1.4.3:USB FTDI Serial Converters Driver
usbserial: USB Serial support registered for IPWireless converter
usbcore: registered new interface driver ipwtty
ipw: IPWireless tty driver v0.3
usbserial: USB Serial support registered for GSM modem (1-port)
usbcore: registered new interface driver option
option: USB Driver for GSM modems: v0.7.2
usbserial: USB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
usbserial: USB Serial support registered for Sierra USB modem
usbcore: registered new interface driver sierra
sierra: USB Driver for Sierra Wireless USB modems: v.1.3.2
rtc-ds1307 0-0068: rtc core: registered ds1337 as rtc0
md: linear personality registered for level -1
md: raid0 personality registered for level 0
md: raid1 personality registered for level 1
md: raid10 personality registered for level 10
raid6: int64x1    190 MB/s
raid6: int64x2    220 MB/s
raid6: int64x4    221 MB/s
raid6: int64x8    152 MB/s
raid6: using algorithm int64x4 (221 MB/s)
md: raid6 personality registered for level 6
md: raid5 personality registered for level 5
md: raid4 personality registered for level 4
md: faulty personality registered for level -5
device-mapper: ioctl: 4.14.0-ioctl (2008-04-23) initialised: dm-devel@redhat.com
u32 classifier
    Actions configured 
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
serial8250: ttyS0 at MMIO 0x1180000000800 (irq = 42) is a 16550A
serial8250: ttyS1 at MMIO 0x1180000000c00 (irq = 43) is a 16550A
cf: Octeon bootbus compact flash driver version 2.0
cf: Compact flash found in bootbus region 3 (16 bit).
cf:  Serial  (0 sectors, 512 bytes/sector)
cf: Compact flash not detected.
md: Autodetecting RAID arrays.
md: Scanned 0 and added 0 devices.
md: autorun ...
md: ... autorun DONE.
Partition ROMDISK found. Index == 5
Partition SofaWare_Image_1 found. Index == 4
slave->mtd.index = 0x4
slave->mtd.name = SofaWare_Image_1
slave->mtd.erasesize = 0x20000
slave->mtd.size = 0x2e00000
slave->offset = 0x1d80000
Setting partition ROMDISK offset=0x2c9ab0b size=0x88f080 [erasesize=0x20000]
mtd: partition "ROMDISK" doesn't start on an erase block boundary -- force read-only
Setting partition SofaWare_Image_1 offset=0x2960000 size=0x2220000 [erasesize=0x20000]
mount_block_root: Trying fs ext3, name: /dev/root
mount_block_root: Trying fs ext2, name: /dev/root
mount_block_root: Trying fs squashfs, name: /dev/root
VFS: Mounted root (squashfs filesystem) readonly.
/sbin/rc starting
Mounting file systems
fsck 1.38 (30-Jun-2005)
Set date by real time clock
time-stamp 1.1: 15:08:41 (1617548921 sec)
Start reset button daemon
Mount /flash
Create /var/tmp/
Create /var/log/
Create /var/run/utmp
Create /var/etc/hostap
Create /var/etc/wpa_supplicant
Create /var/etc/ppp
Create /var/lock
Create /var/etc/mgetty+sendfax
Setting up loopback
Disabling IP forwarding
vpnt: module license 'unspecified' taints kernel.
VPNT: IPv4 over VPN Tunnel driver installed
Pre-Initialization is done for the device 0x23.
Pre-Initialization is done for the device 0xc.
Arrow Switch+Phy driver installed
<00:00:00>KDebug/0: Loading SofaWare Kernel Module
time-stamp 1.2: 15:08:43 (1617548923 sec)
starting Safe@...
Start sofaware watch dog v2
run safeAtHome!!!!
time-stamp 1.3: 15:08:44 (1617548924 sec)
scsi 0:0:0:0: Direct-Access                                    PQ: 0 ANSI: 4
sd 0:0:0:0: [sda] 7802880 512-byte hardware sectors (3995 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] 7802880 512-byte hardware sectors (3995 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1
sd 0:0:0:0: [sda] Attached SCSI removable disk
sd 0:0:0:0: Attached scsi generic sg0 type 0
<00:00:00>KDebug/0: fw_open called 300
<00:00:00>UInfo.: mac address of interface eth1 is REDACTED
                                                                    <00:00:00>UInfo.: mac address of interface eth0 is REDACTED
                                                                                                                                        <00 
                                                                                                                                           0
                                                                                                                                           0

                                                                                                                                           d
                                                                                                                                           c
                                                                                                                                           0
                                                                                                                                           b
                                                                                                                                           b
                                                                                                                                           b
                                                                                                                                           b
                                                                                                                                           )
                                                                                                                                           0
                                                                                                                                           .
                                                                                                                                           f
                                                                                                                                           d
                                                                                                                                           K
                                                                                                                                           K
                                                                                                                                           '
                                                                                                                                           '
                                                                                                                                           d
: Allocating 4094K of core memory  - Suceeded
                                             <15:08:45>KInfo./0: FW1 Initialization Started
<15:08:45>KInfo./0: CheckRAM(before fw_drv_ini)
<15:08:45>KInfo./0: CheckRAM(after fw_drv_ini)
<15:08:45>KInfo./0: FW1 Initialization Completed
<15:08:45>KDebug/0: registering SW classifier

        Welcome to SofaWare SBOX4

(none) login:

Environment variables

Sbox4_cm# printenv
bootdelay=0
baudrate=115200
download_baudrate=115200
ipaddr=192.168.10.1
bootloader_flash_update=protect off $(uboot_flash_addr) +$(uboot_flash_size);erase $(uboot_flash_addr) +$(uboot_flash_size);cp.b $(fileaddrv
burn_app=erase $(flash_unused_addr) +$(filesize);cp.b $(fileaddr) $(flash_unused_addr) $(filesize)
bf=bootoct $(flash_unused_addr) forceboot numcores=$(numcores)
nuke_env=protect off $(env_addr) +$(env_size); erase $(env_addr) +$(env_size)
linux_cf=fatload ide 0 $(loadaddr) vmlinux.64;bootoctlinux $(loadaddr)
ls=fatls ide 0
autoload=n
autotest=1
ipaddr=192.168.10.1
serverip=192.168.10.10
ethact=octeth1
loadaddr=0x5700000
numcores=1
stdin=serial
stdout=serial
stderr=serial
env_addr=0xbfbe0000
env_size=0x20000
flash_base_addr=0xbfa00000
flash_size=0x200000
uboot_flash_addr=0xbfa40000
uboot_flash_size=0xa0000
flash_unused_addr=0xbfae0000
flash_unused_size=0x100000
blob_mac=REDACTED
blob_license=REDACTED
blob_activation_key=REDACTED
blob_vendor_mask=0x00002000
blob_part_number=REDACTED
blob_sfp_ports=1
blob_usb_ports=2
blob_switch_ports=4
blob_adsl_annex=B
sw_user_src=native
sw_kernel_src=native
sw_tftp_any_file=no
sw_test_mode=no
sw_tftpsrvmode=no
sw_pri_firm=firm1
sw_sec_firm=firm0
sw_serial_console=internal
ethaddr=REDACTED

Environment size: 1354/131068 bytes

Commands available in U-Boot

Sbox4_cm# ?
?       - alias for 'help'
askenv  - get environment variables from stdin
autoscr - run script from memory
base    - print or set address offset
bootelf - Boot from an ELF image in memory
bootoct - Boot from an Octeon Executive ELF image in memory
bootoctelf - Boot a generic ELF image in memory. NOTE: This command does not support
             simple executive applications, use bootoct for those.
bootoctlinux - Boot from a linux ELF image in memory
bootp   - boot image via network using BootP/TFTP protocol
cmp     - memory compare
coninfo - print console devices and informations
cp      - memory copy
crc32   - checksum calculation
date    - get/set/reset date & time
dhcp    - invoke DHCP client to obtain IP/boot params
dx106     - DX106 utility commands
88e1240     - 88E1240 utility commands
echo    - echo args to console
eeprom  - EEPROM sub-system
erase   - erase FLASH memory
ext2load- load binary file from a Ext2 filesystem
ext2ls  - list files in a directory (default /)
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatloadalloc - load binary file from a dos filesystem, and allocate
          a named bootmem block for file data
fatls   - list files in a directory (default /)
flinfo  - print FLASH memory information
freeprint    - Print list of free bootmem blocks
frtest   - Test reset button.
gettemp   - get the temparature of board
getvoltage   - get the CPU voltage of board
go      - start application at address 'addr'
gpio    - get/set gpio
gpioctrl   - control gpio 
gpioexpctrl   - control expanded gpio 
gunzip  - Uncompress an in memory gzipped file
help    - print online help
hwm     - get hardware voltage/temperature status
icrc32  - checksum calculation
ide     - IDE sub-system
ide_test  - test CF write
iloop   - infinite loop on address range
imd     - i2c memory display
imm     - i2c memory modify (auto-incrementing)
imw     - memory write (fill)
inm     - memory modify (constant address)
iprobe  - probe to discover valid I2C chip addresses
itest    - return true/false on integer compare

loadb   - load binary file over serial line (kermit mode)
loop    - infinite loop on address range
md      - memory display
md5   - MD5 hash calculation
mii     - MII utility commands
mm      - memory modify (auto-incrementing)
mtest   - simple RAM test
mw      - memory write (fill)
namedalloc    - Allocate a named bootmem block
namedfree    - Free a named bootmem block
namedprint    - Print list of named bootmem blocks
nand    - NAND sub-system
nm      - memory modify (constant address)
pci     - list and access PCI Configuraton Space
ping    - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
protect - enable or disable FLASH write protection
read64    - read 64 bit word from 64 bit address
read64b    - read 8 bit word from 64 bit address
read64l    - read 32 bit word from 64 bit address
read64s    - read 16 bit word from 64 bit address
read_cmp    - read and compare memory to val
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv  - set environment variables
sleep   - delay execution for some time
sofaware_blob_reset - SofaWare BLOB reset
sofaware_blob_update - SofaWare BLOB update
sofaware_preset_cfg_reset - Reset SofaWare preset configuration file 
sofaware_reset2def - reset 2 defaults
sofaware_restore_image - restore SofaWare primary firmware from secondary firmware
sofaware_show_info - Print SofaWare information 
sofaware_start - SofaWare start
sofaware_tftpload - load image via network using TFTP protocol
spierase
spieraseall
spiinfo
spiinit
spiread
spireaddeviceid
spiwritefile
tftpboot- boot image via network using TFTP protocol
tlv_eeprom  - EEPROM data parsing for ebt3000 board
 version - print monitor version
write64    - write 64 bit word to 64 bit address
write64b    - write 8 bit word to 64 bit address
write64l    - write 32 bit word to 64 bit address
write64s    - write 16 bit word to 64 bit address

mii

Sbox4_cm# mii info                                                                                                                   
PHY 0x0D: OUI = 0x5043, Model = 0x0C, Rev = 0x02,  10baseT, FDX                                                                      
PHY 0x10: OUI = 0x43FC4, Model = 0x0F, Rev = 0x0F, 100baseT, FDX                                                                     

Sbox4_cm# mii device                                                                                                                 
0.     (ffff)                 -- PHY control register --                                                                             
  (8000:8000) 0.15    =     1    reset                                                                                               
  (4000:4000) 0.14    =     1    loopback                                                                                            
  (2040:2040) 0. 6,13 =   b11    speed selection = ??? Mbps                                                                          
  (1000:1000) 0.12    =     1    A/N enable                                                                                          
  (0800:0800) 0.11    =     1    power-down                                                                                          
  (0400:0400) 0.10    =     1    isolate                                                                                             
  (0200:0200) 0. 9    =     1    restart A/N                                                                                         
  (0100:0100) 0. 8    =     1    duplex = full                                                                                       
  (0080:0080) 0. 7    =     1    collision test enable                                                                               
  (003f:003f) 0. 5- 0 =    63    (reserved)

flinfo

Sbox4_cm# flinfo                                                                                                                     

Bank # 1: CFI conformant FLASH (8 x 8)  Size: 2 MB in 35 Sectors                                                                     
  AMD Standard command set, Manufacturer ID: 0x00, Device ID: 0x3F                                                                   
  Erase timeout: 8192 ms, write timeout: 1 ms                                                                                        

  Sector Start Addresses:                                                                                                            
  BFA00000   RO   BFA04000   RO   BFA06000   RO   BFA08000   RO   BFA10000   RO                                                      
  BFA20000   RO   BFA30000   RO   BFA40000   RO   BFA50000   RO   BFA60000   RO                                                      
  BFA70000   RO   BFA80000        BFA90000        BFAA0000        BFAB0000                                                           
  BFAC0000        BFAD0000        BFAE0000        BFAF0000        BFB00000                                                           
  BFB10000        BFB20000        BFB30000        BFB40000        BFB50000                                                           
  BFB60000        BFB70000        BFB80000        BFB90000        BFBA0000                                                           
  BFBB0000        BFBC0000        BFBD0000        BFBE0000   RO   BFBF0000   RO                                                      

gettemp

Sbox4_cm# gettemp                                                                                                                    
Temprature1: 45.0                                                                                                                    
Temprature2: 45.5                                                                                                                    

getvoltage

Sbox4_cm# getvoltage                                                                                                                 
VCORE =2.464 V                                                                                                                       
VRAM =1.792 V                                                                                                                        
Vcc =3.168 V                                                                                                                         
Vin1-Singal core CPU voltage =1.024 V                                                                                                
Vin2-Dual core,or 700MHz =1.064 V                                                                                                    

freeprint

Sbox4_cm# freeprint                                                                                                                  

Printing bootmem block list, descriptor: 800fdef0,  head is 0x0000000004100000                                                       
Descriptor version: 3.0                                                                                                              
Block address: 0x0000000004100000, size: 0x0000000001600000, next: 0x0000000007f00000                                                
Block address: 0x0000000007f00000, size: 0x000000000005dc00, next: 0x0000000000000000                                                

hwm

Sbox4_cm# hwm                                                                                                                        
VCore Voltage: 2.040V (CR20=255)                                                                                                     
VRAM Voltage: 2.040V (CR21=255)                                                                                                      
VIN#1(1P2V) Voltage: 2.040V (CR23=255)                                                                                               
VIN#2(2P5V) Voltage: 4.080V (CR24=255)                                                                                               

VTIN#1 Temperature: 254.75'C (CR26=255, CR94=255)                                                                                    
VTIN#2 Temperature: 254.75'C (CR27=255, CR95=255)                                                                                    

iprobe

Sbox4_cm# iprobe                                                                                                                     
Valid chip addresses: 2E 50 51 68                                                                                                    

namedprint

Sbox4_cm# namedprint                                                                                                                 
List of currently allocated named bootmem blocks:                                                                                    
Name: __tmp_bootloader_internal, address: 0x0000000007f5dc00, size: 0x00000000000a0000, index: 0                                     
Name: __tmp_load, address: 0x0000000005700000, size: 0x0000000002800000, index: 1                                                    
Name: __tmp_reserved_linux, address: 0x0000000000100000, size: 0x0000000004000000, index: 2                                          

pci

Sbox4_cm# pci                                                                                                                        
Scanning PCI devices on bus 0                                                                                                        
BusDevFun  VendorId   DeviceId   Device Class       Sub-Class                                                                        
_____________________________________________________________                                                                        
00.01.00   0x12d8     0xe111     Bridge device           0x04                                                                        
thosoo commented 3 years ago

The arrow password seems to change somewhere at boot, as after boot it does not seem to work anymore. I have decompiled the kernel, but have not found the function for that yet However, to boot into root you need to type in the following

# setenv sw_linux_cmdline 'init=/bin/sh'
# sofaware_start

Here is the uartboot script:

#!/usr/local/bin/kermit

set line /dev/tty.usbserial-A600eZVP
set speed 115200
set carrier-watch off
set handshake none
set flow-control none
robust
set file type bin
set file name lit
set rec pack 1000
set send pack 1000
set window 5

echo {loading file}
PAUSE 1

OUTPUT loadb $(loadaddr) 115200\{13}
send boot-strip 
INPUT 180 {\{13}\{10}Sbox4_cm# }
IF FAIL STOP 1 INPUT timeout

echo {running kernel}
PAUSE 1
OUTPUT bootoctlinux $(loadaddr)\{13}
c

Make sure you change send boot-strip to your according file

walterav1984 commented 3 years ago

Thank you for the uart script, I got all the generic octeon images of LEDE/OpenWrt 17.07.9/18.06.9/19.07.7 to boot except the unstable upcoming 2102 release which stalls. Those stable versions sort of function with only "eth2" both RJ45 or SFP ( DMZ/wan2) supported.

[ 1731.280187] eth2: Link down
[ 1739.975090] eth2: 1000 Mbps Full duplex, port 2, queue 2 ###the same for both SFP or RJ45

The eth0 interface and eth1 interface are not working with the builtin switch, however the leds are corresponding fine when inserting/removing cables and or SFP's. Nor does these 'stable' images have a working pci(e) detection, so no 34/54 expresscard nor USB is detected even after installing multiple kmod-xxxx packages.

A quick iperf3 test shows ~150Mbit/~350/Mbit RX/TX on eth2 interface both RJ45 or SFP. A quick openssl benchmark shows these results:

1.1.1k | 31112480 | 23054680 | 9157090 | 13496320 | 3262420 | 1127770 | 6060370 | 5280430 | 4693620 | 19.7 | 568.5 | 40.7 | 46.6 

Is your wifi card detected and is it mini-pci or mini-pci(e) or solderd to bottom/upper board?

Interesting enough the OpenWrt 21.02.x release does boot and does detect pci-e expresscard 34/54 devices during its boot/init (realtek gigabit, via firewire, fresco usb3 tried different cards) it just stalls on rcu_sched octeon_usb_probe interrupt jiffies error:

[    0.000000] Linux version 5.4.109 (builder@buildhost) (gcc version 8.4.0 (Op1
[    0.000000] CVMSEG size: 0 cache lines (0 bytes)                             
[    0.000000] printk: bootconsole [early0] enabled                             
[    0.000000] CPU0 revision is: 000d0601 (Cavium Octeon+)                      
[    0.000000] Checking for the multiply/shift bug... no.                       
[    0.000000] Checking for the daddiu bug... no.                               
[    0.000000] Wasting 278528 bytes for tracking 4352 unused pages              
[    0.000000] Initrd not found or empty - disabling initrd                     
[    0.000000] cvmx_helper_board_get_mii_address: Unknown board type 20011      
[    0.000000] cvmx_helper_board_get_mii_address: Unknown board type 20011      
[    0.000000] cvmx_helper_board_get_mii_address: Unknown board type 20011      
[    0.000000] Using internal Device Tree.                                      
[    0.000000] software IO TLB: mapped [mem 0x03309000-0x03349000] (0MB)        
[    0.000000] Primary instruction cache 32kB, virtually tagged, 4 way, 64 sets.
[    0.000000] Primary data cache 16kB, 64-way, 2 sets, linesize 128 bytes.     
[    0.000000] Zone ranges:                                                     
[    0.000000]   DMA32    [mem 0x0000000001100000-0x00000000efffffff]           
[    0.000000]   Normal   empty                                                 
[    0.000000] Movable zone start for each node                                 
[    0.000000] Early memory node ranges                                         
[    0.000000]   node   0: [mem 0x0000000001100000-0x000000000325bfff]          
[    0.000000]   node   0: [mem 0x0000000003300000-0x0000000007efffff]          
[    0.000000] Zeroed struct page in unavailable ranges: 37540 pages            
[    0.000000] Initmem setup node 0 [mem 0x0000000001100000-0x0000000007efffff] 
[    0.000000] percpu: Embedded 18 pages/cpu s35872 r8192 d29664 u73728         
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 27556     
[    0.000000] Kernel command line:  bootoctlinux 0x5700000 console=ttyS1,115200
[    0.000000] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes, )
[    0.000000] Inode-cache hash table entries: 8192 (order: 4, 65536 bytes, lin)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off          
[    0.000000] Memory: 73148K/111984K available (6728K kernel code, 375K rwdata)
[    0.000000] SLUB: HWalign=128, Order=0-3, MinObjects=0, CPUs=1, Nodes=1      
[    0.000000] rcu: Hierarchical RCU implementation.                            
[    0.000000] rcu:     CONFIG_RCU_FANOUT set to non-default value of 32.       
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=16 to nr_cpu_ids=1.   
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 ji.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1     
[    0.000000] NR_IRQS: 127                                                     
[    0.000000] random: get_random_bytes called from start_kernel+0x320/0x580 wi0
[  830.672684] clocksource: OCTEON_CVMCOUNT: mask: 0xffffffffffffffff max_cycles
[  830.691858] Calibrating delay loop (skipped) preset value.. 600.00 BogoMIPS )
[  830.699979] pid_max: default: 32768 minimum: 301                             
[  830.704977] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linea)
[  830.712102] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, )
[  830.721503] Checking for the daddi bug... no.                                
[  830.727948] rcu: Hierarchical SRCU implementation.                           
[  830.733393] smp: Bringing up secondary CPUs ...                              
[  830.737868] smp: Brought up 1 node, 1 CPU                                    
[  830.747825] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, ms
[  830.757519] futex hash table entries: 256 (order: 3, 32768 bytes, linear)    
[  830.766543] NET: Registered protocol family 16                               
[  830.786572] Enabling Octeon big bar support                                  
[  830.796689] PCI Status: PCI 32-bit                                           
[  830.800960] PCI Clock: 66 MHz                                                
[  830.872635] SCSI subsystem initialized                                       
[  830.877031] usbcore: registered new interface driver usbfs                   
[  830.882586] usbcore: registered new interface driver hub                     
[  830.887919] usbcore: registered new device driver usb                        
[  830.892934] EDAC MC: Ver: 3.0.0                                              
[  830.901917] PCI host bridge to bus 0000:00                                   
[  830.906077] pci_bus 0000:00: root bus resource [mem 0x11b00f0000000-0x11b013)
[  830.917118] pci_bus 0000:00: root bus resource [io  0x4000-0xffffffff]       
[  830.923628] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]    
[  830.930405] pci_bus 0000:00: No busn resource found for root bus, will use []
[  830.938432] pci 0000:00:01.0: [12d8:e111] type 01 class 0x060400             
[  830.944426] pci 0000:00:01.0: enabling Extended Tags                         
[  830.949302] pci 0000:00:01.0: Enable PCIe Retrain Link quirk                 
[  830.956474] pci 0000:00:01.0: bridge configuration invalid ([bus 02-02]), reg
[  830.964484] pci_bus 0000:01: extended config space not accessible            
[  830.971696] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01      
[  830.978243] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 01      
[  830.984846] pci 0000:00:01.0: BAR 8: assigned [mem 0x11b00f0000000-0x11b00f0]
[  830.992481] pci 0000:00:01.0: BAR 9: assigned [mem 0x11b0100000000-0x11b0100]
[  831.001073] pci 0000:00:01.0: BAR 7: assigned [io  0x4000-0x4fff]            
[  831.007156] pci 0000:00:01.0: PCI bridge to [bus 01]                         
[  831.012109] pci 0000:00:01.0:   bridge window [io  0x4000-0x4fff]            
[  831.018195] pci 0000:00:01.0:   bridge window [mem 0x11b00f0000000-0x11b00f0]
[  831.025845] pci 0000:00:01.0:   bridge window [mem 0x11b0100000000-0x11b0100]
[  831.034600] workqueue: max_active 576 requested for napi_workq is out of ran2
[  831.050611] clocksource: Switched to clocksource OCTEON_CVMCOUNT             
[  831.058722] NET: Registered protocol family 2                                
[  831.064423] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096)
[  831.072792] TCP established hash table entries: 1024 (order: 1, 8192 bytes, )
[  831.080401] TCP bind hash table entries: 1024 (order: 2, 16384 bytes, linear)
[  831.087515] TCP: Hash tables configured (established 1024 bind 1024)         
[  831.094016] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)       
[  831.100534] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)  
[  831.107891] NET: Registered protocol family 1                                
[  831.112269] PCI: CLS 32 bytes, default 128                                   
[  831.327477] workingset: timestamp_bits=46 max_order=15 bucket_order=0        
[  831.381480] squashfs: version 4.0 (2009/01/31) Phillip Lougher               
[  831.387808] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORI.
[  831.404800] Block layer SCSI generic (bsg) driver version 0.4 loaded (major )
[  831.417585] octeon_gpio 1070000000800.gpio-controller: OCTEON GPIO driver pr.
[  831.425795] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled         
[  831.436662] 1180000000800.serial: ttyS0 at MMIO 0x1180000000800 (irq = 41, bN
[  831.447340] 1180000000c00.serial: ttyS1 at MMIO 0x1180000000c00 (irq = 42, bN
[  831.457173] printk: console [ttyS1] enabled                                  
[  831.457173] printk: console [ttyS1] enabled                                  
[  831.465439] printk: bootconsole [early0] disabled                            
[  831.465439] printk: bootconsole [early0] disabled                            
[  831.475582] octeon_rng octeon_rng: Octeon Random Number Generator            
[  831.500983] random: fast init done                                           
[  831.506963] loop: module loaded                                              
[  831.510157] Loading iSCSI transport class v2.0-870.                          
[  831.524932] physmap-flash 1f400000.nor: Can't get bank width from device tree
[  831.532356] physmap-flash: probe of 1f400000.nor failed with error -22       
[  831.539792] libphy: mdio_octeon: probed                                      
[  831.543761] mdio_octeon 1180000001800.mdio: Probed                           
[  831.549202] libphy: Fixed MDIO Bus: probed                                   
[  831.554568] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver       
[  831.561197] ehci-pci: EHCI PCI platform driver                               
[  831.565840] ehci-platform: EHCI generic platform driver                      
[  831.571441] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver           
[  831.577768] ohci-platform: OHCI generic platform driver                      
[  831.583474] usbcore: registered new interface driver usb-storage             
[  831.590493] i2c-octeon 1180000001000.i2c: probed                             
[  831.595560] octeon_wdt: Initial granularity 5 Sec                            
[  831.612087] EDAC DEVICE0: Giving out device to module octeon-cpu controller )
[  831.623011] EDAC DEVICE1: Giving out device to module octeon-l2c controller )
[  831.634252] octeon_lmc_edac octeon_lmc_edac.0: Disabled (ECC not enabled)    
[  831.641491] EDAC PCI0: Giving out device to module octeon-pci controller oct)
[  831.658166] Interface 0 has 3 ports (RGMII)

[  842.114511] random: crng init done
[  891.618383] rcu: INFO: rcu_sched detected stalls on CPUs/tasks:
[  891.624336]  (detected by 0, t=15002 jiffies, g=-611, q=181)
[  891.630023] rcu: All QSes seen, last rcu_sched kthread activity 15002 (429490
[  891.642396] swapper/0       R  running task        0     1      0 0x00100004
[  891.649475] Stack : ffffffff82240000 0000000010100ce0 8000000007030000 ca02cd
[  891.657518]         8000000007030000 8000000007017b40 0000000000000000 000003
[  891.665558]         0000000000000084 8000000006957618 2020202030203078 303034
[  891.673598]         0000000000000000 ffffffffffffffff 0000000000000010 000000
[  891.681637]         0000000000000000 ffffffff81947490 ffffffff81957400 fffff0
[  891.689677]         ffffffff81940000 00000000000000b5 0000000000000000 fffff0
[  891.697717]         0000000000000005 ffffffff814c4740 0000000000000000 fffff0
[  891.705756]         8000000007038000 8000000007017b40 ffffffff81940000 fffff0
[  891.713797]         0000000000000000 00000000000000b5 0000000000000000 fffff0
[  891.721836]         0000000000000000 ffffffff8111bda0 0000000000000000 000000
[  891.729875]         ...
[  891.732339] Call Trace:
[  891.734823] [<ffffffff8111bda0>] show_stack+0x30/0x100
[  891.740000] [<ffffffff81195a90>] rcu_sched_clock_irq+0x930/0x960
[  891.746045] [<ffffffff8119af3c>] update_process_times+0x2c/0x78
[  891.751996] [<ffffffff811a8f74>] tick_sched_timer+0x7c/0x248
[  891.757685] [<ffffffff8119bc64>] __hrtimer_run_queues+0x11c/0x1e8
[  891.763809] [<ffffffff8119c18c>] hrtimer_interrupt+0x12c/0x2f8
[  891.769679] [<ffffffff8111e644>] c0_compare_interrupt+0x74/0x88              
[  891.775633] [<ffffffff811852f0>] __handle_irq_event_percpu+0x80/0x1c8        
[  891.782104] [<ffffffff81185458>] handle_irq_event_percpu+0x20/0x80           
[  891.788319] [<ffffffff8118a4c8>] handle_percpu_irq+0x88/0xb8                 
[  891.794008] [<ffffffff81184860>] generic_handle_irq+0x40/0x58                
[  891.799784] [<ffffffff81791114>] do_IRQ+0x1c/0x30                            
[  891.804524] [<ffffffff81106680>] plat_irq_dispatch+0xb8/0xd8                 
[  891.810213] [<ffffffff8111792c>] handle_int+0x14c/0x158                      
[  891.815481] [<ffffffff815ab29c>] octeon_usb_probe+0x8a4/0xba8                
[  891.821265] [<ffffffff814d3d10>] platform_drv_probe+0x28/0x88                
[  891.827040] [<ffffffff814d1eb0>] really_probe+0xf8/0x350                     
[  891.832381] [<ffffffff814d2448>] device_driver_attach+0x70/0x98              
[  891.838330] [<ffffffff814d24d0>] __driver_attach+0x60/0x110                  
[  891.843930] [<ffffffff814cfdc8>] bus_for_each_dev+0x68/0xa8                  
[  891.849531] [<ffffffff814d11f0>] bus_add_driver+0x1f8/0x208                  
[  891.855133] [<ffffffff814d2bac>] driver_register+0x84/0x150                  
[  891.860734] [<ffffffff811009f8>] do_one_initcall+0x78/0x1b0                  
[  891.866338] [<ffffffff8198be84>] kernel_init_freeable+0x1f0/0x2d4            
[  891.872468] [<ffffffff8178b3e8>] kernel_init+0x14/0xfc                       
[  891.877636] [<ffffffff811175b0>] ret_from_kernel_thread+0x14/0x1c            
[  891.883773] rcu: rcu_sched kthread starved for 15002 jiffies! g-611 f0x2 RCU0
[  891.893884] rcu: RCU grace-period kthread stack dump:                        
[  891.898953] rcu_sched       R  running task        0    10      2 0x00100000 
[  891.906031] Stack : 800000000707bc60 800000000707bc60 ffffffff81940000 800000
[  891.914072]         8000000003351600 800000000707bc60 ffffffff81940000 800000
[  891.922113]         0000000000000006 0000000000000005 ffffffff81940000 fffff8
[  891.930154]         00000000fffedbd3 ffffffff8178ffa8 80000000033555d0 000001
[  891.938194]         0000000000000122 0000000000000000 00000000fffedbd3 fffff8
[  891.946234]         0500000000000001 8000000007036c00 ffffffff81957400 000001
[  891.954274]         ffffffff81940000 0000000000000000 0000000000000001 fffff4
[  891.962314]         ffffffff82106580 ffffffff81957718 ffffffff81940000 fffff0
[  891.970355]         ffffffff82240000 ffffffff81950000 ffffffff81190000 fffff0
[  891.978397]         ffffffff81950000 ffffffff81940000 ffffffff81830000 fffff8
[  891.986438]         ...                                                      
[  891.988901] Call Trace:                                                      
[  891.991372] [<ffffffff8178c1d8>] __schedule+0x4c0/0x610                      
[  891.996627] [<ffffffff8178c368>] schedule+0x40/0xe0                          
[  892.001537] [<ffffffff8178ffa8>] schedule_timeout+0x130/0x1d8                
[  892.007316] [<ffffffff811938c4>] rcu_gp_kthread+0x64c/0xb48                  
[  892.012929] [<ffffffff811559ec>] kthread+0x144/0x150                         
[  892.017924] [<ffffffff811175b0>] ret_from_kernel_thread+0x14/0x1c            
[ 1071.638385] rcu: INFO: rcu_sched detected stalls on CPUs/tasks:              
[ 1071.644340]  (detected by 0, t=60007 jiffies, g=-611, q=181)                 
[ 1071.650027] rcu: All QSes seen, last rcu_sched kthread activity 60007 (429490
[ 1071.662400] swapper/0       R  running task        0     1      0 0x00100004 
[ 1071.669479] Stack : ffffffff82240000 0000000010100ce0 8000000007030000 ca02cd
[ 1071.677521]         8000000007030000 8000000007017b40 0000000000000000 000003
[ 1071.685560]         00000000000000c3 8000000006957618 2020202030203078 303034
[ 1071.693600]         0000000000000000 ffffffffffffffff 0000000000000010 000000
[ 1071.701639]         0000000000000000 ffffffff81947490 ffffffff81957400 fffff0
[ 1071.709680]         ffffffff81940000 00000000000000b5 0000000000000000 fffff0
[ 1071.717719]         0000000000000005 ffffffff814c4740 0000000000000000 fffff0
[ 1071.725759]         8000000007038000 8000000007017b40 ffffffff81940000 fffff0
[ 1071.733800]         0000000000000000 00000000000000b5 0000000000000000 fffff0
[ 1071.741839]         0000000000000000 ffffffff8111bda0 0000000000000000 000000
[ 1071.749878]         ...                                                      
[ 1071.752340] Call Trace:                                                      
[ 1071.754820] [<ffffffff8111bda0>] show_stack+0x30/0x100                       
[ 1071.759993] [<ffffffff81195a90>] rcu_sched_clock_irq+0x930/0x960             
[ 1071.766037] [<ffffffff8119af3c>] update_process_times+0x2c/0x78              
[ 1071.771987] [<ffffffff811a8f74>] tick_sched_timer+0x7c/0x248                 
[ 1071.777674] [<ffffffff8119bc64>] __hrtimer_run_queues+0x11c/0x1e8            
[ 1071.783796] [<ffffffff8119c18c>] hrtimer_interrupt+0x12c/0x2f8               
[ 1071.789665] [<ffffffff8111e644>] c0_compare_interrupt+0x74/0x88              
[ 1071.795618] [<ffffffff811852f0>] __handle_irq_event_percpu+0x80/0x1c8        
[ 1071.802089] [<ffffffff81185458>] handle_irq_event_percpu+0x20/0x80           
[ 1071.808303] [<ffffffff8118a4c8>] handle_percpu_irq+0x88/0xb8                 
[ 1071.813991] [<ffffffff81184860>] generic_handle_irq+0x40/0x58                
[ 1071.819767] [<ffffffff81791114>] do_IRQ+0x1c/0x30                            
[ 1071.824505] [<ffffffff81106680>] plat_irq_dispatch+0xb8/0xd8                 
[ 1071.830196] [<ffffffff8111792c>] handle_int+0x14c/0x158                      
[ 1071.835460] [<ffffffff815ab29c>] octeon_usb_probe+0x8a4/0xba8                
[ 1071.841243] [<ffffffff814d3d10>] platform_drv_probe+0x28/0x88                
[ 1071.847018] [<ffffffff814d1eb0>] really_probe+0xf8/0x350                     
[ 1071.852359] [<ffffffff814d2448>] device_driver_attach+0x70/0x98              
[ 1071.858307] [<ffffffff814d24d0>] __driver_attach+0x60/0x110                  
[ 1071.863908] [<ffffffff814cfdc8>] bus_for_each_dev+0x68/0xa8                  
[ 1071.869508] [<ffffffff814d11f0>] bus_add_driver+0x1f8/0x208                  
[ 1071.875110] [<ffffffff814d2bac>] driver_register+0x84/0x150                  
[ 1071.880711] [<ffffffff811009f8>] do_one_initcall+0x78/0x1b0                  
[ 1071.886314] [<ffffffff8198be84>] kernel_init_freeable+0x1f0/0x2d4            
[ 1071.892442] [<ffffffff8178b3e8>] kernel_init+0x14/0xfc                       
[ 1071.897611] [<ffffffff811175b0>] ret_from_kernel_thread+0x14/0x1c            
[ 1071.903746] rcu: rcu_sched kthread starved for 60007 jiffies! g-611 f0x2 RCU0
[ 1071.913856] rcu: RCU grace-period kthread stack dump:                        
[ 1071.918926] rcu_sched       R  running task        0    10      2 0x00100000 
[ 1071.926003] Stack : 800000000707bc60 800000000707bc60 ffffffff81940000 800000
[ 1071.934045]         8000000003351600 800000000707bc60 ffffffff81940000 800000
[ 1071.942087]         0000000000000006 0000000000000005 ffffffff81940000 fffff8
[ 1071.950127]         00000000fffedbd3 ffffffff8178ffa8 80000000033555d0 000001
[ 1071.958166]         0000000000000122 0000000000000000 00000000fffedbd3 fffff8
[ 1071.966206]         0500000000000001 8000000007036c00 ffffffff81957400 000001
[ 1071.974247]         ffffffff81940000 0000000000000000 0000000000000001 fffff4
[ 1071.982287]         ffffffff82106580 ffffffff81957718 ffffffff81940000 fffff0
[ 1071.990329]         ffffffff82240000 ffffffff81950000 ffffffff81190000 fffff0
[ 1071.998369]         ffffffff81950000 ffffffff81940000 ffffffff81830000 fffff8
[ 1072.006409]         ...                                                      
[ 1072.008871] Call Trace:                                                      
[ 1072.011342] [<ffffffff8178c1d8>] __schedule+0x4c0/0x610                      
[ 1072.016597] [<ffffffff8178c368>] schedule+0x40/0xe0                          
[ 1072.021506] [<ffffffff8178ffa8>] schedule_timeout+0x130/0x1d8                
[ 1072.027284] [<ffffffff811938c4>] rcu_gp_kthread+0x64c/0xb48                  
[ 1072.032893] [<ffffffff811559ec>] kthread+0x144/0x150                         
[ 1072.037887] [<ffffffff811175b0>] ret_from_kernel_thread+0x14/0x1

Example console output of different pcie 34/54 expresscards:

USB3 chipset Fresco FL1100 example! 

[ 1064.864617] PCI host bridge to bus 0000:00                                                                                        
[ 1064.868663] pci_bus 0000:00: root bus resource [mem 0x11b00f0000000-0x11b0130000000] (bus address [0xf0000000-0x130000000])       
[ 1064.879735] pci_bus 0000:00: root bus resource [io  0x4000-0xffffffff]                                                            
[ 1064.886255] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]                                                         
[ 1064.893032] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]                                            
[ 1064.901059] pci 0000:00:01.0: [12d8:e111] type 01 class 0x060400                                                                  
[ 1064.907053] pci 0000:00:01.0: enabling Extended Tags                                                                              
[ 1064.911929] pci 0000:00:01.0: Enable PCIe Retrain Link quirk                                                                      
[ 1064.919098] pci 0000:00:01.0: bridge configuration invalid ([bus 02-02]), reconfiguring                                           
[ 1064.927107] pci_bus 0000:01: extended config space not accessible                                                                 
[ 1064.933315] pci 0000:01:00.0: [1b73:1100] type 00 class 0x0c0330                                                                  
[ 1064.939284] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x0000ffff 64bit]                                                         
[ 1064.946015] pci 0000:01:00.0: reg 0x18: [mem 0x00000000-0x00000fff 64bit]                                                         
[ 1064.952791] pci 0000:01:00.0: reg 0x20: [mem 0x00000000-0x00000fff 64bit]                                                         
[ 1064.959678] pci 0000:01:00.0: supports D1                                                                                         
[ 1064.963577] pci 0000:01:00.0: PME# supported from D0 D1 D3hot                                                                     
[ 1064.969357] pci 0000:01:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s x1 link at 0000:00:01.0 (capable of 4.000 )
[ 1064.984551] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01                                                           
[ 1064.991100] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 01                                                           
[ 1064.997706] pci 0000:00:01.0: BAR 8: assigned [mem 0x11b00f0000000-0x11b00f01fffff]                                               
[ 1065.005336] pci 0000:00:01.0: BAR 9: assigned [mem 0x11b0100000000-0x11b01001fffff 64bit pref]                                    
[ 1065.013929] pci 0000:00:01.0: BAR 7: assigned [io  0x4000-0x4fff]                                                                 
[ 1065.020032] pci 0000:01:00.0: BAR 0: assigned [mem 0x11b00f0000000-0x11b00f000ffff 64bit]                                         
[ 1065.028205] pci 0000:01:00.0: BAR 2: assigned [mem 0x11b00f0010000-0x11b00f0010fff 64bit]                                         
[ 1065.036374] pci 0000:01:00.0: BAR 4: assigned [mem 0x11b00f0011000-0x11b00f0011fff 64bit]                                         
[ 1065.044538] pci 0000:00:01.0: PCI bridge to [bus 01]                                                                              
[ 1065.049481] pci 0000:00:01.0:   bridge window [io  0x4000-0x4fff]                                                                 
[ 1065.055565] pci 0000:00:01.0:   bridge window [mem 0x11b00f0000000-0x11b00f01fffff]                                               
[ 1065.063216] pci 0000:00:01.0:   bridge window [mem 0x11b0100000000-0x11b01001fffff 64bit pref]  

FireFiwe 1394b chipset VIA

 [  719.993647] PCI host bridge to bus 0000:00                                                                                        
[  719.997806] pci_bus 0000:00: root bus resource [mem 0x11b00f0000000-0x11b0130000000] (bus address [0xf0000000-0x130000000])       
[  720.008850] pci_bus 0000:00: root bus resource [io  0x4000-0xffffffff]                                                            
[  720.015356] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]                                                         
[  720.022133] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]                                            
[  720.030161] pci 0000:00:01.0: [12d8:e111] type 01 class 0x060400                                                                  
[  720.036156] pci 0000:00:01.0: enabling Extended Tags                                                                              
[  720.041029] pci 0000:00:01.0: Enable PCIe Retrain Link quirk                                                                      
[  720.048202] pci 0000:00:01.0: bridge configuration invalid ([bus 02-02]), reconfiguring                                           
[  720.056212] pci_bus 0000:01: extended config space not accessible                                                                 
[  720.062407] pci 0000:01:00.0: [1106:3403] type 00 class 0x0c0010                                                                  
[  720.068371] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x000007ff 64bit]                                                         
[  720.075100] pci 0000:01:00.0: reg 0x18: [io  0x0000-0x00ff]                                                                       
[  720.080785] pci 0000:01:00.0: supports D2                                                                                         
[  720.084686] pci 0000:01:00.0: PME# supported from D2 D3hot D3cold                                                                 
[  720.092213] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01                                                           
[  720.098766] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 01                                                           
[  720.105369] pci 0000:00:01.0: BAR 8: assigned [mem 0x11b00f0000000-0x11b00f01fffff]                                               
[  720.112998] pci 0000:00:01.0: BAR 9: assigned [mem 0x11b0100000000-0x11b01001fffff 64bit pref]                                    
[  720.121592] pci 0000:00:01.0: BAR 7: assigned [io  0x4000-0x4fff]                                                                 
[  720.127692] pci 0000:01:00.0: BAR 0: assigned [mem 0x11b00f0000000-0x11b00f00007ff 64bit]                                         
[  720.135864] pci 0000:01:00.0: BAR 2: assigned [io  0x4000-0x40ff]                                                                 
[  720.141935] pci 0000:00:01.0: PCI bridge to [bus 01]                                                                              
[  720.146888] pci 0000:00:01.0:   bridge window [io  0x4000-0x4fff]                                                                 
[  720.152970] pci 0000:00:01.0:   bridge window [mem 0x11b00f0000000-0x11b00f01fffff]                                               
[  720.160619] pci 0000:00:01.0:   bridge window [mem 0x11b0100000000-0x11b01001fffff 64bit pref]

Ethernet chipset Realtek

[  753.583970] PCI host bridge to bus 0000:00                                                                                        
[  753.588016] pci_bus 0000:00: root bus resource [mem 0x11b00f0000000-0x11b0130000000] (bus address [0xf0000000-0x130000000])       
[  753.599089] pci_bus 0000:00: root bus resource [io  0x4000-0xffffffff]                                                            
[  753.605608] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]                                                         
[  753.612386] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]                                            
[  753.620411] pci 0000:00:01.0: [12d8:e111] type 01 class 0x060400                                                                  
[  753.626406] pci 0000:00:01.0: enabling Extended Tags                                                                              
[  753.631281] pci 0000:00:01.0: Enable PCIe Retrain Link quirk                                                                      
[  753.638448] pci 0000:00:01.0: bridge configuration invalid ([bus 02-02]), reconfiguring                                           
[  753.646459] pci_bus 0000:01: extended config space not accessible                                                                 
[  753.652677] pci 0000:01:00.0: [10ec:8168] type 00 class 0x020000                                                                  
[  753.658640] pci 0000:01:00.0: reg 0x10: [io  0x0000-0x00ff]                                                                       
[  753.664168] pci 0000:01:00.0: reg 0x18: [mem 0x00000000-0x00000fff 64bit]                                                         
[  753.670937] pci 0000:01:00.0: reg 0x20: [mem 0x00000000-0x00003fff 64bit pref]                                                    
[  753.678146] pci 0000:01:00.0: reg 0x30: [mem 0x00000000-0x0001ffff pref]                                                          
[  753.684945] pci 0000:01:00.0: supports D1 D2                                                                                      
[  753.689106] pci 0000:01:00.0: PME# supported from D0 D1 D2 D3hot D3cold                                                           
[  753.697162] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01                                                           
[  753.703716] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 01                                                           
[  753.710318] pci 0000:00:01.0: BAR 8: assigned [mem 0x11b00f0000000-0x11b00f01fffff]                                               
[  753.717949] pci 0000:00:01.0: BAR 9: assigned [mem 0x11b0100000000-0x11b01001fffff 64bit pref]                                    
[  753.726541] pci 0000:00:01.0: BAR 7: assigned [io  0x4000-0x4fff]                                                                 
[  753.732643] pci 0000:01:00.0: BAR 6: assigned [mem 0x11b00f0000000-0x11b00f001ffff pref]                                          
[  753.740718] pci 0000:01:00.0: BAR 4: assigned [mem 0x11b0100000000-0x11b0100003fff 64bit pref]                                    
[  753.749334] pci 0000:01:00.0: BAR 2: assigned [mem 0x11b00f0020000-0x11b00f0020fff 64bit]                                         
[  753.757501] pci 0000:01:00.0: BAR 0: assigned [io  0x4000-0x40ff]                                                                 
[  753.763577] pci 0000:00:01.0: PCI bridge to [bus 01]                                                                              
[  753.768525] pci 0000:00:01.0:   bridge window [io  0x4000-0x4fff]                                                                 
[  753.774610] pci 0000:00:01.0:   bridge window [mem 0x11b00f0000000-0x11b00f01fffff]                                               
[  753.782261] pci 0000:00:01.0:   bridge window [mem 0x11b0100000000-0x11b01001fffff 64bit pref]

I modified your "uart-script" for faster serial uploading of kernel&initramfs at the end of script I switch to "minicom" since I don't know how to get out of "ckermit" session.

#!/usr/local/bin/kermit
# serial programmer CH341A 3,3v mod
# CheckPoint 1000n u-boot serial file transfer kernel loading
set line /dev/ttyUSB0
set speed 115200
set carrier-watch off
set handshake none
set flow-control none
robust
set file type bin
set file name lit
set rec pack 1000
set send pack 1000
set window 5

echo {improve serial baudrate}
PAUSE 2
OUTPUT setenv download_baudrate 460800\{13}
PAUSE 1
OUTPUT setenv baudrate 460800\{13}
PAUSE 2
set speed 460800
PAUSE 1
OUTPUT \{13}
OUTPUT loadb $(loadaddr) 460800\{13}
send oct19077 
INPUT 180 {\{13}\{10}Sbox4_cm# }
IF FAIL STOP 1 INPUT timeout

echo {degrade serial baudrate OpenWrt console}
PAUSE 1
OUTPUT setenv baudrate 115200\{13}
PAUSE 3
set speed 115200
PAUSE 1

echo {connect minicom and bootkernel}
#OUTPUT bootoctlinux $(loadaddr)
QUIT
thosoo commented 3 years ago

I have not tested openwrt on this device a whole lot, but with 19.07 it did not find the mini pcie card. 21.02 looks promising.

The switch is based on the 98DX Prestera chipset. There is no open source driver for these as of now. However, there is documentation with all registers for this chipset online. What I have noticed about thes switch is that it does not have correct MII identification data, so implementation is tricky.

walterav1984 commented 3 years ago

Can confirm that the SFP is also working on "eth2" instead of RJ45, just not both at the same time. Updated earlier posts with this info and example pci detection of inserted pcie 34/54 expresscards.

Might have to build some custom OpenWrt octeon 5.4 images without the recently enabled i2c /edac / usb or pci stuff to see if it boots, since looking closer and comparing the console output of 19.07.7 / 21.02 to sofaware it seems that USB and i2c got initiliazed earlier than the original: [ 831.658166] Interface 0 has 3 ports (RGMII). After that line it just stalls... mentioning octeon_usb_probe and interrupt(s)...

walterav1984 commented 3 years ago

Is your device from the original sofa firmware webui 192.168.10.1/pop/Diagnostics.html also listed as a generic hardware type SBox-200-C?

Installed Product   Safe@Office 1000N ADSL (5 nodes)    
Uptime  00:00:41    
Hardware Type   SBox-200-C   
Hardware Version    1.4C-F-E-ADSL
thosoo commented 3 years ago

Is your device from the original sofa firmware webui 192.168.10.1/pop/Diagnostics.html also listed as a generic hardware type SBox-200-C?

For this it is better to look at the Board number, which the manufacturer chooses and is baked somewhere into the device, such that the kernel can see which board it is. There may be some minor differences in revision, like the safe@office and checkpoint brand, but the device should be mostly the same.

[    0.000000] cvmx_helper_board_get_mii_address: Unknown board type 20011 

If you are interested in what devices there are, I have decompiled the kernel using ghidra and found the following in the pseudo code. 20011 decimal is 0x4e2b hex and therefore N100.

undefined1 * octeon_board_type_string(void)

{
  ushort uVar1;
  undefined8 uVar2;
  char *pcVar3;

  uVar1 = *(ushort *)(octeon_bootinfo + 0x50);
  if (uVar1 == 0x19) {
    pcVar3 = "CB5600";
    goto LAB_ffffffff80101828;
  }
  if (uVar1 < 0x1a) {
    if (uVar1 == 0xc) {
      pcVar3 = "CN3005_EVB_HS5";
      goto LAB_ffffffff80101828;
    }
    if (uVar1 < 0xd) {
      if (uVar1 == 5) {
        pcVar3 = "NAC38";
        goto LAB_ffffffff80101828;
      }
      if (uVar1 < 6) {
        if (uVar1 == 2) {
          pcVar3 = "EBT3000";
          goto LAB_ffffffff80101828;
        }
        if (uVar1 < 3) {
          if (uVar1 == 0) {
            pcVar3 = "NULL";
            goto LAB_ffffffff80101828;
          }
          if (uVar1 == 1) {
            pcVar3 = "SIM";
            goto LAB_ffffffff80101828;
          }
        }
        else {
          if (uVar1 == 3) {
            pcVar3 = "KODAMA";
            goto LAB_ffffffff80101828;
          }
          if (uVar1 == 4) {
            pcVar3 = "NIAGARA";
            goto LAB_ffffffff80101828;
          }
        }
      }
      else {
        if (uVar1 == 8) {
          pcVar3 = "EBH3000";
          goto LAB_ffffffff80101828;
        }
        if (8 < uVar1) {
          if (uVar1 == 10) {
            pcVar3 = "HIKARI";
          }
          else {
            if (uVar1 < 0xb) {
              pcVar3 = "EBH3100";
            }
            else {
              pcVar3 = "CN3010_EVB_HS5";
            }
          }
          goto LAB_ffffffff80101828;
        }
        if (uVar1 == 6) {
          pcVar3 = "THUNDER";
          goto LAB_ffffffff80101828;
        }
        if (uVar1 == 7) {
          pcVar3 = "TRANTOR";
          goto LAB_ffffffff80101828;
        }
      }
    }
    else {
      if (uVar1 == 0x12) {
        pcVar3 = "EBH5601";
        goto LAB_ffffffff80101828;
      }
      if (uVar1 < 0x13) {
        if (uVar1 == 0xf) {
          pcVar3 = "EBT5800";
          goto LAB_ffffffff80101828;
        }
        if (uVar1 < 0x10) {
          if (uVar1 == 0xd) {
            pcVar3 = "KBP";
            goto LAB_ffffffff80101828;
          }
          if (uVar1 == 0xe) {
            pcVar3 = "CN3020_EVB_HS5";
            goto LAB_ffffffff80101828;
          }
        }
        else {
          if (uVar1 == 0x10) {
            pcVar3 = "NICPRO2";
            goto LAB_ffffffff80101828;
          }
          if (uVar1 == 0x11) {
            pcVar3 = "EBH5600";
            goto LAB_ffffffff80101828;
          }
        }
      }
      else {
        if (uVar1 == 0x15) {
          pcVar3 = "NIC_XLE_4G";
          goto LAB_ffffffff80101828;
        }
        if (0x15 < uVar1) {
          if (uVar1 == 0x17) {
            pcVar3 = "EBH5201";
          }
          else {
            if (uVar1 < 0x18) {
              pcVar3 = "EBT5600";
            }
            else {
              pcVar3 = "EBT5200";
            }
          }
          goto LAB_ffffffff80101828;
        }
        if (uVar1 == 0x13) {
          pcVar3 = "EBH5200";
          goto LAB_ffffffff80101828;
        }
        if (uVar1 == 0x14) {
          pcVar3 = "BBGW_REF";
          goto LAB_ffffffff80101828;
        }
      }
    }
  }
  else {
    if (uVar1 == 0x2716) {
      pcVar3 = "CUST_NTE102";
      goto LAB_ffffffff80101828;
    }
    if (uVar1 < 0x2717) {
      if (uVar1 == 0x1f) {
        pcVar3 = "MAX";
        goto LAB_ffffffff80101828;
      }
      if (uVar1 < 0x20) {
        if (uVar1 == 0x1c) {
          pcVar3 = "GENERIC";
          goto LAB_ffffffff80101828;
        }
        if (uVar1 < 0x1d) {
          if (uVar1 == 0x1a) {
            pcVar3 = "CB5601";
            goto LAB_ffffffff80101828;
          }
          if (uVar1 == 0x1b) {
            pcVar3 = "CB5200";
            goto LAB_ffffffff80101828;
          }
        }
        else {
          if (uVar1 == 0x1d) {
            pcVar3 = "ARROW";
            goto LAB_ffffffff80101828;
          }
          if (uVar1 == 0x1e) {
            pcVar3 = "SBOX4";
            goto LAB_ffffffff80101828;
          }
        }
      }
      else {
        if (uVar1 == 0x2712) {
          pcVar3 = "CUST_NS0216";
          goto LAB_ffffffff80101828;
        }
        if (0x2712 < uVar1) {
          if (uVar1 == 0x2714) {
            pcVar3 = "CUST_WMR500";
          }
          else {
            if (uVar1 < 0x2715) {
              pcVar3 = "CUST_NB5";
            }
            else {
              pcVar3 = "CUST_ITB101";
            }
          }
          goto LAB_ffffffff80101828;
        }
        if (uVar1 == 10000) {
          pcVar3 = "CUST_DEFINED_MIN";
          goto LAB_ffffffff80101828;
        }
        if (uVar1 == 0x2711) {
          pcVar3 = "CUST_WSX16";
          goto LAB_ffffffff80101828;
        }
      }
    }
    else {
      if (uVar1 == 0x271d) {
        pcVar3 = "CUST_AGS109";
        goto LAB_ffffffff80101828;
      }
      if (uVar1 < 0x271e) {
        if (uVar1 == 0x2719) {
          pcVar3 = "CUST_GCT105";
          goto LAB_ffffffff80101828;
        }
        if (0x2719 < uVar1) {
          if (uVar1 == 0x271b) {
            pcVar3 = "CUST_SGM107";
          }
          else {
            if (uVar1 < 0x271c) {
              pcVar3 = "CUST_AGS106";
            }
            else {
              pcVar3 = "CUST_GCT108";
            }
          }
          goto LAB_ffffffff80101828;
        }
        if (uVar1 == 0x2717) {
          pcVar3 = "CUST_AGS103";
          goto LAB_ffffffff80101828;
        }
        if (uVar1 == 0x2718) {
          pcVar3 = "CUST_GST104";
          goto LAB_ffffffff80101828;
        }
      }
      else {
        if (uVar1 == 20000) {
          pcVar3 = "CUST_DEFINED_MAX";
          goto LAB_ffffffff80101828;
        }
        if (uVar1 < 0x4e21) {
          if (uVar1 == 0x271e) {
            pcVar3 = "CUST_GCT110";
            goto LAB_ffffffff80101828;
          }
          if (uVar1 == 0x271f) {
            pcVar3 = "SBOX3";
            goto LAB_ffffffff80101828;
          }
        }
        else {
          if (uVar1 == 0x4e2b) {
            pcVar3 = "CUST_N100";
            goto LAB_ffffffff80101828;
          }
          if (uVar1 == 30000) {
            pcVar3 = "CUST_PRIVATE_MAX";
            goto LAB_ffffffff80101828;
          }
          if (uVar1 == 0x4e21) {
            pcVar3 = "CUST_PRIVATE_MIN";
            goto LAB_ffffffff80101828;
          }
        }
      }
    }
  }
  pcVar3 = "Unsupported Board";
LAB_ffffffff80101828:
  uVar2 = octeon_model_get_string((longlong)PRId);
  sprintf(name.51441,"%s (%s)",pcVar3,uVar2);
  return name.51441;
}

PCI-specific, there is a device specific interrupt, which needs?/should?/idk be added to the kernel. It should be ADA.

char * octeon_get_pci_interrupts(void)

{
  ushort uVar1;

  uVar1 = *(ushort *)(octeon_bootinfo + 0x50);
  if (0xc < uVar1) {
    if (uVar1 == 0x14) {
      return "AABCD";
    }
    if (uVar1 != 0x4e2b) {
      return "";
    }
    return "ABA"; # This one should be it.
  }
  if (uVar1 < 0xb) {
    if (uVar1 == 5) {
      return "AAAAADABAAAAAAAAAAAAAAAAAAAAAAAA";
    }
    if (uVar1 != 9) {
      return "";
    }
  }
  return "AAABAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
}

If you are interested in porting openwrt onto this device, I can assist to contribute code if you are willing to compile/test it. Currently, my linux computer is not in a ready to use state.

walterav1984 commented 3 years ago

I was indeed looking for a very generic name to make a OpenWrt wiki/device page so it will fit alot of similar CheckPoint hardware to draw attention of possible developers on the common properties like USB / flash storage.

I'm really interested in your code snippets and testing, but I know this can be a many month(s) project. I did build custom kernel and OpenWrt images around 5 to almost 15 years ago (WRT54gl ;-), since nowaydays its super easy to use the image builder (based on precompiled stuff) accompanied with custom config files/etc. So before I'm at the level of editing some pci driver files and generating a specific octeon image...

In other words may I contact you in a couple of weeks/early summer if I'm back at the level of custom kernel OpenWrt images?

thosoo commented 3 years ago

always

Spawn-2002 commented 2 years ago

Good afternoon. We are trying to transfer ChekPoint EDGE NW UTM-1 to Openwrt firmware. It is not clear how to mark up the NAND memory to place the firmware image in it. The firmware is based on the Openwrt version 19.07.0. With the record in nand sorted out. Running the firmware from NAND too, via the "bootcmd" variable. For now, we write the initramfs image to nand and run it, but because of this, the changes are not saved.

thosoo commented 2 years ago

Good afternoon. We are trying to transfer ChekPoint EDGE NW UTM-1 to Openwrt firmware. It is not clear how to mark up the NAND memory to place the firmware image in it. The firmware is based on the Openwrt version 19.07.0. With the record in nand sorted out. Running the firmware from NAND too, via the "bootcmd" variable. For now, we write the initramfs image to nand and run it, but because of this, the changes are not saved.

Hi,

Do I unterstand correctly, that you have successfully written openwrt onto nand using U-boot, but could not access nand from openwrt, such that settings are lost? Can you describe further?

Spawn-2002 commented 2 years ago

Do I unterstand correctly, that you have successfully written openwrt onto nand using U-boot, but could not access nand from openwrt, such that settings are lost? Can you describe further?

Good afternoon. We have compiled the Openwrt firmware version 19. After the assembly, several files turned out openwrt-octeon-default-rootfs.tar.gz openwrt-octeon-generic-ext4-sysupgrade.tar openwrt-octeon-generic-initramfs-kernel.bin - 17.8Mb openwrt-octeon-rootfs.cpio.gz After that, we first used your script and wrote the resulting openwrt-octeon-generic-initramfs-kernel.bin to memory at 0x5700000 and launched it with the bootoctlinux command. Openwrt started up. Then they tried to write to nand.

  1. Stop loading.
  2. "nand init" nand initialization.
  3. "nand erase 0x2800000 1149000" Clears the space for the firmware. Since we do not know the organization nand, the place was cleared according to the addresses from where you read the firmware.
  4. "tftpboot 0x5700000 openwrt-octeon-generic-initramfs-kernel.bin" I have tftpboot running
  5. "nand write 0x5700000 0x2800000 1149000" Write the firmware from DDR to nand.
  6. "setenv bootcmd 'nand init; nand read 0x5700000 0x2800000 1149000; bootcmdlinux'". Install the command to start Openwrt after reboot. 7.saveenv. 8.reset. After that, Openwrt starts, distributes the Internet, but the settings that are made in it are not saved. :(

PS: Sorry for my English, automatic translator.

Spawn-2002 commented 2 years ago

Everywhere I come across information that to start from nand, you need to use the "bootm" command. But in u-boot there is no such command...

thosoo commented 2 years ago

After that, Openwrt starts, distributes the Internet, but the settings that are made in it are not saved. :(

It is already impressive how far you have come. However, I think you have not allocated the memory correctly, but just loaded the initramfs into ram. The original sofaware firmware has a VNAND driver to access the NAND within linux. After the driver has been initialized it can be most likely found within these memory ranges:

0x00000000-0x00040000 : "Config_File"
0x00040000-0x00d80000 : "SofaWare_JFFS"

Here I am referencing the whole VNAND part from the bootlog.

Uniform Multi-Platform E-IDE driver
Driver 'sd' needs updating - please use bus_type methods
Driver 'sr' needs updating - please use bus_type methods
Fusion MPT base driver 3.04.07
Copyright (c) 1999-2008 LSI Corporation
Fusion MPT SPI Host driver 3.04.07
physmap platform flash device: 00200000 at 1fa00000
physmap-flash physmap-flash.0: map_probe failed
NAND flash(on Octeon BootBus) driver for linux by GIGABYTE
Something found on bootbus: 8-bit, base=1c000000
VNAND: vnand_scan(): initialize Virtual NAND driver v1.2 25/10/09
NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 590 at 0x049c0000
Bad eraseblock 770 at 0x06040000
VNAND: build_translate_table(): NAND bad block at 590 (oob bad block type = 0x0)
VNAND: build_translate_table(): NAND bad block at 770 (oob bad block type = 0x0)
VNAND: build_translate_table(): bad block 590 remap to block 1004
VNAND: build_translate_table(): bad block 770 remap to block 1005
VNAND: build_translate_table(): NAND check did find bad blocks
Using static partition definition
Creating 10 MTD partitions on "nand_flash":
0x00000000-0x00040000 : "Config_File"
0x00040000-0x00d80000 : "SofaWare_JFFS"
0x01b60000-0x01d60000 : "Sec_DSL_Image"
0x01d60000-0x01d80000 : "Pri_DSL_Image_Hdr"
0x01d80000-0x04b80000 : "SofaWare_Image_1"
0x01d80000-0x04b80000 : "ROMDISK"
0x01d80000-0x04b80000 : "SofaWare_Image_0"
0x06380000-0x07d80000 : "SofaWare_MMAP"
0x04b800a8-0x06380000 : "CTERA"
mtd: partition "CTERA" doesn't start on an erase block boundary -- force read-only
0x04b80000-0x06380000 : "CTIMAGE"

Can you post a bootlog as well?

Spawn-2002 commented 2 years ago

Hi. This is the bootlog of the original boot.

U-Boot 1.1.1  SDK 1.9 (Development build) (Build time: Jul  8 2010 - 17:06:13)

row bits: 13, col bits: 10, banks: 4, ranks: 1, dram width: 16, size: 128 MB
CN3010_EVB_HS5 board revision major:2, minor:0, serial #: 
OCTEON CN5010-SCP pass 1.1, Core clock: 500 MHz, DDR clock: 200 MHz (400 Mhz data rate)
Warning: Board descriptor tuple not found in eeprom, using defaults
!!! Configuring processor for 3 RGMII mode !!!
DRAM:  128 MB
Clearing DRAM...... done
Flash:  2 MB
BIST check passed.
Starting PCI
PCI Status: PCI 32-bit
PCI BAR 0: 0x00000000, PCI BAR 1: Memory 0x00000000  PCI 0xf8000000
Net:   octeth0, octeth1, octeth2
 Bus 0 (CF Card): not available  

CF LED does not exist
CF LED does not exist
SofaWare debug level: 1

                          Yyy                 yyY    
                           YYYYYYYyyyyyyyYYYYYYY     
                            YYYYY#########YYYYY      
                             YYY#    ???  #YYY       
                              YY#   ( O)  #YY        
                               Y#    ~~   #Y         
                               YY#########YY         
                          @@@  YYYYYYYYYYYYY  @@@    
                          @@@@ YYYYYYYYYYYYY @@@@    
                          @@@@ YYYYYYYYYYYYY @@@@    
                           @@@@@@@@@@@@@@@@@@@@@     
                            @@@@@@@@@@@@@@@@@@@      
                            VVV@@@@@@@@@@@@@VVV      
                            VV               VV      
                            V                 V      
                              SofaWare Embedded!     
                                    Sbox4  

        Boot Code Version: 13 (Build time: Jul  8 2010 - 17:05:35)

<<***** BLOB Details *****>>
LAN MAC                : EDIT 
DMZ MAC                : EDIT 
WAN MAC                : EDIT 
License Key            : EDIT 
Activation Key         : EDIT
Serial Num             : N/A 
Part Num               : 307873 
Vendor Mask            : 0x00002000 
Number of SFP Ports    : 0 
Number of USB Ports    : 2 
Number of Switch Ports : 4 
WLAN Region            : FCCA 
DSL Modem              : No 

 0 
VNAND: vnand_scan(): initialize Virtual NAND driver v1.2 25/10/09
VNAND: build_translate_table(): NAND bad block at 561 (oob bad block type = 0x0)
VNAND: build_translate_table(): bad block 561 remap to block 1004
VNAND: build_translate_table(): NAND check did find bad blocks
128 MiB
Reading PRIMARY firmware header from 42336256...
Image  size: 11303469 bytes
Reading PRIMARY firmware...
Verify PRIMARY firmware ...
PRIMARY firmware OK

<<***** SofaWare PRIMARY Image Details *****>>
Vendor Mask             : 0x2020
Version Num             : "8.1.47"
File Type               : "SofaWare Firmware" (1) 
Total File Size         : 0x00ac7985
Image Size              : 0x00ac7905
Run Image Size          : 0x00289905
Unzipped Run Image Size : 0x005d5f34
Zip Type                : "GZIP"
Run Address             : 0x02800000

Unzip image to address 0x02800000 ...
Running image from address 0x02800000 (cores 1)...
argv[2]: numcores=1
argv[3]: mtdparts=phys_mapped_flash:64k@0x7d0000(cfgfile)
ELF file is 64 bit
Attempting to allocate memory for ELF segment: addr: 0xffffffff80100000 (adjusted to: 0x0000000000100000), size 0x4db798
Allocated memory for ELF segment: addr: 0xffffffff80100000, size 0x4db798
Processing PHDR 0
  Loading 4b5980 bytes at ffffffff80100000
  Clearing 25e18 bytes at ffffffff805b5980
## Loading Linux kernel with entry point: 0xffffffff80455050 ...
** SofaWare boot information (core 0) ** 
* license (blob):           "EDIT"
* activation key (blob):    "EDIT"
* vendor mask (blob):       0x2000
* pn (blob):                "307873"
* sn (blob):                ""
* SFP ports (blob):         0x0
* USB ports (blob):         0x2
* Switch ports (blob):      0x4
* WLAN Region (blob):         "FCCA"
* DSL Modem (blob):                "No"
* extra params 1 (blob):    ""
* extra params 2 (blob):    ""
* extra params 3 (blob):    ""
* extra params 4 (blob):    ""
* extra params 5 (blob):    ""
* extra params 6 (blob):    ""
* extra params 7 (blob):    ""
* extra params 8 (blob):    ""
* default ip:               192.168.10.1
* sub model:                0x0
* image version:            "8.1.47"
* firmware file name:       "firm1"
* kernel image size:        6119220
* firmware image offset:           11403264
* romdisk offset:           2660781
* image crc:                0x651CD0BD
* loader ver:               13
* test mode:                0
* debug:                    1
* safe@ user source:        1
* safe@ kernel source:      1
* default lan ip:           ""
* default wan ip:           ""
* debug host ip:            ""
* debug host port:          "0"
**************************************** 
Bootloader: Done loading app on coremask: 0x1
Linux version 2.6.27.7-Cavium-Octeon (rapson@apu.sofaware.com) (gcc version 4.3.3 (Cavium Networks Version: 1_9_0 build 80) ) #4 SMP Tue Nov 2 13:23:48 IST 2010
CVMSEG size: 2 cache lines (256 bytes)
CPU revision is: 000d0601 (Cavium Octeon)
Checking for the multiply/shift bug... no.
Checking for the daddiu bug... no.
Determined physical RAM map:
 memory: 0000000007800000 @ 0000000000600000 (usable)
Wasting 86016 bytes for tracking 1536 unused pages
Initrd not found or empty - disabling initrd
Zone PFN ranges:
  DMA      0x00000600 -> 0x00100000
  Normal   0x00100000 -> 0x00100000
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
    0: 0x00000600 -> 0x00007e00
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 30300
Kernel command line:  bootoctlinux 0x02800000 numcores=1 mtdparts=phys_mapped_flash:64k@0x7d0000(cfgfile) console=ttyS1,115200
Primary instruction cache 32kB, virtually tagged, 4 way, 64 sets, linesize 128 bytes.
Primary data cache 16kB, 64-way, 2 sets, linesize 128 bytes.
PID hash table entries: 512 (order: 9, 4096 bytes)
Console: colour dummy device 80x25
console [ttyS1] enabled
Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
Memory: 118896k/122880k available (3459k kernel code, 3820k reserved, 1172k data, 190k init, 0k highmem)
Calibrating delay using timer specific routine.. 1000.90 BogoMIPS (lpj=5004549)
Mount-cache hash table entries: 256
Checking for the daddi bug... no.
Brought up 1 CPUs
net_namespace: 1208 bytes
NET: Registered protocol family 16
Enabling Octeon big bar support
PCI Status: PCI 32-bit
PCI Clock: 33 MHz
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
pci 0000:01:00.0: PME# supported from D0 D1 D3hot
pci 0000:01:00.0: PME# disabled
pci 0000:00:02.0: PCI bridge, secondary bus 0000:01
pci 0000:00:02.0:   IO window: disabled
pci 0000:00:02.0:   MEM window: 0xf0000000-0xf00fffff
pci 0000:00:02.0:   PREFETCH window: disabled
PCI: Enabling device 0000:00:02.0 (0000 -> 0002)
bus: 00 index 0 io port: [4000, ffffffff]
bus: 00 index 1 mmio: [11b00f0000000, 11b0130000000]
bus: 01 index 0 mmio: [0, 0]
bus: 01 index 1 mmio: [11b00f0000000, 11b00f00fffff]
bus: 01 index 2 mmio: [0, 0]
bus: 01 index 3 mmio: [0, 0]
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 1, 8192 bytes)
TCP established hash table entries: 4096 (order: 4, 65536 bytes)
TCP bind hash table entries: 4096 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
NET: Registered protocol family 1
/proc/octeon_perf: Octeon performace counter interface loaded
Octeon watchdog driver loaded with a timeout of 8589 ms.
OcteonUSB: Detected 1 ports
OcteonUSB OcteonUSB.0: Octeon Host Controller
OcteonUSB OcteonUSB.0: new USB bus registered, assigned bus number 1
OcteonUSB OcteonUSB.0: irq 64, io mem 0x00000000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: Octeon Host Controller
usb usb1: Manufacturer: Linux 2.6.27.7-Cavium-Octeon Octeon USB
usb usb1: SerialNumber: OcteonUSB.0
OcteonUSB: Registered HCD for port 0 on irq 64
HugeTLB registered 2 MB page size, pre-allocated 0 pages
squashfs: version 3.4 (2008/08/26) Phillip Lougher
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 232
io scheduler noop registered
io scheduler cfq registered (default)
pci_hotplug: PCI Hot Plug PCI Core version: 0.5
fakephp: Fake PCI Hot Plug Controller Driver
Generic LED driver initialize
SofaWare LED driver initialize 
Serial: 8250/16550 driver2 ports, IRQ sharing disabled
loop: module loaded
PPP generic driver version 2.4.2
PPP Deflate Compression module registered
PPP BSD Compression module registered
NET: Registered protocol family 24
PPPoL2TP kernel driver, V1.0
IMQ driver loaded successfully.
    Hooking IMQ before NAT on PREROUTING.
    Hooking IMQ after NAT on POSTROUTING.
cavium-ethernet: Cavium Networks Octeon SDK version 1.9.0, build 312
Interface 0 has 3 ports (RGMII)
Enabling packet I/O on interface 0
i2c /dev entries driver
Uniform Multi-Platform E-IDE driver
Driver 'sd' needs updating - please use bus_type methods
Driver 'sr' needs updating - please use bus_type methods
physmap platform flash device: 00200000 at 1fa00000
physmap-flash physmap-flash.0: map_probe failed
NAND flash(on Octeon BootBus) driver for linux by GIGABYTE
Something found on bootbus: 8-bit, base=1e000000
VNAND: vnand_scan(): initialize Virtual NAND driver v1.2 25/10/09
NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 561 at 0x04620000
VNAND: build_translate_table(): NAND bad block at 561 (oob bad block type = 0x0)
VNAND: build_translate_table(): bad block 561 remap to block 1004
VNAND: build_translate_table(): NAND check did find bad blocks
Using static partition definition
Creating 6 MTD partitions on "nand_flash":
0x00000000-0x00040000 : "Config_File"
0x00040000-0x00d80000 : "SofaWare_JFFS"
0x05980000-0x07d80000 : "SofaWare_MMAP"
0x01d80000-0x05980000 : "SofaWare_Image_1"
0x01d80000-0x05980000 : "ROMDISK"
0x01d80000-0x05980000 : "SofaWare_Image_0"
usbcore: registered new interface driver cdc_acm
cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
usbcore: registered new interface driver usblp
usbcore: registered new interface driver cdc_wdm
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver libusual
usbcore: registered new interface driver usbserial
usbserial: USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
usbserial: USB Serial support registered for cp2101
usbcore: registered new interface driver cp2101
cp2101: Silicon Labs CP2101/CP2102 RS232 serial adaptor driver v0.07
usbserial: USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver ftdi_sio
ftdi_sio: v1.4.3:USB FTDI Serial Converters Driver
usbserial: USB Serial support registered for IPWireless converter
usbcore: registered new interface driver ipwtty
ipw: IPWireless tty driver v0.3
usbserial: USB Serial support registered for GSM modem (1-port)
usbcore: registered new interface driver option
option: USB Driver for GSM modems: v0.7.2
usbserial: USB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
usbserial: USB Serial support registered for Sierra USB modem
usbcore: registered new interface driver sierra
sierra: USB Driver for Sierra Wireless USB modems: v.1.3.2
pcf8563 0-0051: chip found, driver version 0.4.3
pcf8563 0-0051: rtc core: registered pcf8563 as rtc0
u32 classifier
    Actions configured 
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP cubic registered
NET: Registered protocol family 17
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
serial8250: ttyS0 at MMIO 0x1180000000800 (irq = 42) is a 16550A
serial8250: ttyS1 at MMIO 0x1180000000c00 (irq = 43) is a 16550A
cf: Octeon bootbus compact flash driver version 2.0
cf: Compact flash found in bootbus region 3 (16 bit).
cf:  Serial  (0 sectors, 512 bytes/sector)
cf: Compact flash not detected.
Partition ROMDISK found. Index == 4
Partition SofaWare_Image_1 found. Index == 3
slave->mtd.index = 0x3
slave->mtd.name = SofaWare_Image_1
slave->mtd.erasesize = 0x20000
slave->mtd.size = 0x3c00000
slave->offset = 0x1d80000
Setting partition ROMDISK offset=0x2ae99ad size=0x83e080 [erasesize=0x20000]
mtd: partition "ROMDISK" doesn't start on an erase block boundary -- force read-only
Setting partition SofaWare_Image_1 offset=0x2860000 size=0x3120000 [erasesize=0x20000]
mount_block_root: Trying fs ext3, name: /dev/root
mount_block_root: Trying fs ext2, name: /dev/root
mount_block_root: Trying fs squashfs, name: /dev/root
VFS: Mounted root (squashfs filesystem) readonly.
usb 1-1: new high speed USB device using OcteonUSB and address 2
usb 1-1: configuration #1 chosen from 1 choice
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
/sbin/rc starting
Mounting file systems
fsck 1.38 (30-Jun-2005)
Set date by real time clock
pcf8563 0-0051: low voltage detected, date/time is not reliable.
usb 1-1: New USB device found, idVendor=05e3, idProduct=0608
usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
usb 1-1: Product: USB2.0 Hub
Start reset button daemon
Mount /flash
Create /var/tmp/
Create /var/log/
Create /var/run/utmp
Create /var/etc/hostap
Create /var/etc/wpa_supplicant
Create /var/etc/ppp
Create /var/lock
Create /var/etc/mgetty+sendfax
Setting up loopback
Disabling IP forwarding
vpnt: module license 'unspecified' taints kernel.
VPNT: IPv4 over VPN Tunnel driver installed
Pre-Initialization is done for the device 0x23.
Pre-Initialization is done for the device 0xc.
Pre-Initialization is done for the device 0xc.
Arrow Switch+Phy driver installed
ath_hal: 0.9.17.1 (AR5212, AR5416, RF5111, RF5112, RF2413, RF5413, RF2316, RF2317, DEBUG, REGOPS_FUNC, WRITE_EEPROM, 11D)
wlan: 0.8.4.2 (Atheros/multi-bss)
ath_rate_atheros: Copyright (c) 2001-2005 Atheros Communications, Inc, All Rights Reserved
ath_dev: Copyright (c) 2001-2007 Atheros Communications, Inc, All Rights Reserved
ath_pci: 0.9.4.5 (Atheros/multi-bss)
PCI: Enabling device 0000:01:00.0 (0000 -> 0002)
wifi0: Atheros 9287: mem=0x11b00f0000000, irq=44 hw_base=0x90011b00f0000000
wlan: mac acl policy registered
Create wlan0 interface
wlan0
<00:00:00>KDebug/0: Loading SofaWare Kernel Module
starting Safe@...
Start sofaware watch dog v2
run safeAtHome!!!!
<00:00:00>KDebug/0: fw_open called 300
<00:00:00>UInfo.: mac address of interface eth1 is 00:08:da:76:d3:64
<00:00:00>UInfo.: mac address of interface eth0 is 00:08:da:76:d3:62
<00:00:00>UInfo.: Unable to get the mac address of interface 
<00:00:00>UInfo.: mac address of interface wlan0 is 1c:4b:d6:dc:94:18
<00:00:00>UInfo.: mac address of interface lo:1 is 00:00:00:00:00:00
<00:00:00>UInfo.: Unable to get the mac address of interface 
<00:00:00>UInfo.: mac address of port eth1 is 00:08:da:76:d3:64
<00:00:00>UInfo.: mac address of port eth2 is 00:08:da:76:d3:63
<00:00:00>UInfo.: mac address of port wlan0 is 1c:4b:d6:dc:94:18
<00:00:00>UInfo.: mac address of port eth0 is <17:34:59>KInfo./0: 00:08:da:76:d3:62
<00:00:00>UInfo.: mac address of port eth0 is InitXAlloc: Allocating 25600K of core memory  - Suceeded
00:08:da:76:d3:62
<00:00:00>UInfo.: mac address of port eth0 is <17:34:59>KInfo./0: 00:08:da:76:d3:62
<00:00:00>UInfo.: mac address of port eth0 is FW1 Initialization Started
00:08:da:76:d3:62
<00:00:00>UDebug: Vendor mask: 8192 (0x0000200<17:34:59>KInfo./0: 0)
<00:00:00>UDebug: Sub model: 0x000000c0
<00:00:00>UInfo.: SW CheckRAM(before fw_drv_ini)
Initialization Started...
<00:00:00>UInfo.: PlatformInitEpilog: <17:34:59>KInfo./0: Set ip forward off
<00:00:00>UDebug: SW Platform Prolog CompleteCheckRAM(after fw_drv_ini)
d
<00:00:00>UInfo.: User Memory Pool Size Param = 4094K
<00:00:0<17:34:59>KInfo./0: 0>UInfo.: Kernel Memory Pool Size Param = 25600K
<00:00:00>UInfoFW1 Initialization Completed
.: Vendor Specific String Param = 'SBox-200-C'
<00:00:00>UInfo.:<17:34:59>KDebug/0:  Vendor Version String Param = '1.4'
<00:00:00>UInfo.: InitXAlloregistering SW classifier
c: Allocating 4094K of core memory  - Suceeded
<17:34:59>UDebug: Loading persistent data 'VersionString': (current version=8.1.47n, stored version=8.1.47n)
<17:34:59>UDebug: Configuration file "/var/swpreset.cfg" exist 

        Welcome to SofaWare SBOX4

(none) login: <17:34:59>UDebug: sw_ifc_unassign_port ifc=1 port=3 ports mask=0x78
<17:34:59>UDebug: sw_ifc_unassign_port ifc=1 port=4 ports mask=0x70
<17:34:59>UDebug: sw_ifc_unassign_port ifc=1 port=5 ports mask=0x60
<17:34:59>UDebug: sw_ifc_unassign_port ifc=1 port=6 ports mask=0x40
<17:34:59>UDebug: sw_ifconfig_raw eth0 0.0.0.0 down
<17:34:59>UDebug: system: ifconfig eth0 0.0.0.0
<17:34:59>UDebug: system: ifconfig eth0 down
<17:35:00>KInfo./0: CheckRAM(before fw_chain_ini)
<17:35:00>KInfo./0: CheckRAM(after fw_chain_ini)
<17:35:00>KDebug/0: FW-1: 3 interfaces installed
<17:34:59>UDebug: XInterfaces: destroy ifc=1
<17:34:59>UDebug: system: ifconfig eth0 -promisc
<17:34:59>UDebug: ifconfig eth0 -promisc
<17:34:59>UDebug: system: ifconfig eth0 up
<17:34:59>UDebug: sw_ifconfig_raw eth0 0.0.0.0 up
<17:34:59>UDebug: system: ifconfig eth0 up
<17:35:00>KInfo./0: CheckRAM(before fw_chain_ini)
<17:35:00>KInfo./0: CheckRAM(after fw_chain_ini)
<17:35:00>KDebug/0: FW-1: 2 interfaces installed
<17:34:59>UDebug: sw_ifc_assign_port ifc=1 tag=0 port=3 net_mode=3 first_assignment=1
<17:34:59>UDebug: sw_ifc_create ifc=1 tag=0 port=3 exist=0
<17:34:59>UDebug: sw_ifc_up ifc=1 tag=0 exists=1 if_dev=eth0
<17:34:59>UDebug: sw_ifconfig_raw eth0 192.168.10.1 up
<17:34:59>UDebug: system: ifconfig eth0 up
<17:35:00>KInfo./0: CheckRAM(before fw_chain_ini)
<17:35:00>KInfo./0: CheckRAM(after fw_chain_ini)
<17:35:00>KDebug/0: FW-1: 3 interfaces installed
<17:34:59>UDebug: sw_ifc_assign_port ifc=1 tag=0 port=4 net_mode=3 first_assignment=0
<17:34:59>UDebug: sw_ifc_assign_port ifc=1 tag=0 port=5 net_mode=3 first_assignment=0
<17:34:59>UDebug: sw_ifc_assign_port ifc=1 tag=0 port=6 net_mode=3 first_assignment=0
<17:35:01>KInfo./0: CheckRAM(before fw_chain_ini)
<17:35:01>KInfo./0: CheckRAM(after fw_chain_ini)
<17:35:01>KDebug/0: FW-1: 3 interfaces installed
<17:35:01>KDebug/0: FW-1: 3 interfaces installed
<17:34:59>UDebug: sw_ifconfig_raw eth2 0.0.0.0 up
<17:34:59>UDebug: system: ifconfig eth2 up
<17:35:01>KInfo./0: CheckRAM(before fw_chain_ini)
<17:35:01>KInfo./0: CheckRAM(after fw_chain_ini)
<17:35:01>KDebug/0: FW-1: 3 interfaces installed
<17:34:59>UDebug: sw_port_apply_dmz_config ifc=2 qua=-1
<17:34:59>UDebug: sw_ifc_assign_port ifc=2 tag=0 port=1 net_mode=3 first_assignment=1
<17:34:59>UDebug: sw_ifc_create ifc=2 tag=0 port=1 exist=0
<17:34:59>UDebug: sw_ifc_up ifc=2 tag=0 exists=1 if_dev=eth2
<17:34:59>UDebug: sw_ifconfig_raw eth2 192.168.253.1 up
<17:34:59>UDebug: system: ifconfig eth2 up
<17:35:01>KInfo./0: CheckRAM(before fw_chain_ini)
<17:35:01>KInfo./0: CheckRAM(after fw_chain_ini)
<17:35:01>KDebug/0: FW-1: 4 interfaces installed
<17:35:01>KInfo./0: CheckRAM(before fw_chain_ini)
<17:35:01>KInfo./0: CheckRAM(after fw_chain_ini)
<17:35:01>KDebug/0: FW-1: 4 interfaces installed
<17:34:59>UDebug: sw_ifc_apply_wan_assignment wan_ifc=0 wan_port=1 port=0 tag=0
<17:34:59>UDebug: sw_ifc_unassign_port ifc=0 port=0 ports mask=0x1
<17:34:59>UDebug: sw_ifconfig_raw eth1 0.0.0.0 down
<17:34:59>UDebug: system: ifconfig eth1 0.0.0.0
<17:34:59>UDebug: system: ifconfig eth1 down
<17:35:01>KInfo./0: CheckRAM(before fw_chain_ini)
<17:35:01>KInfo./0: CheckRAM(after fw_chain_ini)
<17:35:01>KDebug/0: FW-1: 4 interfaces installed
<17:34:59>UDebug: XInterfaces: destroy ifc=0
<17:35:01>KDebug/0: <17:34:59>UDebug: sw_ifc_apply_wan_assignment wan_ifc=5 wan_portksw_var_set_ppp_config: ClientIP: 0.0.0.0 ServerIP: 0.0.0.0
=0 port=-1 tag=0
<17:35:01>KDebug/0: ksw_var_set_ppp_config: ClientIP: 0.0.0.0 ServerIP: 0.0.0.0
pcf8563 0-0051: low voltage detected, date/time is not reliable.

        Welcome to SofaWare SBOX4
(none) login: 
Spawn-2002 commented 2 years ago

Bootlog boot "kernel" openwrt from tftp server.

U-Boot 1.1.1  SDK 1.9 (Development build) (Build time: Jul  8 2010 - 17:06:13)

row bits: 13, col bits: 10, banks: 4, ranks: 1, dram width: 16, size: 128 MB
CN3010_EVB_HS5 board revision major:2, minor:0, serial #: 
OCTEON CN5010-SCP pass 1.1, Core clock: 500 MHz, DDR clock: 200 MHz (400 Mhz data rate)
Warning: Board descriptor tuple not found in eeprom, using defaults
!!! Configuring processor for 3 RGMII mode !!!
DRAM:  128 MB
Clearing DRAM...... done
Flash:  2 MB
BIST check passed.
Starting PCI
PCI Status: PCI 32-bit
PCI BAR 0: 0x00000000, PCI BAR 1: Memory 0x00000000  PCI 0xf8000000
Net:   octeth0, octeth1, octeth2
 Bus 0 (CF Card): not available  

CF LED does not exist
CF LED does not exist
SofaWare debug level: 1

                          Yyy                 yyY    
                           YYYYYYYyyyyyyyYYYYYYY     
                            YYYYY#########YYYYY      
                             YYY#    ???  #YYY       
                              YY#   ( O)  #YY        
                               Y#    ~~   #Y         
                               YY#########YY         
                          @@@  YYYYYYYYYYYYY  @@@    
                          @@@@ YYYYYYYYYYYYY @@@@    
                          @@@@ YYYYYYYYYYYYY @@@@    
                           @@@@@@@@@@@@@@@@@@@@@     
                            @@@@@@@@@@@@@@@@@@@      
                            VVV@@@@@@@@@@@@@VVV      
                            VV               VV      
                            V                 V      
                              SofaWare Embedded!     
                                    Sbox4  

        Boot Code Version: 13 (Build time: Jul  8 2010 - 17:05:35)

<<***** BLOB Details *****>>
LAN MAC                : EDIT 
DMZ MAC                : EDIT 
WAN MAC                : EDIT 
License Key            : EDIT
Activation Key         : EDIT 
Serial Num             : N/A 
Part Num               : 307873 
Vendor Mask            : 0x00002000 
Number of SFP Ports    : 0 
Number of USB Ports    : 2 
Number of Switch Ports : 4 
WLAN Region            : FCCA 
DSL Modem              : No 

 0 
Sbox4_gb# tftpboot 0x5700000 kernel

Interface 0 has 3 ports (RGMII)
Enabling packet I/O on interface 0
Using octeth1 device
TFTP from server 192.168.10.10; our IP address is 192.168.10.1
Filename 'kernel'.
Load address: 0x5700000
Loading: *octeth1: Up 1000 Mbps Full duplex (port  1)
|/-\|/-\|/-\|/-\|/-\|/-\|/Bytes transferred = 5152648 (4e9f88 hex), 491 Kbytes/sec
Sbox4_gb# bootoctlinux

ELF file is 64 bit
Attempting to allocate memory for ELF segment: addr: 0xffffffff81100000 (adjusted to: 0x0000000001100000), size 0x153d578
Allocated memory for ELF segment: addr: 0xffffffff81100000, size 0x153d578
Processing PHDR 0
  Loading 4e8a00 bytes at ffffffff81100000
  Clearing 1054b78 bytes at ffffffff815e8a00
## Loading Linux kernel with entry point: 0xffffffff81107610 ...
** SofaWare boot information (core 0) ** 
* license (blob):           "EDIT"
* activation key (blob):    "EDIT"
* vendor mask (blob):       0x2000
* pn (blob):                "307873"
* sn (blob):                ""
* SFP ports (blob):         0x0
* USB ports (blob):         0x2
* Switch ports (blob):      0x4
* WLAN Region (blob):         "FCCA"
* DSL Modem (blob):                "No"
* extra params 1 (blob):    ""
* extra params 2 (blob):    ""
* extra params 3 (blob):    ""
* extra params 4 (blob):    ""
* extra params 5 (blob):    ""
* extra params 6 (blob):    ""
* extra params 7 (blob):    ""
* extra params 8 (blob):    ""
* default ip:               192.168.10.1
* sub model:                0x0
* image version:            ""
* firmware file name:       ""
* kernel image size:        0
* firmware image offset:           0
* romdisk offset:           168
* image crc:                0x0
* loader ver:               13
* test mode:                0
* debug:                    1
* safe@ user source:        1
* safe@ kernel source:      1
* default lan ip:           ""
* default wan ip:           ""
* debug host ip:            ""
* debug host port:          "0"
**************************************** 
Bootloader: Done loading app on coremask: 0x1
[    0.000000] Linux version 3.18.23 (buildbot@builder1) (gcc version 4.6.4 (OpenWrt/Linaro GCC 4.6-2013.05 r47269) ) #1 SMP Sun Jan 31 13:21:12 CET 2016
[    0.000000] CVMSEG size: 2 cache lines (256 bytes)
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 000d0601 (Cavium Octeon+)
[    0.000000] Checking for the multiply/shift bug... no.
[    0.000000] Checking for the daddiu bug... no.
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 0000000005800000 @ 0000000002700000 (usable)
[    0.000000]  memory: 000000000153d578 @ 0000000001100000 (usable)
[    0.000000] Wasting 243712 bytes for tracking 4352 unused pages
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] cvmx_helper_board_get_mii_address: Unknown board type 30
[    0.000000] cvmx_helper_board_get_mii_address: Unknown board type 30
[    0.000000] cvmx_helper_board_get_mii_address: Unknown board type 30
[    0.000000] Using internal Device Tree.
[    0.000000] software IO TLB [mem 0x0270b000-0x0274b000] (0MB) mapped at [800000000270b000-800000000274afff]
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x01100000-0xefffffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x01100000-0x0263cfff]
[    0.000000]   node   0: [mem 0x02700000-0x07efffff]
[    0.000000] Initmem setup node 0 [mem 0x01100000-0x07efffff]
[    0.000000] Primary instruction cache 32kB, virtually tagged, 4 way, 64 sets, linesize 128 bytes.
[    0.000000] Primary data cache 16kB, 64-way, 2 sets, linesize 128 bytes.
[    0.000000] PERCPU: Embedded 12 pages/cpu @8000000002759000 s10752 r8192 d30208 u49152
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 27580
[    0.000000] Kernel command line: mtdparts=phys_mapped_flash:640k(boot0)ro,640k(boot1)ro,64k(eeprom)ro block2mtd.block2mtd=/dev/mmcblk0p2,65536,rootfs,5 root=/dev/mtdblock3 rootfstype=squashfs rootwait console=ttyS1,115200
[    0.000000] PID hash table entries: 512 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
[    0.000000] Memory: 85920K/111860K available (3625K kernel code, 271K rwdata, 888K rodata, 244K init, 16693K bss, 25940K reserved)
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  CONFIG_RCU_FANOUT set to non-default value of 32
[    0.000000]  RCU restricting CPUs from NR_CPUS=16 to nr_cpu_ids=1.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS:127
[    0.444576] Calibrating delay loop (skipped) preset value.. 1000.00 BogoMIPS (lpj=2000000)
[    0.452670] pid_max: default: 32768 minimum: 301
[    0.457495] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
[    0.463886] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
[    0.471677] Checking for the daddi bug... no.
[    0.478017] Brought up 1 CPUs
[    0.487081] NET: Registered protocol family 16
[    0.492756] Enabling Octeon big bar support
[    0.502867] PCI Status: PCI 32-bit
[    0.507110] PCI Clock: 33 MHz
[    0.518886] SCSI subsystem initialized
[    0.523115] usbcore: registered new interface driver usbfs
[    0.528616] usbcore: registered new interface driver hub
[    0.533911] usbcore: registered new device driver usb
[    0.539369] PCI host bridge to bus 0000:00
[    0.543380] pci_bus 0000:00: root bus resource [mem 0x11b00f0000000-0x11b0130000000] (bus address [0xf0000000-0x130000000])
[    0.554425] pci_bus 0000:00: root bus resource [io  0x4000-0xffffffff]
[    0.560926] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.569351] pci 0000:00:02.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.578145] pci 0000:00:02.0: BAR 8: assigned [mem 0x11b00f0000000-0x11b00f00fffff]
[    0.585706] pci 0000:01:00.0: BAR 0: assigned [mem 0x11b00f0000000-0x11b00f000ffff 64bit]
[    0.593819] pci 0000:00:02.0: PCI bridge to [bus 01]
[    0.598749] pci 0000:00:02.0:   bridge window [mem 0x11b00f0000000-0x11b00f00fffff]
[    0.609216] Switched to clocksource OCTEON_CVMCOUNT
[    0.615730] NET: Registered protocol family 2
[    0.621071] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[    0.627980] TCP bind hash table entries: 1024 (order: 3, 32768 bytes)
[    0.634345] TCP: Hash tables configured (established 1024 bind 1024)
[    0.640715] TCP: reno registered
[    0.643895] UDP hash table entries: 256 (order: 2, 24576 bytes)
[    0.649775] UDP-Lite hash table entries: 256 (order: 2, 24576 bytes)
[    0.656474] NET: Registered protocol family 1
[    0.666749] futex hash table entries: 256 (order: 3, 32768 bytes)
[    0.676085] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.681901] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.692503] msgmni has been set to 167
[    0.697921] io scheduler noop registered
[    0.701782] io scheduler deadline registered (default)
[    0.707185] octeon_gpio 1070000000800.gpio-controller: OCTEON GPIO driver probed.
[    0.715001] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.724816] 1180000000800.serial: ttyS0 at MMIO 0x1180000000800 (irq = 41, base_baud = 31250000) is a OCTEON
[    0.734984] console [ttyS1] disabled
[    0.738505] 1180000000c00.serial: ttyS1 at MMIO 0x1180000000c00 (irq = 42, base_baud = 31250000) is a OCTEON
[    0.748252] console [ttyS1] enabled
[    0.748252] console [ttyS1] enabled
[    0.755159] bootconsole [early0] disabled
[    0.755159] bootconsole [early0] disabled
[    0.763869] octeon_rng octeon_rng: Octeon Random Number Generator
[    0.771418] of-flash 1f400000.nor: Can't get bank width from device tree
[    0.778646] libphy: mdio-octeon: probed
[    0.782563] mdio-octeon 1180000001800.mdio: Version 1.0
[    0.788180] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.794917] ehci-pci: EHCI PCI platform driver
[    0.799575] ehci-platform: EHCI generic platform driver
[    0.805076] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.811569] ohci-platform: OHCI generic platform driver
[    0.817188] usbcore: registered new interface driver usb-storage
[    0.823275] octeon_wdt: Initial granularity 5 Sec
[    0.828663] cavium-ethernet 1.9
[    0.835111] Interface 0 has 3 ports (RGMII)
[    0.839554] cvmx_helper_board_get_mii_address: Unknown board type 30
[    0.845964] cvmx_helper_board_get_mii_address: Unknown board type 30
[    0.852343] cvmx_helper_board_get_mii_address: Unknown board type 30
[    0.872851] OcteonUSB 16f0010000000.usbc: Octeon Host Controller
[    0.878937] OcteonUSB 16f0010000000.usbc: new USB bus registered, assigned bus number 1
[    0.887024] OcteonUSB 16f0010000000.usbc: irq 124, io mem 0x00000000
[    0.902634] hub 1-0:1.0: USB hub found
[    0.906842] hub 1-0:1.0: 1 port detected
[    0.912143] OcteonUSB 16f0010000000.usbc: Registered HCD for port 0 on irq 124
[    0.919876] TCP: cubic registered
[    0.923219] NET: Registered protocol family 17
[    0.927854] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    0.940557] Bridge firewalling registered
[    0.944606] 8021q: 802.1Q VLAN Support v1.8
[    0.949051] Bootbus flash: Setting flash for 2MB flash at 0x1fa00000
[    0.955516] phys_mapped_flash: Found 1 x16 devices at 0x0 in 8-bit bank. Manufacturer ID 0x0000c2 Chip ID 0x000049
[    0.965892] Amd/Fujitsu Extended Query Table at 0x0040
[    0.971057]   Amd/Fujitsu Extended Query version 1.0.
[    0.976132] number of CFI chips: 1
[    0.979576] 3 cmdlinepart partitions found on MTD device phys_mapped_flash
[    0.986471] Creating 3 MTD partitions on "phys_mapped_flash":
[    0.992242] 0x000000000000-0x0000000a0000 : "boot0"
[    0.998185] 0x0000000a0000-0x000000140000 : "boot1"
[    1.004169] 0x000000140000-0x000000150000 : "eeprom"
[    6.031491] block2mtd: error: cannot open device /dev/mmcblk0p2
[    6.037976] Waiting for root device /dev/mtdblock3...
[   33.251496] random: nonblocking pool is initialized
Spawn-2002 commented 2 years ago

I think for correct nand markup you need to use such variables mtdids, mtdparts. but I do not understand how to register them correctly. I tried to write it like this

setenv mtdids nand0 = test.nand
setenv mtdparts mtdparts = test.nand: 640k (boot0) ro, 640k (boot1) ro, 64k (eeprom) ro, root = / dev / mmcblk0p2 rootfstype = squashfs, ext4 rootwait

When you try to see which sections have been created. Threw an error test.nand: partitioning exceeds flash size

Although you probably can not do this, but just put the correct firmware in nand and give the correct arguments for launching.

thosoo commented 2 years ago

You have no nand access in OpenWRT yet, this is why it is not working. You write nand from uboot. You have to find out how the nand is accessed in the original firmware.

I can recommend to use Ghidra to open the firmware and look for Virtual NAND driver v1.2 25/10/09

Spawn-2002 commented 2 years ago

I can recommend to use Ghidra to open the firmware and look for Virtual NAND driver v1.2 25/10/09

Find Virtual NAND driver v1.2 25/10/09 in original firmware or openwrt?

thosoo commented 2 years ago

I can recommend to use Ghidra to open the firmware and look for Virtual NAND driver v1.2 25/10/09

Find Virtual NAND driver v1.2 25/10/09 in original firmware or openwrt?

In original firmware

Spawn-2002 commented 2 years ago

Hi. I used commands "make kernel_menuconfig" and added support nand flash in to kernel. After that, I compiled a new kernel. Now the bootlog looks like this.

****************************************
Bootloader: Done loading app on coremask: 0x1
[    0.000000] Linux version 4.14.162 (user@ubuntu) (gcc version 7.5.0 (OpenWrt GCC 7.5.0 r1            0860-a3ffeb413b)) #0 SMP Mon Jan 6 16:47:09 2020
[    0.000000] CVMSEG size: 2 cache lines (256 bytes)
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 000d0601 (Cavium Octeon+)
[    0.000000] Checking for the multiply/shift bug... no.
[    0.000000] Checking for the daddiu bug... no.
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 0000000005400000 @ 0000000002a00000 (usable)
[    0.000000]  memory: 0000000001857060 @ 0000000001100000 (usable)
[    0.000000] Wasting 243712 bytes for tracking 4352 unused pages
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] cvmx_helper_board_get_mii_address: Unknown board type 30
[    0.000000] cvmx_helper_board_get_mii_address: Unknown board type 30
[    0.000000] cvmx_helper_board_get_mii_address: Unknown board type 30
[    0.000000] Using internal Device Tree.
[    0.000000] software IO TLB: mapped [mem 0x02a0b000-0x02a4b000] (0MB)
[    0.000000] Primary instruction cache 32kB, virtually tagged, 4 way, 64 sets, linesize 12            8 bytes.
[    0.000000] Primary data cache 16kB, 64-way, 2 sets, linesize 128 bytes.
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000000000000-0x00000000efffffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000002956fff]
[    0.000000]   node   0: [mem 0x0000000002a00000-0x0000000007dfffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007dfffff]
[    0.000000] random: get_random_bytes called from start_kernel+0x94/0x4fc with crng_init=0
[    0.000000] percpu: Embedded 18 pages/cpu s35504 r8192 d30032 u73728
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 31646
[    0.000000] Kernel command line: mtdparts=nand_flash:128k(u-boot)ro,640k(u-boot envs),3m(            kernel),30m(root.jffs2),30m(root.yaffs)  console=ttyS1,115200
[    0.000000] PID hash table entries: 512 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
[    0.000000] Memory: 81784K/128348K available (5289K kernel code, 325K rwdata, 1304K rodat            a, 1324K init, 16668K bss, 46564K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=128, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  CONFIG_RCU_FANOUT set to non-default value of 32
[    0.000000]  RCU restricting CPUs from NR_CPUS=16 to nr_cpu_ids=1.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS: 127
[    0.350670] clocksource: OCTEON_CVMCOUNT: mask: 0xffffffffffffffff max_cycles: 0xe6a171a0            37, max_idle_ns: 881590485102 ns
[    0.361546] Calibrating delay loop (skipped) preset value.. 1000.00 BogoMIPS (lpj=2000000            )
[    0.369753] pid_max: default: 32768 minimum: 301
[    0.374474] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
[    0.380870] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
[    0.388600] Checking for the daddi bug... no.
[    0.394115] Hierarchical SRCU implementation.
[    0.399216] smp: Bringing up secondary CPUs ...
[    0.403661] smp: Brought up 1 node, 1 CPU
[    0.411527] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7            645041785100000 ns
[    0.421200] futex hash table entries: 256 (order: 3, 32768 bytes)
[    0.427864] NET: Registered protocol family 16
[    0.441735] Enabling Octeon big bar support
[    0.451838] PCI Status: PCI 32-bit
[    0.456091] PCI Clock: 33 MHz
[    0.504523] SCSI subsystem initialized
[    0.508615] usbcore: registered new interface driver usbfs
[    0.514123] usbcore: registered new interface driver hub
[    0.519432] usbcore: registered new device driver usb
[    0.524765] PCI host bridge to bus 0000:00
[    0.528789] pci_bus 0000:00: root bus resource [mem 0x11b00f0000000-0x11b0130000000] (bus             address [0xf0000000-0x130000000])
[    0.539828] pci_bus 0000:00: root bus resource [io  0x4000-0xffffffff]
[    0.546329] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.553095] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.561146] pci 0000:00:02.0: enabling Extended Tags
[    0.565988] pci 0000:00:02.0: Enable PCIe Retrain Link quirk
[    0.572019] pci 0000:00:02.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.580738] pci 0000:00:02.0: BAR 8: assigned [mem 0x11b00f0000000-0x11b00f00fffff]
[    0.588319] pci 0000:01:00.0: BAR 0: assigned [mem 0x11b00f0000000-0x11b00f000ffff 64bit]
[    0.596422] pci 0000:00:02.0: PCI bridge to [bus 01]
[    0.601352] pci 0000:00:02.0:   bridge window [mem 0x11b00f0000000-0x11b00f00fffff]
[    0.615704] clocksource: Switched to clocksource OCTEON_CVMCOUNT
[    0.622962] NET: Registered protocol family 2
[    0.628158] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[    0.635072] TCP bind hash table entries: 1024 (order: 3, 32768 bytes)
[    0.641439] TCP: Hash tables configured (established 1024 bind 1024)
[    0.647907] UDP hash table entries: 256 (order: 2, 24576 bytes)
[    0.653789] UDP-Lite hash table entries: 256 (order: 2, 24576 bytes)
[    0.660358] NET: Registered protocol family 1
[    0.669546] Crashlog allocated RAM at address 0x3f00000
[    0.677465] workingset: timestamp_bits=62 max_order=15 bucket_order=0
[    0.702008] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.708157] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-            2006 Red Hat, Inc.
[    0.726299] io scheduler noop registered
[    0.730196] io scheduler deadline registered (default)
[    0.736086] octeon_gpio 1070000000800.gpio-controller: OCTEON GPIO driver probed.
[    0.744168] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.751391] 1180000000800.serial: ttyS0 at MMIO 0x1180000000800 (irq = 41, base_baud = 31            250000) is a OCTEON
[    0.761829] 1180000000c00.serial: ttyS1 at MMIO 0x1180000000c00 (irq = 42, base_baud = 31            250000) is a OCTEON
[    0.771642] console [ttyS1] enabled
[    0.771642] console [ttyS1] enabled
[    0.778478] bootconsole [early0] disabled
[    0.778478] bootconsole [early0] disabled
[    0.787006] octeon_rng octeon_rng: Octeon Random Number Generator
[    0.804346] loop: module loaded
[    0.808423] of-flash 1f400000.nor: Can't get bank width from device tree
[    0.815764] No valid DiskOnChip devices found
[    0.820402] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_RE            ADY return 0x0
[    0.829876] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_RE            ADY return 0x0
[    0.839297] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_RE            ADY return 0x0
[    0.848715] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_RE            ADY return 0x0
[    0.858131] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_RE            ADY return 0x0
[    0.867548] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_RE            ADY return 0x0
[    0.876973] nand: device found, Manufacturer ID: 0x98, Chip ID: 0x39
[    0.883354] nand: Toshiba NAND 128MiB 1,8V 8-bit
[    0.888002] nand: 128 MiB, SLC, erase size: 16 KiB, page size: 512, OOB size: 16
[    0.895484] flash size: 128 MiB
[    0.898701] page size: 512 bytes
[    0.901957] OOB area size: 16 bytes
[    0.905472] sector size: 16 KiB
[    0.908640] pages number: 262144
[    0.911894] pages per sector: 32
[    0.915125] bus width: 8
[    0.917684] bits in sector size: 14
[    0.921199] bits in page size: 9
[    0.924454] bits in OOB size: 4
[    0.927622] flash size with OOB: 135168 KiB
[    0.931830] page address bytes: 4
[    0.935149] sector address bytes: 3
[    0.938663] options: 0x42
[    0.952294] Scanning device for bad blocks
[    1.048482] mtd: no closing ) found in partition name
[    1.053602] Creating 1 MTD partitions on "NAND 128MiB 1,8V 8-bit":
[    1.059826] 0x000000000000-0x000008000000 : "NAND simulator partition 0"
[    1.080242] [nandsim] warning: CONFIG_MTD_PARTITIONED_MASTER must be enabled to expose de            bugfs stuff
[    1.090593] libphy: mdio_octeon: probed
[    1.094537] mdio_octeon 1180000001800.mdio: Probed
[    1.099873] libphy: Fixed MDIO Bus: probed
[    1.104267] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.110867] ehci-platform: EHCI generic platform driver
[    1.116353] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.122640] ohci-platform: OHCI generic platform driver
[    1.128234] usbcore: registered new interface driver usb-storage
[    1.134383] octeon_wdt: Initial granularity 5 Sec
[    1.148477] Interface 0 has 3 ports (RGMII)
[    1.156940] octeon-hcd 16f0010000000.usbc: Octeon Host Controller
[    1.163175] octeon-hcd 16f0010000000.usbc: new USB bus registered, assigned bus number 1
[    1.171391] octeon-hcd 16f0010000000.usbc: irq 56, io mem 0x00000000
[    1.182548] hub 1-0:1.0: USB hub found
[    1.187008] hub 1-0:1.0: 1 port detected
[    1.191876] octeon-hcd 16f0010000000.usbc: Registered HCD for port 0 on irq 56
[    1.200366] NET: Registered protocol family 10
[    1.209252] Segment Routing with IPv6
[    1.213212] NET: Registered protocol family 17
[    1.217813] 8021q: 802.1Q VLAN Support v1.8
[    1.222435] Bootbus flash: Setting flash for 2MB flash at 0x1fa00000
[    1.228996] phys_mapped_flash: Found 1 x16 devices at 0x0 in 8-bit bank. Manufacturer ID             0x0000c2 Chip ID 0x000049
[    1.239380] Amd/Fujitsu Extended Query Table at 0x0040
[    1.244573]   Amd/Fujitsu Extended Query version 1.0.
[    1.249656] number of CFI chips: 1
[    1.257682] OF: fdt: not creating '/sys/firmware/fdt': CRC check failed
[    1.265675] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    1.273312] Please append a correct "root=" boot option; here are the available partition            s:
[    1.281724] 1f00          131072 mtdblock0
[    1.281730]  (driver?)
[    1.288337] 1f01            2048 mtdblock1
[    1.288342]  (driver?)
[    1.294922] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0            )
[    1.304457] Rebooting in 1 seconds..

The lines appeared in the bootlog

[    0.876973] nand: device found, Manufacturer ID: 0x98, Chip ID: 0x39
[    0.883354] nand: Toshiba NAND 128MiB 1,8V 8-bit
[    0.888002] nand: 128 MiB, SLC, erase size: 16 KiB, page size: 512, OOB size: 16
[    0.895484] flash size: 128 MiB
*******
[    1.053602] Creating 1 MTD partitions on "NAND 128MiB 1,8V 8-bit":
[    1.059826] 0x000000000000-0x000008000000 : "NAND simulator partition 0"
thosoo commented 2 years ago

Yes, but where is it getting the ID from? It is also not the same like in original firmware

thosoo commented 2 years ago

vnand_scan

undefined8
vnand_scan(undefined *param_1,longlong param_2,undefined8 param_3,undefined8 param_4,
          undefined8 param_5,undefined8 param_6,undefined8 param_7,undefined8 param_8)

{
  longlong lVar1;
  longlong lVar2;
  longlong *plVar3;
  int *piVar4;
  longlong lVar5;
  longlong *plVar6;
  longlong lVar7;
  undefined8 uVar8;
  longlong lVar9;
  undefined8 extraout_a2;
  longlong lVar10;
  char *pcVar11;
  undefined8 extraout_a2_00;
  undefined8 extraout_a3;
  undefined8 extraout_a3_00;
  longlong *extraout_a3_01;
  longlong *extraout_a3_02;
  undefined8 extraout_a3_03;
  undefined8 extraout_a3_04;
  longlong *extraout_a3_05;
  undefined8 extraout_a3_06;
  undefined8 extraout_a3_07;
  longlong *extraout_a3_08;
  undefined8 extraout_t0;
  undefined8 extraout_t0_00;
  longlong extraout_t0_01;
  longlong extraout_t0_02;
  longlong extraout_t0_03;
  undefined8 extraout_t0_04;
  undefined8 extraout_t0_05;
  undefined8 uVar12;
  undefined8 extraout_t0_06;
  undefined8 extraout_t0_07;
  longlong extraout_t0_08;
  undefined8 extraout_t1;
  undefined8 extraout_t1_00;
  undefined8 extraout_t1_01;
  undefined8 extraout_t1_02;
  undefined8 extraout_t1_03;
  undefined8 extraout_t1_04;
  undefined8 extraout_t1_05;
  undefined8 uVar13;
  undefined8 extraout_t1_06;
  undefined8 extraout_t1_07;
  undefined8 extraout_t1_08;
  undefined8 extraout_t1_09;
  undefined8 extraout_t2;
  undefined8 extraout_t2_00;
  undefined8 extraout_t2_01;
  undefined8 extraout_t2_02;
  undefined8 extraout_t2_03;
  undefined8 extraout_t2_04;
  undefined8 extraout_t2_05;
  undefined8 uVar14;
  undefined8 extraout_t2_06;
  undefined8 extraout_t2_07;
  undefined8 extraout_t2_08;
  undefined8 extraout_t2_09;
  undefined8 extraout_t3;
  undefined8 extraout_t3_00;
  undefined8 extraout_t3_01;
  undefined8 extraout_t3_02;
  undefined8 extraout_t3_03;
  undefined8 extraout_t3_04;
  undefined8 extraout_t3_05;
  undefined8 uVar15;
  undefined8 extraout_t3_06;
  undefined8 extraout_t3_07;
  undefined8 extraout_t3_08;
  undefined8 extraout_t3_09;
  longlong lVar16;
  byte local_70 [16];
  longlong local_60;
  longlong local_58;

  printk("VNAND: %s(): initialize Virtual NAND driver %s\n","vnand_scan","v1.2 25/10/09",param_4,
         param_5,param_6,param_7,param_8);
  if ((translate_block_table == (longlong *)0x0) || (temp_block_buff == (undefined *)0x0)) {
    lVar2 = nand_scan(param_1,param_2);
    uVar8 = 0xffffffffffffffff;
    if (-1 < lVar2) {
      g_block_size = *(uint *)(param_1 + 0xc);
      g_total_nand_size = *(uint *)(param_1 + 8);
      g_phy_blocks_num = g_total_nand_size / g_block_size;
      if (g_block_size == 0) {
        trap(7);
      }
      g_virtual_nand_size = g_total_nand_size + g_block_size * -0x14;
      g_virt_blocks_num = g_phy_blocks_num - 0x14;
      g_pages_per_block = g_block_size / *(uint *)(param_1 + 0x10);
      if (*(uint *)(param_1 + 0x10) == 0) {
        trap(7);
      }
      *(code **)(param_1 + 0x48) = vnand_erase_cb;
      *(code **)(param_1 + 0x60) = vnand_read_cb;
      *(code **)(param_1 + 0x68) = vnand_write_cb;
      *(code **)(param_1 + 0x78) = vnand_read_oob_cb;
      *(code **)(param_1 + 0x80) = vnand_write_oob_cb;
      *(code **)(param_1 + 0xe8) = vnand_block_isbad;
      *(code **)(param_1 + 0xf0) = vnand_block_markbad_cb;
      temp_block_buff = __kmalloc((ulonglong)*(uint *)(param_1 + 0xc),0xd0);
      if (temp_block_buff == (undefined *)0x0) {
        printk("VNAND ERROR: %s(): failed to kmalloc() temp_block_buff(%d bytes)\n","vnand_scan",
               (longlong)*(int *)(param_1 + 0xc),extraout_a3_00,extraout_t0_00,extraout_t1_00,
               extraout_t2_00,extraout_t3_00);
        uVar8 = 1;
      }
      else {
        g_bad_block_count = 0;
        plVar3 = (longlong *)__kmalloc((longlong)(int)g_phy_blocks_num << 3,0xd0);
        translate_block_table = plVar3;
        if (plVar3 == (longlong *)0x0) {
          printk("VNAND ERROR: %s(): failed to kmalloc() translate block table(%ld bytes).\n",
                 "build_translate_table",(longlong)(int)g_phy_blocks_num << 3,0,extraout_t0_01,
                 extraout_t1_01,extraout_t2_01,extraout_t3_01);
          uVar8 = extraout_a3_07;
          uVar12 = extraout_t0_07;
          uVar13 = extraout_t1_08;
          uVar14 = extraout_t2_08;
          uVar15 = extraout_t3_08;
LAB_ffffffff803ddcbc:
          printk("VNAND ERROR: %s(): failed to build translate block table\n","vnand_scan",
                 0xffffffff80580000,uVar8,uVar12,uVar13,uVar14,uVar15);
          kfree((ulonglong)temp_block_buff);
          uVar8 = 1;
        }
        else {
          lVar2 = (longlong)g_virt_blocks_num;
          if (0 < lVar2) {
            lVar10 = 0;
            plVar6 = plVar3;
            do {
              *plVar6 = lVar10;
              lVar10 = lVar10 + 1;
              plVar6 = plVar6 + 1;
            } while (lVar10 < lVar2);
          }
          lVar10 = (longlong)(int)g_phy_blocks_num;
          if (lVar2 < lVar10) {
            lVar9 = 0;
            plVar6 = plVar3 + lVar2;
            plVar3 = (longlong *)0xfffffffffffffffe;
            do {
              lVar9 = lVar9 + 1;
              *plVar6 = -2;
              plVar6 = plVar6 + 1;
            } while (lVar2 + lVar9 < lVar10);
          }
          if (lVar10 < 1) {
            local_60 = -0x7fa80000;
            lVar2 = extraout_t0_01;
            uVar8 = extraout_t1_01;
            uVar12 = extraout_t2_01;
            uVar13 = extraout_t3_01;
          }
          else {
            local_60 = -0x7fa80000;
            lVar10 = 0;
            do {
              while( true ) {
                lVar2 = get_block_status((longlong)param_1,lVar10,local_70);
                if (lVar2 != 0) {
                  printk("VNAND ERROR: %s(): failed to get block %ld status\n",local_60 + -0x3810,
                         lVar10,extraout_a3_01,extraout_t0_02,extraout_t1_02,extraout_t2_02,
                         extraout_t3_02);
                  kfree((ulonglong)translate_block_table);
                  uVar8 = extraout_a3_06;
                  uVar12 = extraout_t0_06;
                  uVar13 = extraout_t1_07;
                  uVar14 = extraout_t2_07;
                  uVar15 = extraout_t3_07;
                  goto LAB_ffffffff803ddcb8;
                }
                if ((local_70[0] != 0) && (local_70[0] != 0xf0)) break;
                lVar9 = lVar10 + 1;
                translate_block_table[lVar10] = -1;
                printk("VNAND: %s(): NAND bad block at %ld (oob bad block type = 0x%x)\n",
                       "build_translate_table",lVar10,(ulonglong)local_70[0],extraout_t0_02,
                       extraout_t1_02,extraout_t2_02,extraout_t3_02);
                g_bad_block_count = g_bad_block_count + 1;
                plVar3 = extraout_a3_02;
                lVar2 = extraout_t0_03;
                uVar8 = extraout_t1_03;
                uVar12 = extraout_t2_03;
                uVar13 = extraout_t3_03;
                lVar10 = lVar9;
                if ((int)g_phy_blocks_num <= lVar9) goto LAB_ffffffff803ddb4c;
              }
              lVar10 = lVar10 + 1;
              plVar3 = extraout_a3_01;
              lVar2 = extraout_t0_02;
              uVar8 = extraout_t1_02;
              uVar12 = extraout_t2_02;
              uVar13 = extraout_t3_02;
            } while (lVar10 < (int)g_phy_blocks_num);
          }
LAB_ffffffff803ddb4c:
          if ((ulonglong)(longlong)g_bad_block_count < 0x15) {
            lVar10 = (longlong)g_virt_blocks_num;
            lVar9 = 0;
            if (0 < lVar10) {
              lVar2 = -1;
              do {
                if (translate_block_table[lVar9] == lVar2) {
                  lVar16 = lVar10 * 8;
                  if (lVar10 < (int)g_phy_blocks_num) {
                    lVar7 = lVar10 + 1;
                    if (translate_block_table[lVar10] != -2) {
                      plVar6 = translate_block_table + lVar7;
                      lVar1 = lVar7 * 8;
                      do {
                        lVar16 = lVar1;
                        lVar10 = lVar7;
                        if ((int)g_phy_blocks_num <= lVar10) goto LAB_ffffffff803ddc94;
                        lVar5 = *plVar6;
                        plVar6 = plVar6 + 1;
                        lVar7 = lVar10 + 1;
                        lVar1 = lVar16 + 8;
                      } while (lVar5 != -2);
                    }
                    local_58 = lVar2;
                    printk("VNAND: %s(): bad block %ld remap to block %ld\n",local_60 + -0x3810,
                           lVar9,lVar10,lVar2,uVar8,uVar12,uVar13);
                    plVar3 = (longlong *)((longlong)translate_block_table + lVar16);
                    translate_block_table[lVar9] = lVar10;
                    *plVar3 = lVar9;
                    plVar3 = extraout_a3_05;
                    lVar2 = local_58;
                    uVar8 = extraout_t1_06;
                    uVar12 = extraout_t2_06;
                    uVar13 = extraout_t3_06;
                    goto LAB_ffffffff803ddb88;
                  }
LAB_ffffffff803ddc94:
                  printk("VNAND ERROR: %s(): (BUG)failed to find alternative block to block %ld\n",
                         local_60 + -0x3810,lVar9,plVar3,lVar2,uVar8,uVar12,uVar13);
                  kfree((ulonglong)translate_block_table);
                  uVar8 = extraout_a3_04;
                  uVar12 = extraout_t0_05;
                  uVar13 = extraout_t1_05;
                  uVar14 = extraout_t2_05;
                  uVar15 = extraout_t3_05;
LAB_ffffffff803ddcb8:
                  translate_block_table = (longlong *)0x0;
                  goto LAB_ffffffff803ddcbc;
                }
LAB_ffffffff803ddb88:
                lVar9 = lVar9 + 1;
                lVar10 = (longlong)g_virt_blocks_num;
              } while (lVar9 < lVar10);
            }
          }
          else {
            printk("VNAND ERROR: %s(): found too many NAND bad blocks (%d) !!!\n",local_60 + -0x3810
                   ,(longlong)g_bad_block_count,plVar3,lVar2,uVar8,uVar12,uVar13);
            plVar3 = extraout_a3_08;
            lVar2 = extraout_t0_08;
            uVar8 = extraout_t1_09;
            uVar12 = extraout_t2_09;
            uVar13 = extraout_t3_09;
          }
          if (g_bad_block_count == 0) {
            pcVar11 = "did not";
          }
          else {
            pcVar11 = "did";
          }
          printk("VNAND: %s(): NAND check %s find bad blocks\n",local_60 + -0x3810,pcVar11,plVar3,
                 lVar2,uVar8,uVar12,uVar13);
          vnand_mtd = param_1;
          piVar4 = create_proc_entry("nand_bad_block",0x1a4,0);
          vnand_proc_entry = piVar4;
          if (piVar4 == (int *)0x0) {
            printk("VNAND ERROR: %s(): failed to create /proc/nand_bad_block \n","vnand_scan",
                   extraout_a2_00,extraout_a3_03,extraout_t0_04,extraout_t1_04,extraout_t2_04,
                   extraout_t3_04);
            uVar8 = 0;
          }
          else {
            *(undefined8 *)(piVar4 + 0xe) = 0;
            uVar8 = 0;
            *(undefined8 *)(piVar4 + 0x1a) = 0;
            *(code **)(piVar4 + 0x18) = vnand_proc_read;
          }
        }
      }
    }
  }
  else {
    printk("VNAND: %s(): vnand driver already initialized\n","vnand_scan",extraout_a2,extraout_a3,
           extraout_t0,extraout_t1,extraout_t2,extraout_t3);
    uVar8 = 0;
  }
  return uVar8;
}

Here is the pseudocode of the VNAND driver

thosoo commented 2 years ago

samsung_init


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

undefined8
samsung_init(undefined8 param_1,undefined8 param_2,undefined8 param_3,undefined8 param_4,
            undefined8 param_5,undefined8 param_6,undefined8 param_7,undefined8 param_8)

{
  undefined *puVar1;
  longlong lVar2;
  undefined8 extraout_a1;
  undefined8 extraout_a1_00;
  undefined8 extraout_a2;
  undefined8 extraout_a2_00;
  undefined8 extraout_a2_01;
  undefined8 extraout_a3;
  undefined8 extraout_a3_00;
  undefined8 extraout_a3_01;
  undefined8 extraout_a3_02;
  undefined8 extraout_a3_03;
  undefined8 extraout_t0;
  undefined8 extraout_t0_00;
  undefined8 extraout_t0_01;
  undefined8 extraout_t0_02;
  undefined8 extraout_t0_03;
  undefined8 extraout_t1;
  undefined8 extraout_t1_00;
  undefined8 extraout_t1_01;
  undefined8 extraout_t1_02;
  undefined8 extraout_t1_03;
  undefined8 extraout_t2;
  undefined8 extraout_t2_00;
  undefined8 extraout_t2_01;
  undefined8 extraout_t2_02;
  undefined8 extraout_t2_03;
  undefined8 extraout_t3;
  undefined8 extraout_t3_00;
  undefined8 extraout_t3_01;
  undefined8 extraout_t3_02;
  undefined8 extraout_t3_03;
  ulonglong uVar3;
  undefined *puVar4;
  undefined8 uVar5;

  printk("<5>NAND flash(on Octeon BootBus) driver for linux by GIGABYTE\n",param_2,param_3,param_4,
         param_5,param_6,param_7,param_8);
  puVar1 = (undefined *)kmem_cache_alloc(malloc_sizes._128_8_,0xd0);
  samsung_nand_mtd = puVar1;
  if (puVar1 == (undefined *)0x0) {
    printk("Unable to allocate NAND MTD device structure.\n",extraout_a1,extraout_a2,extraout_a3,
           extraout_t0,extraout_t1,extraout_t2,extraout_t3);
    uVar5 = 0xfffffffffffffff4;
  }
  else {
    memset(puVar1,0,0x150);
    uVar5 = 0xffffffff806d7984;
    memset(puVar1 + 0x150,0,0x1f8);
    setCopReg(2,uVar5,*(undefined4 *)(_DAT_8001180000000008 + 0x58));
    uVar5 = 0x10;
    if ((_DAT_8001180000000008 & 0x10000000) == 0) {
      uVar5 = 8;
    }
    uVar3 = SEXT48((int)_DAT_8001180000000008 << 0x10);
    printk("Something found on bootbus: %d-bit, base=%x\n",uVar5,uVar3,extraout_a3_00,extraout_t0_00
           ,extraout_t1_00,extraout_t2_00,extraout_t3_00);
    puVar4 = &DAT_9000000000000000 + (uVar3 & 0xffffffff);
    if (puVar4 == (undefined *)0x0) {
      printk("Failed to ioremap NAND device.\n",extraout_a1_00,extraout_a2_00,extraout_a3_01,
             extraout_t0_01,extraout_t1_01,extraout_t2_01,extraout_t3_01);
      uVar5 = 0xfffffffffffffff4;
    }
    else {
      uVar3 = octeon_is_sbox4_gigabyte_board();
      if (uVar3 == 0) {
        *(code **)(puVar1 + 0x1a0) = cavium_cmd_ctrl_cm;
      }
      else {
        *(code **)(puVar1 + 0x1a0) = cavium_cmd_ctrl_gb;
      }
      *(undefined **)(puVar1 + 0x150) = puVar4;
      *(undefined4 *)(puVar1 + 0x238) = 1;
      *(undefined4 *)(puVar1 + 0x1e4) = 0x101;
      *(undefined4 *)(puVar1 + 0x1e0) = 0x14;
      *(undefined **)(puVar1 + 0x158) = puVar4;
      puVar1 = samsung_nand_mtd;
      nand_cmd_reg_tim = _DAT_8001180000000048;
      nand_data_reg_tim = _DAT_8001180000000048 & 0xffffff;
      *(undefined **)(samsung_nand_mtd + 0x128) = puVar1 + 0x150;
      *(char **)(puVar1 + 0x20) = "nand_flash";
      *(undefined8 *)(puVar1 + 0x130) = 0;
      lVar2 = vnand_scan(puVar1,1,puVar1,extraout_a3_02,extraout_t0_02,extraout_t1_02,extraout_t2_02
                         ,extraout_t3_02);
      if (lVar2 == 0) {
        set_nand_partitions(samsung_nand_mtd,(ulonglong *)0x0,(char **)part_probes);
        uVar5 = 0;
      }
      else {
        printk("<5>No NAND device - returning -ENXIO\n",0,extraout_a2_01,extraout_a3_03,
               extraout_t0_03,extraout_t1_03,extraout_t2_03,extraout_t3_03);
        kfree((ulonglong)samsung_nand_mtd);
        uVar5 = 0xfffffffffffffffa;
      }
    }
  }
  return uVar5;
}

this is the samsung initialisation function

Spawn-2002 commented 2 years ago

Sorry, I don't understand where to apply this :(

thosoo commented 2 years ago

Sorry, I don't understand where to apply this :(

This is not to be applied, just to understand how nand access works in original firmware.

thosoo commented 2 years ago

Sorry, I don't understand where to apply this :(

I remember the device has usb, maybe you can use something like this: https://openwrt.org/docs/guide-user/additional-software/extroot_configuration

Spawn-2002 commented 2 years ago

I remember the device has usb, maybe you can use something like this: https://openwrt.org/docs/guide-user/additional-software/extroot_configuration

HI. U-boot is compiled without USB support. :(

thosoo commented 2 years ago

I remember the device has usb, maybe you can use something like this: https://openwrt.org/docs/guide-user/additional-software/extroot_configuration

HI. U-boot is compiled without USB support. :(

Uboot does not, but OpenWRT can access, or not?

Spawn-2002 commented 2 years ago

Uboot does not, but OpenWRT can access, or not?

Uboot does not support USB. Sorry for the delay in reply.