Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
  • Loading branch information
danielg4 committed Sep 17, 2019
1 parent 852e1b0 commit cf6ccef
Show file tree
Hide file tree
Showing 12 changed files with 236 additions and 0 deletions.
2 changes: 2 additions & 0 deletions package/boot/uboot-envtools/files/ath79
Expand Up @@ -13,6 +13,8 @@ touch /etc/config/ubootenv
board=$(board_name)

case "$board" in
adtran,bsap1920|\
adtran,bsap1925|\
alfa-network,ap121f|\
buffalo,bhr-4grv2|\
engenius,ecb1750|\
Expand Down
2 changes: 2 additions & 0 deletions target/linux/ath79/base-files/etc/board.d/01_leds
Expand Up @@ -108,6 +108,8 @@ on,n150r)
ucidef_set_led_switch "lan1" "LAN1" "netgear:green:lan1" "switch0" "0x02" "0x0f"
ucidef_set_led_switch "lan2" "LAN2" "netgear:green:lan2" "switch0" "0x04" "0x0f"
;;
adtran,bsap1920|\
adtran,bsap1925|\
pcs,cap324)
ucidef_set_led_netdev "lan" "LAN" "senao:lan:green" "eth0"
;;
Expand Down
2 changes: 2 additions & 0 deletions target/linux/ath79/base-files/etc/board.d/02_network
Expand Up @@ -11,6 +11,8 @@ ath79_setup_interfaces()
case "$board" in
adtran,bsap1800-v2|\
adtran,bsap1840|\
adtran,bsap1920|\
adtran,bsap1925|\
alfa-network,ap121f|\
aruba,ap-105|\
avm,fritz300e|\
Expand Down
Expand Up @@ -158,6 +158,8 @@ case "$FIRMWARE" in
ath9k_eeprom_extract "art" 0x5000 0x440
ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_text "mac" 0x18) 1) 0x2
;;
adtran,bsap1920|\
adtran,bsap1925|\
ocedo,raccoon|\
tplink,tl-wdr3500-v1|\
tplink,tl-wdr3600-v1|\
Expand Down
4 changes: 4 additions & 0 deletions target/linux/ath79/base-files/etc/init.d/bootcount
Expand Up @@ -8,6 +8,10 @@ boot() {
adtran,bsap1840)
fconfig -s -w -d $(find_mtd_part "RedBoot config") -n boot_cntb -x 0
;;
adtran,bsap1920|\
adtran,bsap1925)
fw_setenv bootcnt 0
;;
qihoo,c301)
local n=$(fw_printenv activeregion | cut -d = -f 2)
fw_setenv "image${n}trynum" 0
Expand Down
16 changes: 16 additions & 0 deletions target/linux/ath79/base-files/lib/upgrade/platform.sh
Expand Up @@ -2,7 +2,11 @@
# Copyright (C) 2011 OpenWrt.org
#

. /lib/functions/system.sh

PART_NAME=firmware
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
RAMFS_COPY_BIN='nandwrite fw_printenv fw_setenv'
REQUIRE_IMAGE_METADATA=1

redboot_fis_do_upgrade() {
Expand Down Expand Up @@ -44,6 +48,18 @@ platform_do_upgrade() {
adtran,bsap1840)
redboot_fis_do_upgrade "$1" vmlinux_2
;;
adtran,bsap1920|\
adtran,bsap1925)
if [ $(grep -ow 'root=31:0[68]' /proc/cmdline) = "root=31:08" ]
then
PART_NAME=firmware1
fw_setenv boot_bank A
else
PART_NAME=firmware2
fw_setenv boot_bank B
fi
default_do_upgrade "$1"
;;
jjplus,ja76pf2)
redboot_fis_do_upgrade "$1" linux
;;
Expand Down
9 changes: 9 additions & 0 deletions target/linux/ath79/dts/ar9344_adtran_bsap1920.dts
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;

#include "ar9344_adtran_bsap192x.dtsi"

/ {
model = "Adtran Bluesocket BSAP-1920";
compatible = "adtran,bsap1920", "qca,ar9344";
};
9 changes: 9 additions & 0 deletions target/linux/ath79/dts/ar9344_adtran_bsap1925.dts
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;

#include "ar9344_adtran_bsap192x.dtsi"

/ {
model = "Adtran Bluesocket BSAP-1925";
compatible = "adtran,bsap1925", "qca,ar9344";
};
93 changes: 93 additions & 0 deletions target/linux/ath79/dts/ar9344_adtran_bsap192x.dtsi
@@ -0,0 +1,93 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;

#include "ar9344_senao_cap4200ag.dtsi"

/ {
chosen {
/delete-property/ bootargs;
bootargs-append = "root=";
};
};

&aliases {
label-mac-device = &eth0;
};

&partitions {
uboot: partition@0 {
label = "u-boot";
reg = <0x0000000 0x0040000>;
read-only;
};

partition@40000 {
label = "u-boot-env";
reg = <0x0040000 0x0010000>;
};

partition@50000 {
label = "Cert";
reg = <0x0050000 0x0040000>;
};

partition@90000 {
label = "Kdump";
reg = <0x0090000 0x0170000>;
};

partition@200000 {
label = "/var";
reg = <0x0200000 0x0100000>;
};

partition@300000 {
compatible = "denx,uimage";
active-if-supplied-root = "31:06";
label = "firmware1";
reg = <0x0300000 0x0d00000>;
};

partition@1000000 {
compatible = "denx,uimage";
active-if-supplied-root = "31:08";
label = "firmware2";
reg = <0x1000000 0x0d00000>;
};

partition@1d00000 {
label = "/home";
reg = <0x1d00000 0x0100000>;
};

partition@1e00000 {
label = "/log";
reg = <0x1e00000 0x0180000>;
};

senao: partition@1fe0000 {
label = "SENAO";
reg = <0x1fe0000 0x0010000>;
read-only;
};

art: partition@1ff0000 {
label = "art";
reg = <0x1ff0000 0x0010000>;
read-only;
};
};

&ath9k {
mtd-mac-address = <&senao 0x18>;
mtd-mac-address-increment = <1>;
};

&wmac {
mtd-mac-address = <&senao 0x18>;
mtd-mac-address-increment = <9>;
};

&eth0 {
mtd-mac-address = <&senao 0x18>;
};
18 changes: 18 additions & 0 deletions target/linux/ath79/image/generic.mk
Expand Up @@ -124,6 +124,24 @@ define Device/adtran_bsap1840
endef
TARGET_DEVICES += adtran_bsap1840

define Device/adtran_bsap192x
ATH_SOC := ar9344
DEVICE_VENDOR := Adtran
IMAGE_SIZE := 13312k
endef

define Device/adtran_bsap1920
$(Device/adtran_bsap192x)
DEVICE_MODEL := Bluesocket BSAP-1920
endef
TARGET_DEVICES += adtran_bsap1920

define Device/adtran_bsap1925
$(Device/adtran_bsap192x)
DEVICE_MODEL := Bluesocket BSAP-1925
endef
TARGET_DEVICES += adtran_bsap1925

define Device/alfa-network_ap121f
ATH_SOC := ar9331
DEVICE_VENDOR := ALFA Network
Expand Down
50 changes: 50 additions & 0 deletions target/linux/ath79/patches-4.19/997-device_tree_cmdline.patch
@@ -0,0 +1,50 @@
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1090,6 +1090,11 @@ int __init early_init_dt_scan_chosen(uns
p = of_get_flat_dt_prop(node, "bootargs", &l);
if (p != NULL && l > 0)
strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
+ p = of_get_flat_dt_prop(node, "bootargs-append", &l);
+ if (p != NULL && l > 0) {
+ strlcat(data, " ", COMMAND_LINE_SIZE);
+ strlcat(data, p, min(l + strlen(data), COMMAND_LINE_SIZE));
+ }

/*
* CONFIG_CMDLINE is meant to be a default in case nothing else
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -853,7 +853,10 @@ static void __init arch_mem_init(char **
* CONFIG_CMDLINE ourselves below & don't want to duplicate its
* content because repeating arguments can be problematic.
*/
- strlcpy(boot_command_line, " ", COMMAND_LINE_SIZE);
+ if (USE_DTB_CMDLINE)
+ strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE);
+ else
+ strlcpy(boot_command_line, " ", COMMAND_LINE_SIZE);

/* call board setup routine */
plat_mem_setup();
@@ -877,9 +880,10 @@ static void __init arch_mem_init(char **
#if defined(CONFIG_CMDLINE_BOOL) && defined(CONFIG_CMDLINE_OVERRIDE)
strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
#else
- if ((USE_PROM_CMDLINE && arcs_cmdline[0]) ||
- (USE_DTB_CMDLINE && !boot_command_line[0]))
+ if (USE_PROM_CMDLINE)
strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE);
+ else if (!strcmp(boot_command_line, " "))
+ boot_command_line[0] = '\0';

if (EXTEND_WITH_PROM && arcs_cmdline[0]) {
if (boot_command_line[0])
@@ -888,7 +892,7 @@ static void __init arch_mem_init(char **
}

#if defined(CONFIG_CMDLINE_BOOL)
- if (builtin_cmdline[0]) {
+ if (builtin_cmdline[0] && strcmp(boot_command_line, builtin_cmdline)) {
if (boot_command_line[0])
strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
strlcat(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
29 changes: 29 additions & 0 deletions target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c
Expand Up @@ -9,6 +9,9 @@

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <asm/setup.h>
#include <linux/ctype.h>
#include <linux/string.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
Expand Down Expand Up @@ -100,6 +103,32 @@ static int __mtdsplit_parse_uimage(struct mtd_info *master,
int extralen;
enum mtdsplit_part_type type;

const char *rarg = of_get_property(mtd_get_of_node(master),
"active-if-supplied-root", &ret);
if (rarg && ret > 0 && *rarg) {
const char *ind;

for (ind = strnstr
(boot_command_line, "root=", COMMAND_LINE_SIZE);
ind && ind != boot_command_line
&& !isspace(ind[-1]); ind = strnstr
(ind + 1, "root=", COMMAND_LINE_SIZE - (ind + 1
- boot_command_line)))
;
if (!ind)
return -ENODEV;
ind += 5;
for (offset = ind - boot_command_line;
offset < COMMAND_LINE_SIZE
&& boot_command_line[offset]
&& !isspace(boot_command_line[offset]);
++offset)
;
offset -= ind - boot_command_line;
if (offset != strnlen(rarg, ret) || memcmp(ind, rarg, offset))
return -ENODEV;
}

nr_parts = 2;
parts = kzalloc(nr_parts * sizeof(*parts), GFP_KERNEL);
if (!parts)
Expand Down

0 comments on commit cf6ccef

Please sign in to comment.