Buffalo NAS-Central Forums

Welcome to the Linkstation Wiki community
It is currently Sun Aug 19, 2018 8:54 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Wed Feb 08, 2017 5:56 am 
Offline
Newbie

Joined: Thu Jul 28, 2016 7:43 am
Posts: 19
I could not find LS210 device tree blob.

LS421DE blob is not in Linux Git Repository but one is in https://tohenk.wordpress.com/2014/12/11 ... n-ls421de/

I set gentoo-chroot stage3-armv7a_hardfp-20161129.tar.bz2 in LS210 and set ssh passwords, network and some services to runleves.

As in https://tohenk.wordpress.com/2014/12/11 ... n-ls421de/ I compiled DTB-kernel and installed it in sda1 uImage.buffalo.

It failed to boot.

After some configuration it boots.
CONFIG_CMDLINE="root=/dev/sda2 rw rootfstype=ext3"
# CONFIG_BLK_DEV_INITRD is not set

To get kernel config that really is running I set:
Enable access to .config through /proc/config.gz (IKCONFIG_PROC)
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y


Top
   
PostPosted: Wed Feb 08, 2017 7:59 am 
Offline
Moderator

Joined: Mon Apr 26, 2010 10:24 am
Posts: 2734
Now you have created 3 posts on 3 different topics.
Please stay on one topic.


Top
   
PostPosted: Mon Jan 08, 2018 2:34 pm 
Offline
Newbie

Joined: Thu Jul 28, 2016 7:43 am
Posts: 19
The scripts in https://tohenk.wordpress.com/2014/12/11 ... n-ls421de/
downloads kernel sources, cross-compiler and patches. Then the scripts patch the kernel, crosscompile it on a computer (in my case AMD64) and creates the file uImage.buffalo that can be copied to sda1 of buffalo-NAS.

The patches are applied like:
patch -p1 < 0001-ARM-atags-add-support-for-Marvell-s-u-boot.patch
patch -p1 < 0002-ARM-atags-fdt-retrieve-MAC-addresses-from-Marvell-bo.patch
patch -p1 < 0010-ignore-scm-state-in-local-version.patch
patch -p1 < 0011-buffalo-ls421de-dts.patch

