gemini: fix hard disk boot on D-Link devices
authorRoman Yeryomin <roman@advem.lv>
Fri, 4 May 2018 15:18:51 +0000 (18:18 +0300)
committerJohn Crispin <john@phrozen.org>
Sat, 5 May 2018 04:57:00 +0000 (06:57 +0200)
Since the D-Link devices boot from hard disk we need to
add the following changes to Gemini:

- Supply a bootarg in the device tree so we can boot from
  the right partition (/dev/sda4 on DNS-313)
- Disable forced command line in config so the kernel picks
  up the right bootargs from the device tree
- Enable EXT4 in the config as this is used for rootfs else
  we get nowhere, we cannot load this as a module because,
  well, it is supposed to be loaded from the root partition
  (chicken and egg problem).
- Enable jbd2 and mbcache (needed by ext4)

Also clean out the premature attempts to dynamically
modify the command line in the Image makefile: we should
pass this with the device tree bootargs instead, it works
much better.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Roman Yeryomin <roman@advem.lv>
target/linux/gemini/config-4.14
target/linux/gemini/image/Makefile
target/linux/gemini/patches-4.14/0033-ARM-dts-Fix-bootargs-for-Gemini-D-Link-devices.patch [new file with mode: 0644]

index 034bbcf6054a714e25f4ae280867a01c1a039b58..88ec795d22a1d5210bc74bef3de70c4aa00588c7 100644 (file)
@@ -56,7 +56,6 @@ CONFIG_CLKDEV_LOOKUP=y
 CONFIG_CLKSRC_MMIO=y
 CONFIG_CLONE_BACKWARDS=y
 CONFIG_CMDLINE="console=ttyS0,19200n8"
-CONFIG_CMDLINE_FORCE=y
 CONFIG_COMMON_CLK=y
 CONFIG_COMMON_CLK_GEMINI=y
 CONFIG_COMPACTION=y
@@ -153,6 +152,7 @@ CONFIG_ELF_CORE=y
 # CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_EXPERT is not set
 CONFIG_EXPORTFS=y
+CONFIG_EXT4_FS=y
 CONFIG_FARADAY_FTINTC010=y
 CONFIG_FHANDLE=y
 CONFIG_FIRMWARE_IN_KERNEL=y
@@ -160,6 +160,7 @@ CONFIG_FIXED_PHY=y
 CONFIG_FIX_EARLYCON_MEM=y
 # CONFIG_FPE_FASTFPE is not set
 # CONFIG_FPE_NWFPE is not set
+CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FTTMR010_TIMER=y
 CONFIG_FTWDT010_WATCHDOG=y
@@ -255,6 +256,7 @@ CONFIG_IRQ_DOMAIN=y
 CONFIG_IRQ_FORCED_THREADING=y
 CONFIG_IRQ_WORK=y
 # CONFIG_ISDN is not set
+CONFIG_JBD2=y
 CONFIG_KALLSYMS=y
 CONFIG_KERNEL_LZMA=y
 # CONFIG_KERNEL_XZ is not set
index dca3b63b19ce33b9d0e7d205a60b38143b259fcb..25371f6f13589ccab8fb7998d4747b2bcc86da71 100644 (file)
@@ -70,24 +70,20 @@ endef
 # of devices out of the box (former NAS42x0 IcyBox defaults)
 GEMINI_NAS_PACKAGES:=kmod-md-mod kmod-md-linear kmod-md-multipath \
                kmod-md-raid0 kmod-md-raid1 kmod-md-raid10 kmod-md-raid456 \
-               kmod-fs-btrfs kmod-fs-cifs kmod-fs-ext4 kmod-fs-nfs \
+               kmod-fs-btrfs kmod-fs-cifs kmod-fs-nfs \
                kmod-fs-nfsd kmod-fs-ntfs kmod-fs-reiserfs kmod-fs-vfat \
                kmod-nls-utf8 kmod-usb-storage-extras \
                samba36-server mdadm cfdisk fdisk e2fsprogs badblocks
 
-DIR685_CMDLINE:=-console=ttyS0,19200n8 root=/dev/sda1 rw rootwait
 define Device/dlink-dir-685
        DEVICE_TITLE := D-Link DIR-685 Xtreme N Storage Router
-       CMDLINE := $(DIR685_CMDLINE)
        DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) \
                        kmod-switch-rtl8366rb swconfig
 endef
 TARGET_DEVICES += dlink-dir-685
 
-DNS313_CMDLINE:=-console=ttyS0,19200n8 root=/dev/sda4 rw rootwait
 define Device/dlink-dns-313
        DEVICE_TITLE := D-Link DNS-313 1-Bay Network Storage Enclosure
-       CMDLINE := $(DNS313_CMDLINE)
        DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
        IMAGES += dns313-image
        IMAGE/dns313-image := dns313-images
@@ -108,10 +104,8 @@ define Device/rut1xx
 endef
 TARGET_DEVICES += rut1xx
 
-SQ201_CMDLINE:=-console=ttyS0,115200n8
 define Device/sq201
        DEVICE_TITLE := ITian Square One SQ201
-       CMDLINE := $(SQ201_CMDLINE)
        DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) rt61-pci-firmware
 endef
 TARGET_DEVICES += sq201
diff --git a/target/linux/gemini/patches-4.14/0033-ARM-dts-Fix-bootargs-for-Gemini-D-Link-devices.patch b/target/linux/gemini/patches-4.14/0033-ARM-dts-Fix-bootargs-for-Gemini-D-Link-devices.patch
new file mode 100644 (file)
index 0000000..f8cf123
--- /dev/null
@@ -0,0 +1,45 @@
+From 5813b729eb9fe91fcf895a5c2f30bf34fbd46379 Mon Sep 17 00:00:00 2001
+From: Linus Walleij <linus.walleij@linaro.org>
+Date: Wed, 2 May 2018 09:17:25 +0200
+Subject: [PATCH] ARM: dts: Fix bootargs for Gemini D-Link devices
+
+These machines need to be booted from very specific harddisk
+partitions (as the D-Link DNS-313 boots specifically from
+partition 4). Add the proper bootargs so that everything works
+smoothly.
+
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+---
+ arch/arm/boot/dts/gemini-dlink-dir-685.dts | 3 ++-
+ arch/arm/boot/dts/gemini-dlink-dns-313.dts | 1 +
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/gemini-dlink-dir-685.dts b/arch/arm/boot/dts/gemini-dlink-dir-685.dts
+index a39914dece98..840f4a32f37c 100644
+--- a/arch/arm/boot/dts/gemini-dlink-dir-685.dts
++++ b/arch/arm/boot/dts/gemini-dlink-dir-685.dts
+@@ -20,7 +20,8 @@
+       };
+       chosen {
+-              stdout-path = "uart0:115200n8";
++              bootargs = "console=ttyS0,19200n8 root=/dev/sda1 rw rootwait";
++              stdout-path = "uart0:19200n8";
+       };
+       gpio_keys {
+diff --git a/arch/arm/boot/dts/gemini-dlink-dns-313.dts b/arch/arm/boot/dts/gemini-dlink-dns-313.dts
+index 4904f1251671..685719a0b8c0 100644
+--- a/arch/arm/boot/dts/gemini-dlink-dns-313.dts
++++ b/arch/arm/boot/dts/gemini-dlink-dns-313.dts
+@@ -26,6 +26,7 @@
+       };
+       chosen {
++              bootargs = "console=ttyS0,19200n8 root=/dev/sda4 rw rootwait";
+               stdout-path = "uart0:19200n8";
+       };
+-- 
+2.14.3
+