Compiling Debian Wheezy Kernel for LinkStation LS421DE

After successfully replacing Buffalo stock firmware with Debian Wheezy, now it's time to compile our own kernel. You need Ubuntu box to do cross compiling.

Preparation

Install required softwares:

$ sudo apt-get install build-essential git

Clone linkstation mod tools using Git:

$ mkdir ~/lsmod
$ cd ~/lsmod
$ git clone https://github.com/tohenk/linkstation-mod.git .

If you just want to update the tools, issue:

$ cd ~/lsmod && git pull

Prepare toolchain (as of 13c5db1):

Toolchains are availables from Linaro. New toolchain can be downloaded and prepared as follow:

$ mkdir -p ~/lsmod/lskernel/toolchain
$ cd ~/lsmod/lskernel/toolchain
$ wget http://releases.linaro.org/components/toolchain/binaries/5.3-2016.02/arm-linux-gnueabihf/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz
$ xzcat gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz | tar -xvf -

To configure which toolchain to use, issue:

$ cd ~/lsmod
$ ./lskernel/build-ls-kernel.sh --toolchain

Cloning Linux Git Repository

Issue the following command to clone Linux Git repository:

$ cd ~/lsmod
$ ./lskernel/build-ls-kernel.sh --download

The Linux Git Repository sized about 900 MB, so it may take more minutes depend on your connection speed. Next time, to update the repository issue command:

$ ./lskernel/build-ls-kernel.sh --update

Cross Compiling

As of commit de80705, now you can choose which kernel version to use:

$ ./lskernel/build-ls-kernel.sh --kver

Customize kernel configuration:

$ ./lskernel/build-ls-kernel.sh --config

Compile kernel image, modules, and DTB (as of commit 50adc89):

$ ./lskernel/build-ls-kernel.sh --build

Package the kernel:

$ sudo ./lskernel/build-ls-kernel.sh --package

The resulting kernel is ls-kernel-3.18.tar.gz in the current directory.

Installing Kernel

Transfer packaged kernel to LinkStation (replace lsbox with your LinkStation ip address or hostname):

$ scp ls-kernel-3.18.tar.gz root@lsbox:/root/

Now on your LinkStation, issue commands:

$ cd ~
$ cp /boot/uImage.buffalo /boot/uImage.buffalo-$(uname -r)
$ tar --overwrite -xvf ls-kernel-3.18.tar.gz -C /

Restart LinkStation to use the new kernel:

$ reboot

Here is kernel log:

Booting Linux on physical CPU 0x0
Linux version 4.4.6-ls421de (toha@Dev-PC) (gcc version 5.3.1 20160113 (Linaro GCC 5.3-2016.02) ) #1 SMP Sat Mar 26 23:12:34 WIB 2016
CPU: ARMv7 Processor [561f5811] revision 1 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
Machine model: Buffalo LinkStation LS421DE
Memory policy: Data cache writeback
On node 0 totalpages: 131072
free_area_init_node: node 0, pgdat c0dc8d80, node_mem_map dfbf8000
  Normal zone: 1024 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 131072 pages, LIFO batch:31
CPU: All CPU(s) started in SVC mode.
PERCPU: Embedded 13 pages/cpu @dfbdc000 s23616 r8192 d21440 u53248
pcpu-alloc: s23616 r8192 d21440 u53248 alloc=13*4096
pcpu-alloc: [0] 0 
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
Kernel command line: console=ttyS0,115200 root=/dev/sda2 rw initrd=0x2600040 panic=5 BOOTVER=0.13 UBOOT_DATE=2013/08/28 mtdparts=armada-nand:0x2000000(boot),0x1e000000(rootfs)
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 503300K/524288K available (8715K kernel code, 950K rwdata, 3968K rodata, 488K init, 737K bss, 20988K reserved, 0K cma-reserved, 0K highmem)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xe0800000 - 0xff800000   ( 496 MB)
    lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .text : 0xc0008000 - 0xc0c6b178   (12685 kB)
      .init : 0xc0c6c000 - 0xc0ce6000   ( 488 kB)
      .data : 0xc0ce6000 - 0xc0dd3a70   ( 951 kB)
       .bss : 0xc0dd3a70 - 0xc0e8c1f0   ( 738 kB)
Hierarchical RCU implementation.
	Build-time adjustment of leaf fanout to 32.
	RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=1.
RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=1
NR_IRQS:16 nr_irqs:16 16
L2C: DT/platform modifies aux control register: 0x12086300 -> 0x1a086302
Aurora cache controller enabled, 4 ways, 256 kB
Aurora: CACHE_ID 0x00000100, AUX_CTRL 0x1a086302
Switching to timer-based delay loop, resolution 53ns
sched_clock: 32 bits at 18MHz, resolution 53ns, wraps every 114532461029ns
clocksource: armada_370_xp_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 101933890472 ns
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 37.50 BogoMIPS (lpj=187500)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket -1, mpidr 0
Setting up static identity map for 0x82a0 - 0x82f8
mvebu-soc-id: MVEBU SoC ID=0x6710, Rev=0x1
mvebu-pmsu: Initializing Power Management Service Unit
Brought up 1 CPUs
SMP: Total of 1 processors activated (37.50 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 56 architecture 2 part 20 variant 9 rev 6
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
xor: measuring software checksum speed
   arm4regs  :  1106.000 MB/sec
   8regs     :  1018.400 MB/sec
   32regs    :  1024.800 MB/sec
xor: using function: arm4regs (1106.000 MB/sec)
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
cpuidle: using governor menu
sram soc:sa-sram: found no memory resource
sram: probe of soc:sa-sram failed with error -22
hw-breakpoint: debug architecture 0x4 unsupported.
raid6: int32x1  gen()   170 MB/s
raid6: int32x1  xor()   218 MB/s
raid6: int32x2  gen()   265 MB/s
raid6: int32x2  xor()   248 MB/s
raid6: int32x4  gen()   307 MB/s
raid6: int32x4  xor()   252 MB/s
raid6: int32x8  gen()   349 MB/s
raid6: int32x8  xor()   233 MB/s
raid6: using algorithm int32x8 gen() 349 MB/s
raid6: .... xor() 233 MB/s, rmw enabled
raid6: using intx1 recovery algorithm
vgaarb: loaded
SCSI subsystem initialized
libata version 3.00 loaded.
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Advanced Linux Sound Architecture Driver Initialized.
Bluetooth: Core ver 2.21
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO socket layer initialized
clocksource: Switched to clocksource armada_370_xp_clocksource
NET: Registered protocol family 2
TCP established hash table entries: 4096 (order: 2, 16384 bytes)
TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
PCI: CLS 0 bytes, default 64
Trying to unpack rootfs image as initramfs...
Freeing initrd memory: 1448K (c2600000 - c276a000)
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
futex hash table entries: 256 (order: 2, 16384 bytes)
VFS: Disk quotas dquot_6.6.0
VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
squashfs: version 4.0 (2009/01/31) Phillip Lougher
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
ntfs: driver 2.1.32 [Flags: R/W].
jffs2: version 2.2. (NAND) \xffffffc2\xffffffa9\xffffffa9 2001-2006 Red Hat, Inc.
fuse init (API version 7.23)
SGI XFS with ACLs, security attributes, realtime, no debug enabled
async_tx: api initialized (async)
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
armada-370-pinctrl d0018000.pin-ctrl: registered pinctrl driver
irq: Cannot allocate irq_descs @ IRQ41, assuming pre-allocated
irq: Cannot allocate irq_descs @ IRQ73, assuming pre-allocated
irq: Cannot allocate irq_descs @ IRQ105, assuming pre-allocated
mvebu-pcie soc:pcie-controller: PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [io  0x1000-0xfffff]
pci_bus 0000:00: root bus resource [mem 0xf8000000-0xffdfffff]
pci_bus 0000:00: root bus resource [bus 00-ff]
pci 0000:00:01.0: [11ab:6710] type 01 class 0x060400
pci 0000:00:02.0: [11ab:6710] type 01 class 0x060400
PCI: bus0: Fast back to back transfers disabled
pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
pci 0000:00:02.0: bridge configuration invalid ([bus 00-00]), reconfiguring
pci 0000:01:00.0: [1912:0015] type 00 class 0x0c0330
pci 0000:01:00.0: reg 0x10: [mem 0x40000000-0x40001fff 64bit]
pci 0000:01:00.0: PME# supported from D0 D3hot D3cold
PCI: bus1: Fast back to back transfers disabled
pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
PCI: bus2: Fast back to back transfers enabled
pci_bus 0000:02: busn_res: [bus 02-ff] end is updated to 02
pci 0000:00:01.0: BAR 8: assigned [mem 0xf8000000-0xf80fffff]
pci 0000:01:00.0: BAR 0: assigned [mem 0xf8000000-0xf8001fff 64bit]
pci 0000:00:01.0: PCI bridge to [bus 01]
pci 0000:00:01.0:   bridge window [mem 0xf8000000-0xf80fffff]
pci 0000:00:02.0: PCI bridge to [bus 02]
pci 0000:00:01.0: enabling device (0140 -> 0142)
mv_xor d0060800.xor: Marvell shared XOR driver
mv_xor d0060800.xor: Marvell XOR (Registers Mode): ( xor cpy intr )
mv_xor d0060900.xor: Marvell shared XOR driver
mv_xor d0060900.xor: Marvell XOR (Registers Mode): ( xor cpy intr )
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
console [ttyS0] disabled
d0012000.serial: ttyS0 at MMIO 0xd0012000 (irq = 19, base_baud = 12500000) is a 16550A
console [ttyS0] enabled
brd: module loaded
loop: module loaded
sata_mv d00a0000.sata: version 1.28
sata_mv d00a0000.sata: slots 32 ports 2
scsi host0: sata_mv
scsi host1: sata_mv
ata1: SATA max UDMA/133 irq 28
ata2: SATA max UDMA/133 irq 28
pxa3xx-nand d00d0000.nand: This platform can't do DMA on this device
nand: device found, Manufacturer ID: 0xad, Chip ID: 0xdc
nand: Hynix H27U4G8F2DTR-BC
nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
pxa3xx-nand d00d0000.nand: ECC strength 1, ECC step size 512
Bad block table found at page 262080, version 0x01
Bad block table found at page 262016, version 0x01
nand_read_bbt: bad block at 0x0000059c0000
nand_read_bbt: bad block at 0x0000061e0000
nand_read_bbt: bad block at 0x00000d9c0000
nand_read_bbt: bad block at 0x00000d9e0000
nand_read_bbt: bad block at 0x00000e1c0000
nand_read_bbt: bad block at 0x00000e1e0000
nand_read_bbt: bad block at 0x00001d1e0000
nand_read_bbt: bad block at 0x00001d840000
nand_read_bbt: bad block at 0x00001d860000
nand_read_bbt: bad block at 0x00001e6c0000
nand_read_bbt: bad block at 0x00001e6e0000
nand_read_bbt: bad block at 0x00001e840000
nand_read_bbt: bad block at 0x00001e860000
nand_read_bbt: bad block at 0x00001edc0000
nand_read_bbt: bad block at 0x00001ede0000
nand_read_bbt: bad block at 0x00001f380000
nand_read_bbt: bad block at 0x00001f3a0000
nand_read_bbt: bad block at 0x00001f840000
nand_read_bbt: bad block at 0x00001f860000
3 ofpart partitions found on MTD device pxa3xx_nand-0
Creating 3 MTD partitions on "pxa3xx_nand-0":
0x000000000000-0x000000100000 : "spi-flash"
0x000000100000-0x000002100000 : "boot"
0x000002100000-0x000020000000 : "rootfs"
libphy: Fixed MDIO Bus: probed
libphy: orion_mdio_bus: probed
mvneta d0074000.ethernet eth0: Using device tree mac address 10:6f:3f:cd:58:8b
PPP generic driver version 2.4.2
NET: Registered protocol family 24
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
ehci-orion: EHCI orion driver
orion-ehci d0050000.usb: EHCI Host Controller
orion-ehci d0050000.usb: new USB bus registered, assigned bus number 1
orion-ehci d0050000.usb: irq 25, io mem 0xd0050000
orion-ehci d0050000.usb: USB 2.0 started, EHCI 1.00
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: EHCI Host Controller
usb usb1: Manufacturer: Linux 4.4.6-ls421de ehci_hcd
usb usb1: SerialNumber: d0050000.usb
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
orion-ehci d0051000.usb: EHCI Host Controller
orion-ehci d0051000.usb: new USB bus registered, assigned bus number 2
orion-ehci d0051000.usb: irq 26, io mem 0xd0051000
orion-ehci d0051000.usb: USB 2.0 started, EHCI 1.00
usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: EHCI Host Controller
usb usb2: Manufacturer: Linux 4.4.6-ls421de ehci_hcd
usb usb2: SerialNumber: d0051000.usb
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
xhci_hcd 0000:01:00.0: xHCI Host Controller
xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 3
xhci_hcd 0000:01:00.0: hcc params 0x014051cf hci version 0x100 quirks 0x00000090
usb usb3: New USB device found, idVendor=1d6b, idProduct=0002
usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb3: Product: xHCI Host Controller
usb usb3: Manufacturer: Linux 4.4.6-ls421de xhci-hcd
usb usb3: SerialNumber: 0000:01:00.0
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 2 ports detected
xhci_hcd 0000:01:00.0: xHCI Host Controller
xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 4
usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
usb usb4: New USB device found, idVendor=1d6b, idProduct=0003
usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb4: Product: xHCI Host Controller
usb usb4: Manufacturer: Linux 4.4.6-ls421de xhci-hcd
usb usb4: SerialNumber: 0000:01:00.0
hub 4-0:1.0: USB hub found
hub 4-0:1.0: 2 ports detected
usbcore: registered new interface driver cdc_acm
cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
usbcore: registered new interface driver usblp
usbcore: registered new interface driver cdc_wdm
usbcore: registered new interface driver usb-storage
usbcore: registered new interface driver usbserial
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial support registered for generic
usbcore: registered new interface driver pl2303
usbserial: USB Serial support registered for pl2303
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
rtc-rs5c372 0-0032: rs5c372a found, 24hr, driver version 0.6
rtc rtc0: invalid alarm value: 2016-3-27 37:85:0
rtc-rs5c372 0-0032: rtc core: registered rtc-rs5c372 as rtc0
gpio-fan gpio-fan: GPIO fan initialized
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
ata1: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
md: raid6 personality registered for level 6
md: raid5 personality registered for level 5
md: raid4 personality registered for level 4
device-mapper: ioctl: 4.34.0-ioctl (2015-10-28) initialised: dm-devel@redhat.com
ata1.00: ATA-9: WDC WD40EFRX-68WT0N0, 82.00A82, max UDMA/133
ata1.00: 7814037168 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata1.00: configured for UDMA/133
scsi 0:0:0:0: Direct-Access     ATA      WDC WD40EFRX-68W 0A82 PQ: 0 ANSI: 5
marvell-cesa: probe of d0090000.crypto failed with error -22
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
sd 0:0:0:0: [sda] 7814037168 512-byte logical blocks: (4.00 TB/3.64 TiB)
sd 0:0:0:0: [sda] 4096-byte physical blocks
sd 0:0:0:0: Attached scsi generic sg0 type 0
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
oprofile: using arm/armv7-ca9
NET: Registered protocol family 10
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
NET: Registered protocol family 17
bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
l2tp_core: L2TP core driver, V2.0
l2tp_ip: L2TP IP encapsulation support (L2TPv3)
l2tp_netlink: L2TP netlink interface
l2tp_eth: L2TP ethernet pseudowire support (L2TPv3)
l2tp_ip6: L2TP IP encapsulation support for IPv6 (L2TPv3)
8021q: 802.1Q VLAN Support v1.8
ThumbEE CPU extension supported.
Registering SWP/SWPB emulation handler
input: gpio-keys as /devices/platform/gpio-keys/input/input0
rtc-rs5c372 0-0032: setting system clock to 2016-03-27 01:53:05 UTC (1459043585)
ALSA device list:
  No soundcards found.
 sda: sda1 sda2 sda3 sda4 sda5 sda6
sd 0:0:0:0: [sda] Attached SCSI disk
ata2: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
ata2.00: ATA-9: WDC WD40EFRX-68WT0N0, 80.00A80, max UDMA/133
ata2.00: 7814037168 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata2.00: configured for UDMA/133
scsi 1:0:0:0: Direct-Access     ATA      WDC WD40EFRX-68W 0A80 PQ: 0 ANSI: 5
sd 1:0:0:0: [sdb] 7814037168 512-byte logical blocks: (4.00 TB/3.64 TiB)
sd 1:0:0:0: [sdb] 4096-byte physical blocks
sd 1:0:0:0: Attached scsi generic sg1 type 0
sd 1:0:0:0: [sdb] Write Protect is off
sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
 sdb: sdb1 sdb2 sdb3 sdb4 sdb5 sdb6
sd 1:0:0:0: [sdb] Attached SCSI disk
md: Waiting for all devices to be available before autodetect
md: If you don't use raid, use raid=noautodetect
md: Autodetecting RAID arrays.
md: Scanned 0 and added 0 devices.
md: autorun ...
md: ... autorun DONE.
EXT4-fs (sda2): couldn't mount as ext3 due to feature incompatibilities
EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 8:2.
devtmpfs: mounted
Freeing unused kernel memory: 488K (c0c6c000 - c0ce6000)
udevd[1570]: starting version 175
random: nonblocking pool is initialized
Adding 999992k swap on /dev/sda5.  Priority:-1 extents:1 across:999992k 
EXT4-fs (sda2): re-mounted. Opts: (null)
EXT4-fs (sda2): re-mounted. Opts: (null)
EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
EXT4-fs (sda6): mounted filesystem with ordered data mode. Opts: (null)
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
mvneta d0074000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
NFSD: starting 90-second grace period (net c0db3740)
XFS (sdb6): Mounting V4 Filesystem
XFS (sdb6): Ending clean mount

Things currently not working

  1. reboot command behave as poweroff.
  2. poweroff doesn't halt the LinkStation, you need to turn off the power manually (fixed in kernel 4.4).

Important

The LinkStation kernel build script may changed regularly. You need to update the script by issuing:

$ cd ~/lsmod
$ git pull

Save pending works and change branch to master:

$ cd lskernel/linux
$ git stash save -a
$ git checkout master

Then recompile the kernel by following cross-compiling steps above.

51 Comments

  1. Thanks for sharing your insights. I am currently thinking about buying this box and install debian, but two questions remain:
    – is it possible to enable wake on lan using debian or is it a hardware issue?
    – can the power consumption be lowered using debian (i.e. using smartmontools)?
    Thanks in advance.
    Best C.

    • nobody tried that so far? only me worried about energy consumption, which is comparatevely really bad in factory default settings…?

      • Your fridge, heater/air conditioning, oven… uses thousands times more energy than this small box.

        Anyway, according to Marvell docs, WOL is supported, but I tried, and it didn’t work for me:
        root@LS421DE68E:~# /sbin/ethtool -s eth0 wol g
        Cannot get current wake-on-lan settings: Operation not supported
        not setting wol

      • someone works wake up lan?

      • Vladimir, yes, working in last kernel 4.12.14
        $ sudo ethtool eth0
        Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes: 10baseT/Half 10baseT/Full
        100baseT/Half 100baseT/Full
        1000baseT/Half 1000baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes: 10baseT/Half 10baseT/Full
        100baseT/Half 100baseT/Full
        1000baseT/Half 1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Link partner advertised link modes: 10baseT/Half 10baseT/Full
        100baseT/Half 100baseT/Full
        1000baseT/Half 1000baseT/Full
        Link partner advertised pause frame use: Symmetric Receive-only
        Link partner advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: d
        Link detected: yes

      • Gouga, thank you
        and the kernel was installed on the stock firmware or on the debian?

      • Gouga, thank you

  2. My LS421DE seems to startup correctly with the new kernel (3.19). But the ethernet doesn’t work, I don’t see eth1 coming up in the logs. (CONFIG_MVNETA=y).I will try with 3.18.

    • It’s working now, after adding config for eth0 in /etc/network/interfaces

      • Since 3.18, only one phy can be enabled in device tree.

        mvneta d0074000.ethernet eth1: renamed from eth0
        

        If you’ve even use previous version, then it possibly already renamed from eth0 to eth1. This done by udev, if you want to change it just adjust the udev rules.
        To be safe just provide ip configuration for both eth0 and eth1.

  3. OBJCOPY arch/arm/boot/zImage
    Kernel: arch/arm/boot/zImage is ready
    DTC arch/arm/boot/dts/armada-370-ls421de.dtb
    root@neutrone:~/lsmod# ./lskernel/build-ls-kernel.sh –package
    Switching to v3.18.
    Saved working directory and index state WIP on (no branch): b2776bf Linux 3.18
    HEAD is now at b2776bf Linux 3.18
    HEAD is now at b2776bf… Linux 3.18
    Copying .config from /root/lsmod/lskernel/config/3.18…
    Applying patches in 3.18…
    Applying patch 0001-ARM-atags-add-support-for-Marvell-s-u-boot.patch…
    Applying patch 0002-ARM-atags-fdt-retrieve-MAC-addresses-from-Marvell-bo.patch…
    Applying patch 0010-ignore-scm-state-in-local-version.patch…
    Applying patch 0011-buffalo-ls421de-dts.patch…
    Package not built, kernel not found.

    Any Idea ? Thanks

    • Hi, I had the same problem. After a while I realized, why its always switching to the kernel_version. The problem is, that the script calls “git status | grep something”. But in my case, the git output isn’t in english, therefore grep fails => git stash is always called. A quick fix for that is to prepend “LANG=en_US” right before every git command where a special output is expected, e.g.

      CLEAN = `LANG=en_US git status | grep “working directory clean”`
      TAG = `LANG=en_US git status | grep “$KTAG”`

      After this, everything is working!

  4. Switching to v3.18.
    

    The script will automatically stash your changes if you modify LS_KERNEL_VERSION. Just try to start over again.

  5. Edit LS kernel version with 3.19. Same result

  6. How do we make a new device tree? I’m trying to adapt your work to compile kernel for LS-QVL

    http://buffalo.nas-central.org/wiki/Category:LS-QVL

  7. Pingback:Building a kernel for Linkstation LS421DE | geeky ninja's crap

  8. What’s lacking in linux-image-4.0.0-2-armmp from unstable to support this box? Would it run if I just built an image with the .dts from your repository?

  9. Today I tried the update to Debian Jessie. It works after some minor modifications. One needs the slef-compiled Vanilla Kernel (4.1.2 in my case). While compiling you have to set the CONFIG_FHANDLE option to YES. This is needed, since Jessie uses udev. Everything else worked flawlessly.

    • I can confirm, that 4.1.X (4.1.14 in my case) is working. But it took my days to realize, that its working… In my case eth1 obviously was renamed to eth0, therefore I thought, that the box didn’t boot completely (because I couldn’t ping or ssh it). After editing /etc/network/interfaces to “auto eth0 + iface eth0 inet dhcp”, I could login… (maybe it’s worth it, to change this on github?)

      • Hi Dennis,
        After installing new kernel 4.6.x I’m also having similar issue of not being able to ssh my ls421de.
        Given that you were also not able to ping/ssh it, how were you able to edit interface file?

      • Hi Dennis,

        How were you able to edit interfaces given that you could not ssh/ping ls421de?
        I’m having similar problem and trying to figure out how I can ssh it again.

  10. Thanks for the work! 4.6.x works great on my ls421de.
    Few notes :
    1. As mentioned couple of times above, make sure to edit /etc/network/interfaces adding config for eth0 since eth1 will be renamed to eth0 before updating kernel (otherwise you will have to mount your HDD to other linux box and edit)
    2. Need to install ncurses-dev “sudo apt-get install ncurses-dev”
    3. Compile command has changed from ./lskernel/build-ls-kernel.sh –all to ./lskernel/build-ls-kernel.sh –build

    4. Somehow I can’t turn on ls421de after shutdown / poweroff command using switch at the back. Need to plug the powercable off and on then switch on. Don’t know why.
    5. Wish there was a way to activate WOL or anything similar. Wonder what’s the mechanism for sleep timer in original firmware.

  11. Thanks for the work! 4.6.x works great on my ls421de.

  12. Hi there,

    Thanks for this guide and I am trying this today. I have never compiled a kernel before andwhen I use the command “./lskernel/build-ls-kernel.sh –config” there are lots of options and not sure what to do/choose/how to proceed?

    If I just exit and try the next step of “sudo ./lskernel/build-ls-kernel.sh –package” I get:
    Package not built, kernel image not found.

    Can you give me a pointer here please? Thank you very much again.

    • Sorry also to note, before trying the –package command, when I do “sudo ./lskernel/build-ls-kernel.sh –all” I get nothing back, just back to the command line

      • Try again step by step, and repot back failed step. It is hard to diagnose the error without any console output.

  13. step by step >>>
    ~/lsmod# root@axie-desktop:~/lsmod# ./lskernel/build-ls-kernel.sh –toolchain
    Only support building kernel from GIT source.

    can’t go on…why?

    thanks

    • For now, you need to download kernel source first (–download).
      I will update the script next time.

      • $ cd ~/lsmod $ ./lskernel/build-ls-kernel.sh –download

        I get nothing back, just back to the command line.

  14. $ ./lskernel/build-ls-kernel.sh –kver

    also I get nothing back, just back to the command line.

    • Is git already installed?

      • installed.

        step by step:
        $ sudo apt-get install build-essential git
        $ mkdir ~/lsmod
        $ cd ~/lsmod
        $ git clone https://github.com/tohenk/linkstation-mod.git .
        $ mkdir -p ~/lsmod/lskernel/toolchain
        $ cd ~/lsmod/lskernel/toolchain
        $ wget http://releases.linaro.org/components/toolchain/binaries/5.3-2016.02/arm-linux-gnueabihf/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz
        $ xzcat gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz | tar -xvf –
        $ cd ~/lsmod
        $ ./lskernel/build-ls-kernel.sh –toolchain
        $ cd ~/lsmod
        $ ./lskernel/build-ls-kernel.sh –download & ./lskernel/build-ls-kernel.sh –kver

        all get nothing back, just back to the command line.i don’t know why?

        Can you give me a compiled Kernel please? Thank you very much again.

      • ubuntu@ubuntu:~/lsmod$ ./lskernel/build-ls-kernel.sh –kver
        List of available kernel versions:
        1. Linux kernel 4.1.43
        2. Linux kernel 4.11.12
        3. Linux kernel 4.4.80
        4. Linux kernel 4.9.41
        Type choice [1-4]? 2
        Kernel version 4.11.12 selected.
        ubuntu@ubuntu:~/lsmod$ ./lskernel/build-ls-kernel.sh –config
        Switching to v4.11.12.

        *** Please tell me who you are.

        Run

        git config –global user.email “you@example.com”
        git config –global user.name “Your Name”

        to set your account’s default identity.
        Omit –global to set the identity only in this repository.

        fatal: unable to auto-detect email address (got ‘ubuntu@ubuntu.(none)’)
        Cannot save the current index state
        Checking out files: 100% (18806/18806), done.
        M arch/arm/boot/compressed/atags_to_fdt.c
        M arch/arm/include/uapi/asm/setup.h
        M scripts/setlocalversion
        Previous HEAD position was db397d9… Linux 4.9.41
        HEAD is now at bd1a9eb… Linux 4.11.12
        Copying .config from /home/ubuntu/lsmod/lskernel/config/4.11…
        Applying patches in 4.11…
        Applying patch 0001-ARM-atags-add-support-for-Marvell-s-u-boot.patch…
        error: patch failed: arch/arm/include/uapi/asm/setup.h:143
        error: arch/arm/include/uapi/asm/setup.h: patch does not apply
        Applying patch 0002-ARM-atags-fdt-retrieve-MAC-addresses-from-Marvell-bo.patch…
        error: patch failed: arch/arm/boot/compressed/atags_to_fdt.c:18
        error: arch/arm/boot/compressed/atags_to_fdt.c: patch does not apply
        Applying patch 0010-ignore-scm-state-in-local-version.patch…
        error: patch failed: scripts/setlocalversion:156
        error: scripts/setlocalversion: patch does not apply
        Applying patch 0011-buffalo-ls421de-dts.patch…
        error: arch/arm/boot/dts/armada-370-linkstation-ls421de.dts: already exists in working directory
        HOSTCC scripts/kconfig/mconf.o
        In file included from scripts/kconfig/mconf.c:23:0:
        scripts/kconfig/lxdialog/dialog.h:38:20: fatal error: curses.h: No such file or directory
        compilation terminated.
        scripts/Makefile.host:124: recipe for target ‘scripts/kconfig/mconf.o’ failed
        make[1]: *** [scripts/kconfig/mconf.o] Error 1
        Makefile:548: recipe for target ‘menuconfig’ failed
        make: *** [menuconfig] Error 2
        ubuntu@ubuntu:~/lsmod$ ./lskernel/build-ls-kernel.sh –all
        ubuntu@ubuntu:~/lsmod$ sudo ./lskernel/build-ls-kernel.sh –package
        Package not built, kernel image not found.
        ubuntu@ubuntu:~/lsmod$

      • You must setup your local git user as suggested by the prompt.

        *** Please tell me who you are.

        Run

        git config –global user.email “you@example.com”
        git config –global user.name “Your Name”

        to set your account’s default identity.
        Omit –global to set the identity only in this repository.

        fatal: unable to auto-detect email address (got ‘ubuntu@ubuntu.(none)’)
        Cannot save the current index state

        Simply follow the step above and start over.

      • :~/lsmod$ ./lskernel/build-ls-kernel.sh –config
        HOSTCC scripts/kconfig/mconf.o
        In file included from scripts/kconfig/mconf.c:23:0:
        scripts/kconfig/lxdialog/dialog.h:38:20: fatal error: curses.h: No such file or directory
        compilation terminated.
        scripts/Makefile.host:124: recipe for target ‘scripts/kconfig/mconf.o’ failed
        make[1]: *** [scripts/kconfig/mconf.o] Error 1
        Makefile:548: recipe for target ‘menuconfig’ failed
        make: *** [menuconfig] Error 2
        rah66@rah66:~/lsmod$

      • It seems you’re missing ncurses-dev package.

      • Thanks, but new error. In “Linux/arm 4.11.12 Kernel Configuration” need save in .config and EXIT?

        ~/lsmod$ ./lskernel/build-ls-kernel.sh –config
        Switching to v4.11.12.
        Checking out files: 100% (18309/18309), done.
        Note: checking out ‘tags/v4.11.12’.

        You are in ‘detached HEAD’ state. You can look around, make experimental
        changes and commit them, and you can discard any commits you make in this
        state without impacting any branches by performing another checkout.

        If you want to create a new branch to retain commits you create, you may
        do so (now or later) by using -b with the checkout command again. Example:

        git checkout -b

        HEAD is now at bd1a9eb… Linux 4.11.12
        Copying .config from /home/rah66/lsmod/lskernel/config/4.11…
        Applying patches in 4.11…
        Applying patch 0001-ARM-atags-add-support-for-Marvell-s-u-boot.patch…
        Applying patch 0002-ARM-atags-fdt-retrieve-MAC-addresses-from-Marvell-bo.patch…
        Applying patch 0010-ignore-scm-state-in-local-version.patch…
        Applying patch 0011-buffalo-ls421de-dts.patch…
        HOSTCC scripts/basic/fixdep
        HOSTCC scripts/kconfig/mconf.o
        SHIPPED scripts/kconfig/zconf.tab.c
        SHIPPED scripts/kconfig/zconf.lex.c
        SHIPPED scripts/kconfig/zconf.hash.c
        HOSTCC scripts/kconfig/zconf.tab.o
        HOSTCC scripts/kconfig/lxdialog/checklist.o
        HOSTCC scripts/kconfig/lxdialog/util.o
        HOSTCC scripts/kconfig/lxdialog/inputbox.o
        HOSTCC scripts/kconfig/lxdialog/textbox.o
        HOSTCC scripts/kconfig/lxdialog/yesno.o
        HOSTCC scripts/kconfig/lxdialog/menubox.o
        HOSTLD scripts/kconfig/mconf
        scripts/kconfig/mconf Kconfig

        *** End of the configuration.
        *** Execute ‘make’ to start the build or try ‘make help’.

        ~/lsmod$ ./lskernel/build-ls-kernel.sh –all

        ~/lsmod$ sudo ./lskernel/build-ls-kernel.sh –package
        Package not built, kernel image not found.

      • From comment https://tohenk.wordpress.com/2014/12/11/compiling-debian-wheezy-kernel-for-linkstation-ls421de/#comment-3239
        I use
        ./lskernel/build-ls-kernel.sh –build
        and have many errors:
        ~/lsmod$ ./lskernel/build-ls-kernel.sh –build
        CLEAN .tmp_versions
        ./scripts/gcc-version.sh: line 25: /lsmod/lskernel/toolchain/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: cannot execute binary file: Exec format error
        ./scripts/gcc-version.sh: line 26: /lsmod/lskernel/toolchain/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: cannot execute binary file: Exec format error

        *********

        /lsmod/lskernel/toolchain/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: 1: /lsmod/lskernel/toolchain/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: �: not found
        HOSTCC scripts/dtc/livetree.o
        HOSTCC scripts/dtc/treesource.o
        HOSTCC scripts/dtc/srcpos.o
        HOSTCC scripts/dtc/checks.o
        HOSTCC scripts/dtc/util.o
        HOSTCC scripts/dtc/dtc-lexer.lex.o
        HOSTCC scripts/dtc/dtc-parser.tab.o
        HOSTLD scripts/dtc/dtc
        Makefile:562: recipe for target ‘scripts’ failed
        make: *** [scripts] Error 2
        Kernel image not found, aborting.

      • Install Ubuntu_x64 and create kernel-4-11-12 based gcc-linaro-7.1.1-2017.05-x86_64_arm-linux-gnueabihf.tar.xz

  15. step by step again
    $ ./lskernel/build-ls-kernel.sh –download

    Tag v4.1.41 not found in the repository.

    • It seems your kernel source is incomplete.
      Try this:

      cd lskernel/linux
      git pull

      And wait for git to finish updating then start over.

  16. [….] Configuring network interfaces…Internet Systems Consortium DHCP Client 4.2.2
    Copyright 2004-2011 Internet Systems Consortium.
    All rights reserved.
    For info, please visit https://www.isc.org/software/dhcp/

    IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
    Listening on LPF/eth0/10:6f:3f:cd:XX:XX
    Sending on LPF/eth0/10:6f:3f:cd:XX:XX
    Sending on Socket/fallback
    DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
    DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 14
    mvneta d0074000.ethernet eth0: Link is Up – 1Gbps/Full – flow control rx/tx
    IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
    mvneta d0074000.ethernet eth0: Link is Down
    DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11
    mvneta d0074000.ethernet eth0: Link is Up – 1Gbps/Full – flow control rx/tx
    mvneta d0074000.ethernet eth0: Link is Down
    mvneta d0074000.ethernet eth0: Link is Up – 1Gbps/Full – flow control rx/tx
    DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 12
    mvneta d0074000.ethernet eth0: Link is Down
    mvneta d0074000.ethernet eth0: Link is Up – 1Gbps/Full – flow control rx/tx
    mvneta d0074000.ethernet eth0: Link is Down
    DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 13
    mvneta d0074000.ethernet eth0: Link is Up – 1Gbps/Full – flow control rx/tx
    mvneta d0074000.ethernet eth0: Link is Down
    mvneta d0074000.ethernet eth0: Link is Up – 1Gbps/Full – flow control rx/tx
    mvneta d0074000.ethernet eth0: Link is Down
    DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
    mvneta d0074000.ethernet eth0: Link is Up – 1Gbps/Full – flow control rx/tx
    No DHCPOFFERS received.
    No working leases in persistent database – sleeping.
    ifup: interface eth0 already configured
    done.

    mvneta d0074000.ethernet eth0: Link is Down
    mvneta d0074000.ethernet eth0: Link is Up – 1Gbps/Full – flow control rx/tx
    mvneta d0074000.ethernet eth0: Link is Down
    mvneta d0074000.ethernet eth0: Link is Up – 1Gbps/Full – flow control rx/tx
    mvneta d0074000.ethernet eth0: Link is Down
    mvneta d0074000.ethernet eth0: Link is Up – 1Gbps/Full – flow control rx/tx
    mvneta d0074000.ethernet eth0: Link is Down
    mvneta d0074000.ethernet eth0: Link is Up – 1Gbps/Full – flow control rx/tx
    mvneta d0074000.ethernet eth0: Link is Down
    mvneta d0074000.ethernet eth0: Link is Up – 1Gbps/Full – flow control rx/tx
    mvneta d0074000.ethernet eth0: Link is Down
    mvneta d0074000.ethernet eth0: Link is Up – 1Gbps/Full – flow control rx/tx

    what this? (((

  17. In all kernel .config present error:
    arch/arm/boot/compressed/atags_to_fdt.c: In function ‘merge_fdt_bootargs’:
    arch/arm/boot/compressed/atags_to_fdt.c:98:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]
    }
    ^

  18. kernel 4.15 will be? thanks

  19. Pingback:Debian Wheezy on LinkStation LS421DE – Log@X.X.B

  20. Pingback:Unified LSMONITOR for Debian System in LinkStation LS421DE – Toha's Blog

  21. Pingback:Debian Wheezy on LinkStation LS421DE – Toha's Blog

Leave a Reply