Quantcast
Channel: Linux Device Hacking
Viewing all articles
Browse latest Browse all 3178

LG N1T1 NAS (1 reply)

$
0
0
Hi Everyone!

I recently acquired an LG NAS, particularly the N1T1DD1. It is a Kirkwood-based device with 2 SATA ports, with a 1 TB HDD (3.5 inch size) and a slot-in slimline DVD rewriter attached (the latter feature was my main reason for buying :)), 1 USB 2.0 port, 1 gigabit Ethernet, 5 LEDs, 2 buttons, a single SPDT switch and a fan. Originally it runs a slightly modified Debian Lenny distribution with Linux 2.6.32 kernel. U-Boot 1.1.4, modified by LG, is used as the bootloader.

Since it is a Kirkwood device and LG made available the sources (although without any helpful documentation), I managed to get Linux 3.16 and later Linux 4.4 running on the N1T1. My work is based on bodhi's kernel, the 4.4 only required a dts file and adding an extra line to the mach-types file (I still use the original bootloader, so this seems to be necessary). A patch file is attached to this post, so anyone feeling like upgrading his/her N1T1 (and possibly variants, like N1A1) to a newer kernel and Jessie can use this. To build your own kernel, download the Linux 4.4 sources, patch it with bodhi's 4.4 patch and then this patch. The LG NAS only has a 512 kB SPI Flash and no NAND, so I used USB to boot. For me the easiest way was to just build the kernel with all the USB mass storage drivers embedded, but it should also work with an initrd (I couldn't get it working, but I haven't really tried that hard). The original firmware boots from the hard disk (or DVD if the recovery disc is inserted), this should be also possible if the SATA drivers are built into the kernel. Anyways, here is the boot log:
�Normal mode boot start! 

 _   _     ____              _
| | | |   | __ )  ___   ___ | |_ 
| | | |___|  _ \ / _ \ / _ \| __| 
| |_| |___| |_) | (_) | (_) | |_ 
 \___/    |____/ \___/ \___/ \__|  ** LOADER **
 ** LGE-NAS BOARD: NT1-Pilot LE 

U-Boot 1.1.4 (Apr 26 2010 - 16:13:51) LGE version: NT1-Pilot

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 006CD300

Soc: 88F6281 A1 (DDR2)
CPU running @ 1000Mhz L2 running @ 333Mhz
SysClock = 333Mhz , TClock = 200Mhz 

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

CPU : Marvell Feroceon (Rev 1)

Streaming disabled 
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME]
 Normal mode : lg_bootmode = 0 
Hit any key to stop autoboot:  0 
(Re)start USB...
USB:   scanning bus for devices... 2 USB Device(s) found
       scanning bus for storage devices... 1 Storage Device(s) found
....
.
...................
............
.............
...................................................
......................................................................................................
........................................................................................................................

3328734 bytes read
## Booting image at 00800000 ..., header_size = 00000040, header_addr = 0068d634
image_header_t hdr contents
hdr->ih_magic = 56190527, hdr->ih_hcrc = ae17fc70
hdr->ih_time = 8729e356, hdr->ih_size = 0032ca9e
hdr->ih_load = 00800000, hdr->ih_ep = 00800000
hdr->ih_dcrc = 9dfe0b7e
hdr->ih_os = 05, hdr->ih_arch = 02
hdr->ih_type = 02, hdr->ih_comp = 00
hdr->ih_name = Linux-4.4.0-kirkwood-tld-1

   Image Name:   Linux-4.4.0-kirkwood-tld-1
   Created:      2016-03-11  20:24:39 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3328670 Bytes .2 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.4.0-n1t1-tld-1 (aronk@vincent) (gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67) ) #1 PREEMPT Fri Mar 11 21:10:25 CET 2016
[    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine model: LG N1T1
[    0.000000] Memory policy: Data cache writeback
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,115200 mtdparts=spi_flash:0x78000@0(uboot),0x1000@0x78000(env) root=/dev/sda1 rw rootdelay=10 rootfstype=ext3
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Memory: 120140K/131072K available (6359K kernel code, 608K rwdata, 2096K rodata, 296K init, 313K bss, 10932K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc8800000 - 0xff800000   ( 880 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0849fcc   (8456 kB)
[    0.000000]       .init : 0xc084a000 - 0xc0894000   ( 296 kB)
[    0.000000]       .data : 0xc0894000 - 0xc092c084   ( 609 kB)
[    0.000000]        .bss : 0xc092c084 - 0xc097a508   ( 314 kB)
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  Build-time adjustment of leaf fanout to 32.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns
[    0.000011] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 10737418237ns
[    0.000371] Console: colour dummy device 80x30
[    0.000404] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
[    0.090109] pid_max: default: 32768 minimum: 301
[    0.090237] Security Framework initialized
[    0.090322] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.090344] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.091278] Initializing cgroup subsys io
[    0.091316] Initializing cgroup subsys devices
[    0.091346] Initializing cgroup subsys freezer
[    0.091385] Initializing cgroup subsys net_cls
[    0.091477] CPU: Testing write buffer coherency: ok
[    0.091996] Setting up static identity map for 0x8200 - 0x8258
[    0.092325] mvebu-soc-id: MVEBU SoC ID=0x6281, Rev=0x3
[    0.096596] devtmpfs: initialized
[    0.103103] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.103642] prandom: seed boundary self test passed
[    0.108439] prandom: 100 self tests passed
[    0.108467] pinctrl core: initialized pinctrl subsystem
[    0.110173] NET: Registered protocol family 16
[    0.110766] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.140120] cpuidle: using governor ladder
[    0.170116] cpuidle: using governor menu
[    0.170666] Feroceon L2: Enabling L2
[    0.170718] Feroceon L2: Cache support initialised.
[    0.171176] [Firmware Info]: /ocp@f1000000/ethernet-controller@72000/ethernet0-port@0: local-mac-address is not set
[    0.178080] No ATAGs?
[    0.211930] vgaarb: loaded
[    0.212337] SCSI subsystem initialized
[    0.212760] usbcore: registered new interface driver usbfs
[    0.212861] usbcore: registered new interface driver hub
[    0.212969] usbcore: registered new device driver usb
[    0.214391] clocksource: Switched to clocksource orion_clocksource
[    0.282270] NET: Registered protocol family 2
[    0.283256] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.283290] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.283317] TCP: Hash tables configured (established 1024 bind 1024)
[    0.283399] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.283431] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.283673] NET: Registered protocol family 1
[    0.284191] RPC: Registered named UNIX socket transport module.
[    0.284206] RPC: Registered udp transport module.
[    0.284216] RPC: Registered tcp transport module.
[    0.284226] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.284848] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.286138] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.286228] audit: initializing netlink subsys (disabled)
[    0.286285] audit: type=2000 audit(0.280:1): initialized
[    0.286721] Initialise system trusted keyring
[    0.287150] zbud: loaded
[    0.287517] VFS: Disk quotas dquot_6.6.0
[    0.287594] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.288254] NFS: Registering the id_resolver key type
[    0.288313] Key type id_resolver registered
[    0.288324] Key type id_legacy registered
[    0.288358] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.288378] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    0.288661] jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
[    0.289309] Key type big_key registered
[    0.303892] Key type asymmetric registered
[    0.303922] Asymmetric key parser 'x509' registered
[    0.304028] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.304048] io scheduler noop registered
[    0.304065] io scheduler deadline registered
[    0.304138] io scheduler cfq registered (default)
[    0.305796] kirkwood-pinctrl f1010000.pin-controller: registered pinctrl driver
[    0.306629] irq: Cannot allocate irq_descs @ IRQ34, assuming pre-allocated
[    0.307138] irq: Cannot allocate irq_descs @ IRQ66, assuming pre-allocated
[    0.307836] mv_xor f1060800.xor: Marvell shared XOR driver
[    0.345252] mv_xor f1060800.xor: Marvell XOR (Registers Mode): ( xor cpy intr )
[    0.345547] mv_xor f1060900.xor: Marvell shared XOR driver
[    0.385302] mv_xor f1060900.xor: Marvell XOR (Registers Mode): ( xor cpy intr )
[    0.385931] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.387580] console [ttyS0] disabled
[    0.387651] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 26, base_baud = 12500000) is a 16550A
[    0.982170] console [ttyS0] enabled
[    0.988210] m25p80 spi0.0: mx25l4005a (512 Kbytes)
[    0.996165] libphy: Fixed MDIO Bus: probed
[    1.000675] libphy: orion_mdio_bus: probed
[    1.005739] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
[    2.083863] mv643xx_eth_port mv643xx_eth_port.0 eth0: port 0 with MAC address 00:e0:91:81:30:9b
[    2.092833] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    2.099458] ehci-pci: EHCI PCI platform driver
[    2.104015] ehci-orion: EHCI orion driver
[    2.108279] orion-ehci f1050000.ehci: EHCI Host Controller
[    2.113829] orion-ehci f1050000.ehci: new USB bus registered, assigned bus number 1
[    2.121771] orion-ehci f1050000.ehci: irq 30, io mem 0xf1050000
[    2.144432] orion-ehci f1050000.ehci: USB 2.0 started, EHCI 1.00
[    2.150768] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    2.157626] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.164906] usb usb1: Product: EHCI Host Controller
[    2.169808] usb usb1: Manufacturer: Linux 4.4.0-n1t1-tld-1 ehci_hcd
[    2.176127] usb usb1: SerialNumber: f1050000.ehci
[    2.181767] hub 1-0:1.0: USB hub found
[    2.185644] hub 1-0:1.0: 1 port detected
[    2.190483] usbcore: registered new interface driver usb-storage
[    2.197107] mousedev: PS/2 mouse device common for all mice
[    2.203521] rtc-mv f1010300.rtc: rtc core: registered f1010300.rtc as rtc0
[    2.210730] i2c /dev entries driver
[    2.216171] hidraw: raw HID events driver (C) Jiri Kosina
[    2.222090] drop_monitor: Initializing network drop monitor service
[    2.228791] NET: Registered protocol family 17
[    2.233631] Key type dns_resolver registered
[    2.239071] registered taskstats version 1
[    2.243232] Loading compiled-in X.509 certificates
[    2.248181] zswap: loaded using pool lzo/zbud
[    2.253878] Key type encrypted registered
[    2.258639] rtc-mv f1010300.rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
[    2.269001] Waiting 10 sec before mounting root device...
[    2.504436] usb 1-1: new high-speed USB device number 2 using orion-ehci
[    2.655407] usb 1-1: New USB device found, idVendor=cd12, idProduct=ef18
[    2.662166] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.669379] usb 1-1: Product: DISK
[    2.672804] usb 1-1: Manufacturer: USB
[    2.677535] usb-storage 1-1:1.0: USB Mass Storage device detected
[    2.684023] scsi host0: usb-storage 1-1:1.0
[    3.685517] scsi 0:0:0:0: Direct-Access     SCSI     DISK             1.00 PQ: 0 ANSI: 4
[    3.696206] sd 0:0:0:0: [sda] 7881824 512-byte logical blocks: (4.03 GB/3.75 GiB)
[    3.704188] sd 0:0:0:0: [sda] Write Protect is off
[    3.709567] sd 0:0:0:0: [sda] No Caching mode page found
[    3.714986] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    3.735564]  sda: sda1 sda2
[    3.741695] sd 0:0:0:0: [sda] Attached SCSI removable disk
[   12.286205] EXT4-fs (sda1): mounting ext3 file system using the ext4 subsystem
[   12.317713] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[   12.325515] VFS: Mounted root (ext3 filesystem) on device 8:1.
[   12.344635] devtmpfs: mounted
[   12.348782] Freeing unused kernel memory: 296K (c084a000 - c0894000)
Mount failed for selinuxfs on /sys/fs/selinux:  No such file or directory
INIT: version 2.88 booting
[info] Using makefile-style concurrent boot in runlevel S.
[....] Starting the hotplug events dispatcher: udevd[   14.222213] systemd-udevd[209]: starting version 215
. ok 
[   14.353768] random: udevd urandom read with 72 bits of entropy available
[ ok ] Synthesizing the initial hotplug events...done.
[....] Waiting for /dev to be fully populated...[   14.666686] input: gpio-keys as /devices/platform/gpio-keys/input/input0
[   14.827591] orion_wdt: Initial timeout 21 sec
[   14.975448] marvell-cesa: probe of f1030000.crypto failed with error -524
[   15.042031] usbcore: registered new interface driver uas
[   15.066677] sata_mv f1080000.sata: slots 32 ports 2
[   15.112983] sd 0:0:0:0: Attached scsi generic sg0 type 0
[   15.131009] scsi host1: sata_mv
[   15.152827] scsi host2: sata_mv
[   15.169329] ata1: SATA max UDMA/133 irq 33
[   15.173505] ata2: SATA max UDMA/133 irq 33
[   15.714448] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
[   15.754482] ata1.00: ATA-8: HITACHI HTS725016A9A364, PCBZC70F, max UDMA/100
[   15.761484] ata1.00: 312581808 sectors, multi 0: LBA48 NCQ (depth 31/32)
[   15.824485] ata1.00: configured for UDMA/100
[   15.844963] scsi 1:0:0:0: Direct-Access     ATA      HITACHI HTS72501 C70F PQ: 0 ANSI: 5
[   15.855061] sd 1:0:0:0: [sdb] 312581808 512-byte logical blocks: (160 GB/149 GiB)
[   15.863644] sd 1:0:0:0: Attached scsi generic sg1 type 0
[   15.869412] sd 1:0:0:0: [sdb] Write Protect is off
[   15.875137] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   15.920958]  sdb: sdb1 sdb2 sdb3
[   15.927534] sd 1:0:0:0: [sdb] Attached SCSI disk
[   16.384441] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl F300)
[   16.404538] ata2.00: ATAPI: HL-DT-STDVDRAM GA31N, T107, max UDMA/100
[   16.444531] ata2.00: configured for UDMA/100
[   16.624533] scsi 2:0:0:0: CD-ROM            HL-DT-ST DVDRAM GA31N     T107 PQ: 0 ANSI: 5
[   16.696424] scsi 2:0:0:0: Attached scsi generic sg2 type 5
[   16.734229] random: nonblocking pool is initialized
[   16.864546] sr 2:0:0:0: [sr0] scsi3-mmc drive: 24x/24x writer dvd-ram cd/rw xa/form2 cdda tray
[   16.873204] cdrom: Uniform CD-ROM driver Revision: 3.20
done.
[ ok ] Activating swap...done.
[   29.599341] EXT4-fs (sda1): re-mounted. Opts: (null)
[....] Checking root file system...fsck from util-linux 2.25.2
rootfs: clean, 17070/213840 files, 153128/854016 blocks
done.
[   31.840393] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[ ok ] Activating lvm and md swap...done.
[....] Checking file systems...fsck from util-linux 2.25.2
done.
[ ok ] Cleaning up temporary files... /tmp.
[ ok ] Loading kernel modules...done.
[ ok ] Mounting local filesystems...done.
[ ok ] Activating swapfile swap...done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting kernel variables ...done.
[   35.886414] NET: Registered protocol family 10
[   37.144070] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[....] Configuring network interfaces...Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/00:e0:91:81:30:9b
Sending on   LPF/eth0/00:e0:91:81:30:9b
Sending on   Socket/fallback
DHCPREQUEST on eth0 to 255.255.255.255 port 67
[   43.335878] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 1000 Mb/s, full duplex, flow control disabled
[   43.345819] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.202 -- renewal in 10786 seconds.
done.
[ ok ] Starting rpcbind daemon....
[ ok ] Starting NFS common utilities: statd idmapd.
[ ok ] Cleaning up temporary files....
INIT: Entering runlevel: 2
[info] Using makefile-style concurrent boot in runlevel 2.
[....] Starting busybox' syslogd implementation : syslogdStarting /sbin/syslogd...
1178 (syslogd)
. ok 
[ ok ] Starting NFS common utilities: statd idmapd.
[ ok ] Starting system message bus: dbus.
[ ok ] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
[warn] Not starting NFS kernel daemon: no exports. ... (warning).
[ ok ] Starting NTP server: ntpd.
[....] Starting busybox' klogd implementation : klogdStarting /sbin/klogd...
1181 (klogd)
. ok 
[ ok ] Starting OpenBSD Secure Shell server: sshd.

Debian GNU/Linux 8 debian ttyS0

debian login:

If someone sees something strange/wrong, please notify me so I can fix it. My next step is to bring U-Boot support for this board. It also works fine with the stock version but I think it's not such a big effort to add support for the latest U-Boot.

I will post some pics of the main PCB in the following days, since there is no picture on the Internet of the internals of the device and maybe it is helpful for others. There is a NEC microcontroller, connected by I2C to the Marvell CPU, which controls the power supply, possibly the Eject button and the Power LED. It would be good to get some input on this, try to reverse engineer how it works, reprogram it, replace it... Anyways it's not important for using the device as a NAS, it just makes a good hardware hacking project :)

Viewing all articles
Browse latest Browse all 3178

Trending Articles