(they are in https://github.com/tohenk/linkstation-mod)

For LS210 only patch -p1 < 0011-buffalo-ls421de-dts.patch is needed.

in chrooted gentoo of LS210 there is no need for these scripts.

Just in this way:
emerge =sys-kernel/vanilla-sources-4.9.74
cd /usr/src/linux
copy a known good kernel config to /usr/src/linux/.config
make silentoldconfig
patch -p1 < 0011-buffalo-ls421de-dts.patch
make
make modules
make modules_install
make armada-370-ls421de.dtb
cat arch/arm/boot/zImage arch/arm/boot/dts/armada-370-ls421de.dtb > zImage+armada-370-ls421de.dtb
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n 4.9.74.dtb -d zImage+armada-370-ls421de.dtb uimage-4.9.74-armada-370-ls421de
cp uimage-4.9.74-armada-370-ls421de /mnt/sda1/uImage.buffalo

Then put the HD to another computer and move buffalo system from sda2 to safe place and move gentoo to /mnt/sda2.

Then install HD back to LS210 and reboot.


Top
   
PostPosted: Mon Jan 08, 2018 3:02 pm 
Offline
Newbie

Joined: Thu Jul 28, 2016 7:43 am
Posts: 19
patch -p1 < 0011-buffalo-ls421de-dts.patch creates a file armada-370-ls421de.dts

Code:
#armada-370-ls421de.dts
/*
 * Device Tree file for Buffalo LinkStation LS421DE
 *
 * Toha <tohenk@yahoo.com>
 *
 * This file is dual-licensed: you can use it either under the terms
 * of the GPL or the X11 license, at your option. Note that this dual
 * licensing only applies to this file, and not this project as a
 * whole.
 *
 *  a) This file is free software; you can redistribute it and/or
 *     modify it under the terms of the GNU General Public License as
 *     published by the Free Software Foundation; either version 2 of the
 *     License, or (at your option) any later version.
 *
 *     This file is distributed in the hope that it will be useful
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 * Or, alternatively
 *
 *  b) Permission is hereby granted, free of charge, to any person
 *     obtaining a copy of this software and associated documentation
 *     files (the "Software"), to deal in the Software without
 *     restriction, including without limitation the rights to use
 *     copy, modify, merge, publish, distribute, sublicense, and/or
 *     sell copies of the Software, and to permit persons to whom the
 *     Software is furnished to do so, subject to the following
 *     conditions:
 *
 *     The above copyright notice and this permission notice shall be
 *     included in all copies or substantial portions of the Software.
 *
 *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 *     OTHER DEALINGS IN THE SOFTWARE.
 */

/dts-v1/;

#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include "armada-370.dtsi"

/ {
   model = "Buffalo LinkStation LS421DE";
   compatible = "buffalo,ls421de", "marvell,armada370", "marvell,armada-370-xp";

   /* Ethernet aliases used to assign mac-address from ATAG */
   aliases {
      eth0 = &eth0;
      eth1 = &eth1;
   };

   chosen {
      bootargs = "earlyprintk";
      stdout-path = "serial0:115200n8";
   };

   memory {
      device_type = "memory";
      reg = <0x00000000 0x20000000>; /* 512 MB */
   };

   soc {
      ranges = <MBUS_ID(0xf0, 0x01) 0 0xd0000000 0x100000
           MBUS_ID(0x01, 0xe0) 0 0xfff00000 0x100000
           MBUS_ID(0x09, 0x01) 0 0xf1100000 0x10000>;

      pcie-controller {
         status = "okay";

         pcie@1,0 {
            /* Port 0, Lane 0 */
            status = "okay";
         };
         pcie@2,0 {
            /* Port 1, Lane 0 */
            status = "okay";
         };
      };

      internal-regs {
         rtc@10300 {
            status = "disabled";
         };

         spi@10600 {
            status = "okay";
            pinctrl-0 = <&spi0_pins2>;

            spi-flash@0 {
               #address-cells = <1>;
               #size-cells = <1>;
               compatible = "mx25l8005", "jedec,spi-nor";
               reg = <0>; /* Chip select 0 */
               spi-max-frequency = <50000000>;

               partition@00000 {
                  label = "u-boot";
                  reg = <0x00000 0xf0000>;
                  read-only;
               };
               partition@f0000 {
                  label = "u-boot-env";
                  reg = <0xf0000 0x10000>;
               };
            };
         };

         serial@12000 {
            status = "okay";
         };

         sata@a0000 {
            nr-ports = <2>;
            status = "okay";
         };

         timer@20300 {
            status = "okay";
         };

         mdio {
            pinctrl-0 = <&mdio_pins>;
            pinctrl-names = "default";

            phy0: ethernet-phy@0 {
               reg = <0>;
            };
         };

         ethernet@74000 {
            pinctrl-0 = <&ge1_rgmii_pins>;
            pinctrl-names = "default";
            status = "okay";
            phy = <&phy0>;
            phy-mode = "rgmii-id";
         };

         mvsdio@d4000 {
            pinctrl-0 = <&sdio_pins3>;
            pinctrl-names = "default";
            status = "okay";
            broken-cd;
         };

         usb@50000 {
            status = "okay";
         };

         usb@51000 {
            status = "okay";
         };

         i2c@11000 {
            status = "okay";
            clock-frequency = <100000>;

            rs5c372: rs5c372@32 {
               compatible = "rs5c372a";
               reg = <0x32>;
            };
         };

         nand@d0000 {
            status = "okay";
            num-cs = <1>;
            marvell,nand-keep-config;
            marvell,nand-enable-arbiter;
            nand-on-flash-bbt;

            partition@0 {
               label = "boot";
               reg = <0x0 0x02000000>;
            };
            partition@02100000 {
               label = "rootfs";
               reg = <0x02100000 0x1df00000>;
            };
         };
      };
   };

   regulators {
      compatible = "simple-bus";
      #address-cells = <1>;
      #size-cells = <0>;
      pinctrl-0 = <&usb_vbus>;
      pinctrl-names = "default";

      usb_power: regulator@1 {
         compatible = "regulator-fixed";
         reg = <1>;
         regulator-name = "USB Power";
         regulator-min-microvolt = <5000000>;
         regulator-max-microvolt = <5000000>;
         enable-active-high;
         regulator-always-on;
         regulator-boot-on;
         gpio = <&gpio0 5 GPIO_ACTIVE_LOW>;
      };
   };

   gpio-leds {
      compatible = "gpio-leds";
      pinctrl-names = "default";
      pinctrl-0 = <&power_led_pin &alarm_led_pin &info_led_pin
         &func_led_pin &sata1_led_pin &sata2_led_pin>;

      white-power-led {
         label = "ls421de:white:power";
         gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
         default-state = "keep";
      };
      red-func-led {
         label = "ls421de:red:func";
         gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
         default-state = "off";
      };
      white-info-led {
         label = "ls421de:white:info";
         gpios = <&gpio1 25 GPIO_ACTIVE_HIGH>;
         default-state = "off";
      };
      white-func-led {
         label = "ls421de:white:func";
         gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>;
         default-state = "off";
      };
      red-hdd0err-led {
         label = "ls421de:red:hdd0err";
         gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>;
         default-state = "off";
      };
      red-hdd1err-led {
         label = "ls421de:red:hdd1err";
         gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>;
         default-state = "off";
      };
   };

   gpio-keys {
      compatible = "gpio-keys";
      pinctrl-0 = <&power_switch &func_button>;
      pinctrl-names = "default";

      power-switch {
         label = "Power Switch";
         linux,code = <KEY_POWER>;
         gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
      };
      func-button {
         label = "Function Button";
         linux,code = <KEY_OPTION>;
         gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
      };
   };

   gpio-fan {
      compatible = "gpio-fan";
      pinctrl-0 = <&fan_low &fan_high &fan_lock>;
      pinctrl-names = "default";
      gpios = <&gpio0 14 GPIO_ACTIVE_LOW
               &gpio0 13 GPIO_ACTIVE_LOW>;
      gpio-fan,speed-map = <0    3
                            1500 2
                            3250 1
                            5000 0>;
      alarm-gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>;
   };
};

&pinctrl {
   usb_vbus: usb-vbus {
      marvell,pins = "mpp5";
      marvell,function = "gpo";
   };
   fan_lock: fan-lock {
      marvell,pins = "mpp10";
      marvell,function = "gpio";
   };
   fan_high: fan-high {
      marvell,pins = "mpp13";
      marvell,function = "gpio";
   };
   fan_low: fan-low {
      marvell,pins = "mpp14";
      marvell,function = "gpio";
   };
   power_switch: power-switch {
      marvell,pins = "mpp15";
      marvell,function = "gpio";
   };
   func_button: func-button {
      marvell,pins = "mpp16";
      marvell,function = "gpio";
   };
   power_led_pin: power-led-pin {
      marvell,pins = "mpp54";
      marvell,function = "gpo";
   };
   alarm_led_pin: alarm-led-pin {
      marvell,pins = "mpp55";
      marvell,function = "gpio";
   };
   info_led_pin: info-led-pin {
      marvell,pins = "mpp57";
      marvell,function = "gpio";
   };
   func_led_pin: func-led-pin {
      marvell,pins = "mpp59";
      marvell,function = "gpo";
   };
   sata1_led_pin: sata1-led-pin {
      marvell,pins = "mpp61";
      marvell,function = "gpo";
   };
   sata2_led_pin: sata2-led-pin {
      marvell,pins = "mpp62";
      marvell,function = "gpio";
   };
};


This all is in gentoo-LS210, nothing of buffalo left on disc.

EDIT: Still after compiling some 10 bootable kernels the patch is needed. Just copying the file armada-370-ls421de.dts to /usr/src/linux/arch/arm/boot/dts/ does not boot.

Yes it boots

Copying armada-370-ls421de.dts boots OK, but no ethernet. After connecting the HD to PC-something last line /var/log/dmesg shows:
10239996k
[ 34.903796] EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null)

Also acpid that has in /etc/acpi/power.sh to poweroff shutdowns the box by sliding the switch in the back. This is added by me.


Last edited by sheg on Wed Jan 10, 2018 3:36 pm, edited 3 times in total.

Top
   
PostPosted: Mon Jan 08, 2018 5:16 pm 
Offline
Moderator

Joined: Mon Apr 26, 2010 10:24 am
Posts: 2734
Quote:
copy a known good kernel config to /usr/src/linux/.config


What did you do at this point?


Top
   
PostPosted: Mon Jan 08, 2018 6:58 pm 
Offline
Newbie

Joined: Thu Jul 28, 2016 7:43 am
Posts: 19
The earlier post: The config from running kernel /proc/config.gz

viewtopic.php?f=89&t=44377

It is good if it is running. /proc/config.gz is the proof.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited