From f859237145bec9a09c6310c9cba7b68d555d74af Mon Sep 17 00:00:00 2001 From: Liangbin Lian Date: Wed, 24 Apr 2024 18:18:29 +0800 Subject: [PATCH 1/5] target/rk35xx: update board name --- target/linux/rockchip/rk35xx/target.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/rockchip/rk35xx/target.mk b/target/linux/rockchip/rk35xx/target.mk index f98667834f..8c374ed111 100644 --- a/target/linux/rockchip/rk35xx/target.mk +++ b/target/linux/rockchip/rk35xx/target.mk @@ -1,11 +1,11 @@ ARCH:=aarch64 CPU_TYPE:=cortex-a53 -BOARDNAME:=RK3568/RK3588 boards (64 bit) +BOARDNAME:=RK35xx boards (64 bit) FEATURES+=pwm DEFAULT_PACKAGES+=kmod-r8125 ethtool define Target/Description - Build firmware image for Rockchip RK3568/RK3588 devices. + Build firmware image for Rockchip RK3528/RK3566/RK3568/RK3588 devices. This firmware features a 64 bit kernel. endef From d2f84d49c2a9d6d23994244c32e5f1888df30389 Mon Sep 17 00:00:00 2001 From: Liangbin Lian Date: Wed, 24 Apr 2024 18:28:20 +0800 Subject: [PATCH 2/5] target/rk35xx: add armsom sige1 board SoC: RK3528 NICs: GMAC x 1, 2.5GbE x 1 WLAN: RTL8852BS (SDIO) Storage: eMMC x 1, microSD slot x 1 USB: USB 2.0 Type-A x 2, USB 2.0 Type-C x 1 Display: HDMI x 1 --- .../rockchip/dts/rk3528/rk3528-sige1.dts | 626 ++++++++++++++++++ target/linux/rockchip/image/rk35xx.mk | 9 + .../rk35xx/base-files/etc/board.d/02_network | 1 + .../rk35xx/base-files/lib/board/init.sh | 1 + 4 files changed, 637 insertions(+) create mode 100644 target/linux/rockchip/dts/rk3528/rk3528-sige1.dts diff --git a/target/linux/rockchip/dts/rk3528/rk3528-sige1.dts b/target/linux/rockchip/dts/rk3528/rk3528-sige1.dts new file mode 100644 index 0000000000..48a0ec2042 --- /dev/null +++ b/target/linux/rockchip/dts/rk3528/rk3528-sige1.dts @@ -0,0 +1,626 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2022 Rockchip Electronics Co., Ltd. + * + */ + +/dts-v1/; + +#include +#include +#include +#include "rk3528.dtsi" +#include "rk3528-linux.dtsi" + +/ { + model = "ArmSom RK3528 sige1 Board"; + compatible = "armsom,sige1-v1", "rockchip,rk3528"; + + aliases { + ethernet0 = &gmac1; + /delete-property/ ethernet1; + /* ethernet1 = &pcie-eth; */ + + mmc0 = &sdmmc; // sdcard + mmc1 = &sdhci; // emmc + mmc2 = &sdio0; // sdio + + led-boot = &led_red; + led-failsafe = &led_red; + led-running = &led_red; + led-upgrade = &led_red; + }; + + dc_12v: dc-12v { + compatible = "regulator-fixed"; + regulator-name = "dc_12v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + vcc5v0_sys: vcc5v0-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&dc_12v>; + }; + + /omit-if-no-ref/ + vccio_sd: vccio-sd { + compatible = "regulator-gpio"; + regulator-name = "vccio_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-ramp-delay = <1001>; + gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>; + vin-supply = <&vcc5v0_sys>; + states = <1800000 0x0 + 3300000 0x1>; + }; + + vdd_logic: vdd-logic { + compatible = "pwm-regulator"; + pwms = <&pwm2 0 5000 1>; + regulator-name = "vdd_logic"; + regulator-min-microvolt = <705000>; + regulator-max-microvolt = <1006000>; + regulator-init-microvolt = <900000>; + regulator-always-on; + regulator-boot-on; + regulator-ramp-delay = <6001>; + regulator-settling-time-up-us = <250>; + pwm-supply = <&vcc5v0_sys>; + status = "okay"; + }; + + vdd_cpu: vdd-cpu { + compatible = "pwm-regulator"; + pwms = <&pwm3 0 5000 1>; + regulator-name = "vdd_cpu"; + regulator-min-microvolt = <746000>; + regulator-max-microvolt = <1201000>; + regulator-init-microvolt = <953000>; + regulator-always-on; + regulator-boot-on; + regulator-ramp-delay = <6001>; + regulator-settling-time-up-us = <250>; + pwm-supply = <&vcc5v0_sys>; + status = "okay"; + }; + + vdd_0v9_s3: vdd-0v9-s3 { + compatible = "regulator-fixed"; + regulator-name = "vdd_0v9_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + vin-supply = <&vcc5v0_sys>; + }; + + vdd_1v8_s3: vdd-1v8-s3 { + compatible = "regulator-fixed"; + regulator-name = "vdd_1v8_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_3v3_s3: vcc-3v3-s3 { + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc5v0_sys>; + }; + + /omit-if-no-ref/ + vcc_sd: vcc-sd { + compatible = "regulator-fixed"; + gpio = <&gpio4 RK_PA1 GPIO_ACTIVE_LOW>; + regulator-name = "vcc_sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_3v3_s3>; + }; + + vcc_ddr_s3: vcc-ddr-s3 { + compatible = "regulator-fixed"; + regulator-name = "vcc_ddr_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + vin-supply = <&vcc5v0_sys>; + }; + + hdmi_sound: hdmi-sound { + compatible = "rockchip,hdmi"; + rockchip,mclk-fs = <128>; + rockchip,card-name = "rockchip,hdmi"; + rockchip,cpu = <&sai3>; + rockchip,codec = <&hdmi>; + rockchip,jack-det; + }; + + vcc_1v8_s0: vcc-1v8-s0 { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v8_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc5v0_sys>; + }; + + vdd_0v9_s0: vdd-0v9-s0 { + compatible = "regulator-fixed"; + regulator-name = "vdd_0v9_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_usb_host1: vcc5v0-usb-host1 { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb_host1"; + regulator-boot-on; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&gpio4 RK_PB1 GPIO_ACTIVE_HIGH>; + vin-supply = <&vcc5v0_sys>; + pinctrl-names = "default"; + pinctrl-0 = <&usb_host1_pwren>; + }; + + vcc5v0_usb_host2: vcc5v0-usb-host2 { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb_host2"; + regulator-boot-on; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; + vin-supply = <&vcc5v0_sys>; + pinctrl-names = "default"; + pinctrl-0 = <&usb_host2_pwren>; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h &clkm1_32k_out>; + reset-gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; + }; + + wireless_bluetooth: wireless-bluetooth { + compatible = "bluetooth-platdata"; + //wifi-bt-power-toggle; + uart_rts_gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_LOW>; + pinctrl-names = "default", "rts_gpio"; + pinctrl-0 = <&uart2m1_rtsn>; + pinctrl-1 = <&uart2m1_rts_gpio>; + BT,power_gpio = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>; + //BT,wake_host_irq = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; + + wireless_wlan: wireless-wlan { + compatible = "wlan-platdata"; + rockchip,grf = <&grf>; + wifi_chip_type = "rtl8852bs"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake_irq>; + //WIFI,poweren_gpio = <&gpio1 RK_PA6 GPIO_ACTIVE_HIGH>; + WIFI,host_wake_irq = <&gpio1 RK_PA7 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = + <&led_red_en>, + <&led_green_en>; + + led_red: led-red { + gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_HIGH>; + label = "red:sys"; + linux,default-trigger = "heartbeat"; + }; + led-green { + gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_HIGH>; + label = "green:user"; + }; + }; +}; + +&acodec { + pa-ctl-gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +&avsd { + status = "okay"; +}; + +&combphy_pu { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&crypto { + status = "okay"; +}; + +&dfi { + status = "okay"; +}; + +&display_subsystem { + status = "okay"; +}; + +&dmc { + center-supply = <&vdd_logic>; + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_logic>; + status = "okay"; +}; + +&gpu_bus { + bus-supply = <&vdd_logic>; + status = "okay"; +}; + +&hdmi { + status = "okay"; +}; + +&hdmi_in_vp0 { + status = "okay"; +}; + +&hdmiphy { + status = "okay"; +}; + +&iep { + status = "okay"; +}; + +&iep_mmu { + status = "okay"; +}; + +&jpegd { + status = "okay"; +}; + +&jpegd_mmu { + status = "okay"; +}; + +&mpp_srv { + status = "okay"; +}; + +&pwm2 { + status = "okay"; +}; + +&pwm3 { + status = "okay"; +}; + +&rga2 { + status = "okay"; +}; + +&rga2_mmu { + status = "okay"; +}; + +&rkvdec { + status = "okay"; +}; + +&rkvdec_mmu { + status = "okay"; +}; + +&rkvenc { + status = "okay"; +}; + +&rkvenc_mmu { + status = "okay"; +}; + +&rkvtunnel { + status = "okay"; +}; + +&sai3 { + status = "okay"; +}; + +&saradc { + status = "okay"; + vref-supply = <&vdd_1v8_s3>; +}; + +&sdhci { + bus-width = <8>; + no-sd; + no-sdio; + non-removable; + mmc-hs400-1_8v; + mmc-hs400-enhanced-strobe; + max-frequency = <200000000>; + status = "okay"; +}; + +&sai0 { + pinctrl-0 = <&i2s0m1_lrck &i2s0m1_sclk &i2s0m1_sdi &i2s0m1_sdo>; + status = "disabled"; +}; + +&sdio0 { + max-frequency = <200000000>; + no-sd; + no-mmc; + supports-sdio; + bus-width = <4>; + disable-wp; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + non-removable; + mmc-pwrseq = <&sdio_pwrseq>; + pinctrl-names = "default"; + pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; + sd-uhs-sdr104; + status = "okay"; +}; + +&sfc { + status = "okay"; +}; + +&spdif_8ch { + status = "disabled"; +}; + +&tsadc { + status = "okay"; +}; + +&tve { + status = "disabled"; +}; + +&tve_in_vp1 { + status = "disabled"; +}; + + +&uart2 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&uart2m1_xfer &uart2m1_ctsn>; +}; + +&gmac1 { + /* Use rgmii-rxid mode to disable rx delay inside Soc */ + phy-mode = "rgmii-rxid"; + clock_in_out = "output"; + + snps,reset-gpio = <&gpio4 RK_PB5 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + /* Reset time is 20ms, 100ms for rtl8211f */ + snps,reset-delays-us = <0 20000 100000>; + + tx_delay = <0x30>; + /* rx_delay = <0x3f>; */ + + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_miim + &rgmii_tx_bus2 + &rgmii_rx_bus2 + &rgmii_rgmii_clk + &rgmii_rgmii_bus + ð_pins>; + + phy-handle = <&rgmii_phy>; + status = "okay"; +}; + + +&mdio1 { + rgmii_phy: phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x1>; + }; +}; + +&combphy_pu { + rockchip,dis-u3otg0-port; /* disable USB3.0 */ +}; + +&pcie2x1 { + reset-gpios = <&gpio4 RK_PA4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_perst>; + status = "okay"; +}; + +&i2c0 { + status = "okay"; + hym8563: hym8563@51 { + compatible = "haoyu,hym8563"; + reg = <0x51>; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "hym8563"; + pinctrl-names = "default"; + pinctrl-0 = <&hym8563_int>; + interrupt-parent = <&gpio4>; + interrupts = ; + }; +}; + + +&pinctrl { + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wireless-wlan { + wifi_perst: wifi-perst { + rockchip,pins = <4 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + wifi_poweren_gpio: wifi-poweren-gpio { + rockchip,pins = <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + wifi_host_wake_irq: wifi-host-wake-irq { + rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + wireless-bluetooth { + uart2m1_rts_gpio: uart2m1-rts-gpio { + rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + hym8563 { + hym8563_int: hym8563-int { + rockchip,pins = <4 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + usb { + usb_host1_pwren: usb-host1-pwren { + rockchip,pins = <4 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + usb_host2_pwren: usb-host2-pwren { + rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + fan { + fan_en: fan-en { + rockchip,pins = <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + led { + led_red_en: led-red-en { + rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + led_green_en: led-green-en { + rockchip,pins = <3 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&sdmmc { + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_det &sdmmc_bus4>; + rockchip,default-sample-phase = <90>; + supports-sd; + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vqmmc-supply = <&vccio_sd>; + vmmc-supply = <&vcc_sd>; + status = "okay"; +}; + +&usb2phy { + status = "okay"; +}; + +&u2phy_host { + status = "okay"; + phy-supply = <&vcc5v0_sys>; +}; + +&u2phy_otg { + status = "okay"; + vbus-supply = <&vcc5v0_sys>; +}; + +&usbdrd30 { + status = "okay"; +}; + +&usbdrd_dwc3 { + // Only USB2.0 START + extcon = <&usb2phy>; + phys = <&u2phy_otg>; + phy-names = "usb2-phy"; + maximum-speed = "high-speed"; + snps,dis_u2_susphy_quirk; + // Only USB2.0 END + snps,usb2-lpm-disable; + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&rng { + status = "okay"; +}; + +&vdpp { + status = "okay"; +}; + +&vdpu { + status = "okay"; +}; + +&vdpu_mmu { + status = "okay"; +}; + +&vop { + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; diff --git a/target/linux/rockchip/image/rk35xx.mk b/target/linux/rockchip/image/rk35xx.mk index 18bef4a867..766385d7fb 100644 --- a/target/linux/rockchip/image/rk35xx.mk +++ b/target/linux/rockchip/image/rk35xx.mk @@ -67,6 +67,15 @@ $(call Device/rk3568) SOC := rk3566 endef +define Device/armsom_sige1 +$(call Device/rk3528) + DEVICE_VENDOR := ArmSoM + DEVICE_MODEL := sige1 + SUPPORTED_DEVICES += armsom,sige1 armsom,sige1-v1 armsom,sige1-v1.0 + DEVICE_PACKAGES := kmod-r8125 kmod-thermal +endef +TARGET_DEVICES += armsom_sige1 + define Device/armsom_sige7-v1 $(call Device/rk3588) DEVICE_VENDOR := ArmSoM diff --git a/target/linux/rockchip/rk35xx/base-files/etc/board.d/02_network b/target/linux/rockchip/rk35xx/base-files/etc/board.d/02_network index 13e6af417a..deb6ab8a7e 100755 --- a/target/linux/rockchip/rk35xx/base-files/etc/board.d/02_network +++ b/target/linux/rockchip/rk35xx/base-files/etc/board.d/02_network @@ -11,6 +11,7 @@ rockchip_setup_interfaces() local board="$1" case "$board" in + armsom,sige1-v1|\ armsom,sige7-v1|\ easepi,ars4|\ friendlyelec,nanopi-r5c|\ diff --git a/target/linux/rockchip/rk35xx/base-files/lib/board/init.sh b/target/linux/rockchip/rk35xx/base-files/lib/board/init.sh index 4169b0e586..b99dd4f3f0 100755 --- a/target/linux/rockchip/rk35xx/base-files/lib/board/init.sh +++ b/target/linux/rockchip/rk35xx/base-files/lib/board/init.sh @@ -170,6 +170,7 @@ board_set_iface_smp_affinity() { set_iface_cpumask 2 eth0 set_iface_cpumask 4 eth1 ;; + armsom,sige1-v1|\ hinlink,opc-h69k|\ friendlyelec,nanopi-r5s|friendlyelec,nanopi-r5s-c1) set_iface_cpumask 2 eth0 From 772c5dd83088ff0fbd745a57fd8ad7203b141dd9 Mon Sep 17 00:00:00 2001 From: Liangbin Lian Date: Wed, 24 Apr 2024 19:13:58 +0800 Subject: [PATCH 3/5] target/rk35xx: armsom sige1 disable dmc --- target/linux/rockchip/dts/rk3528/rk3528-sige1.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/rockchip/dts/rk3528/rk3528-sige1.dts b/target/linux/rockchip/dts/rk3528/rk3528-sige1.dts index 48a0ec2042..3a93f2873b 100644 --- a/target/linux/rockchip/dts/rk3528/rk3528-sige1.dts +++ b/target/linux/rockchip/dts/rk3528/rk3528-sige1.dts @@ -271,7 +271,7 @@ }; &dfi { - status = "okay"; + status = "disabled"; }; &display_subsystem { @@ -280,7 +280,7 @@ &dmc { center-supply = <&vdd_logic>; - status = "okay"; + status = "disabled"; }; &gpu { From 894f6f50db78e802caaddf5f0aa51be787eb03ae Mon Sep 17 00:00:00 2001 From: Liangbin Lian Date: Wed, 24 Apr 2024 20:21:32 +0800 Subject: [PATCH 4/5] target/rk35xx: armsom sige1 fix vccio_sd gpio --- target/linux/rockchip/dts/rk3528/rk3528-sige1.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/rockchip/dts/rk3528/rk3528-sige1.dts b/target/linux/rockchip/dts/rk3528/rk3528-sige1.dts index 3a93f2873b..a1a81858ac 100644 --- a/target/linux/rockchip/dts/rk3528/rk3528-sige1.dts +++ b/target/linux/rockchip/dts/rk3528/rk3528-sige1.dts @@ -57,7 +57,7 @@ regulator-min-microvolt = <1800000>; regulator-max-microvolt = <3300000>; regulator-ramp-delay = <1001>; - gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>; + gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>; vin-supply = <&vcc5v0_sys>; states = <1800000 0x0 3300000 0x1>; From 241801ea658041b33b2af0dd403bb2a99fc6ebfc Mon Sep 17 00:00:00 2001 From: Liangbin Lian Date: Thu, 25 Apr 2024 16:32:09 +0800 Subject: [PATCH 5/5] istoreos: blockmount use busybox grep and sed avoid unexpected result --- .../files/usr/libexec/blockphy.sh | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/package/istoreos-files/files/usr/libexec/blockphy.sh b/package/istoreos-files/files/usr/libexec/blockphy.sh index 3290860de3..d665adee81 100755 --- a/package/istoreos-files/files/usr/libexec/blockphy.sh +++ b/package/istoreos-files/files/usr/libexec/blockphy.sh @@ -6,16 +6,16 @@ DEVNAME=${1#/dev/} getdisk() { local DISK=$1 local path=`readlink /sys/block/$DISK` - local usb=`echo "$path" | grep -oE '/usb\d+/[^:]+'` + local usb=`echo "$path" | busybox grep -oE '/usb\d+/[^:]+'` if [ -n "$usb" ]; then usb=${usb##*/} usb=${usb%%-1} - echo usb`echo "$usb" | sed 's/[-.]/_/g'` + echo usb`echo "$usb" | busybox sed 's/[-.]/_/g'` return 0 fi case "$DISK" in mmcblk*) - echo "$path" | grep -oE '/mmc\d+/' + echo "$path" | busybox grep -oE '/mmc\d+/' return 0 ;; nvme*) @@ -24,38 +24,38 @@ getdisk() { ;; esac # sata - local sata=`echo "$path" | grep -oE '/ata\d+/host\d+/target\d+:\d+'` + local sata=`echo "$path" | busybox grep -oE '/ata\d+/host\d+/target\d+:\d+'` if [ -n "$sata" ]; then - sata=`echo "$sata" | sed -r 's#/ata(\d+)/host\d+/target\d+:(\d+)#sata\1.\2#'` + sata=`echo "$sata" | busybox sed -r 's#/ata(\d+)/host\d+/target\d+:(\d+)#sata\1.\2#'` sata=${sata%%.0} echo "/$sata/" return 0 fi # virtio - sata=`echo "$path" | grep -oE '/virtio\d+/host\d+/target\d+:\d+:\d+'` + sata=`echo "$path" | busybox grep -oE '/virtio\d+/host\d+/target\d+:\d+:\d+'` if [ -n "$sata" ]; then - sata=`echo "$sata" | sed -r 's#/virtio(\d+)/host\d+/target\d+:\d+:(\d+)#vio\1.\2#'` + sata=`echo "$sata" | busybox sed -r 's#/virtio(\d+)/host\d+/target\d+:\d+:(\d+)#vio\1.\2#'` sata=${sata%%.0} echo "/$sata/" return 0 fi # sas - sata=`echo "$path" | grep -oE '/host\d+/port-\d+:\d+'` + sata=`echo "$path" | busybox grep -oE '/host\d+/port-\d+:\d+'` if [ -n "$sata" ]; then - sata=`echo "$sata" | sed -r 's#/host(\d+)/port-\d+:(\d+)#sas\1.\2#'` + sata=`echo "$sata" | busybox sed -r 's#/host(\d+)/port-\d+:(\d+)#sas\1.\2#'` sata=${sata%%.0} echo "/$sata/" return 0 fi # scsi - sata=`echo "$path" | grep -oE '/host\d+/target\d+:\d+:\d+'` + sata=`echo "$path" | busybox grep -oE '/host\d+/target\d+:\d+:\d+'` if [ -n "$sata" ]; then - sata=`echo "$sata" | sed -r 's#/host(\d+)/target\d+:\d+:(\d+)#scsi\1.\2#'` + sata=`echo "$sata" | busybox sed -r 's#/host(\d+)/target\d+:\d+:(\d+)#scsi\1.\2#'` sata=${sata%%.0} echo "/$sata/" return 0 fi - echo "$path" | grep -oE '/host\d+/' | sed 's/host/sata/g' + echo "$path" | busybox grep -oE '/host\d+/' | busybox sed 's/host/sata/g' return 0 } @@ -72,11 +72,11 @@ getphy() { case "$DEVNAME" in sd*) - getphy `echo "$DEVNAME" | sed -r 's/^(sd[a-z]+)([0-9]+)?$/\1 \2/g'` ;; + getphy `echo "$DEVNAME" | busybox sed -r 's/^(sd[a-z]+)([0-9]+)?$/\1 \2/g'` ;; mmcblk*) - getphy `echo "$DEVNAME" | sed -r 's/^(mmcblk[0-9]+)(p([0-9]+))?$/\1 \3/g'` ;; + getphy `echo "$DEVNAME" | busybox sed -r 's/^(mmcblk[0-9]+)(p([0-9]+))?$/\1 \3/g'` ;; nvme*) - getphy `echo "$DEVNAME" | sed -r 's/^(nvme[0-9]+n[0-9]+)(p([0-9]+))?$/\1 \3/g'` ;; + getphy `echo "$DEVNAME" | busybox sed -r 's/^(nvme[0-9]+n[0-9]+)(p([0-9]+))?$/\1 \3/g'` ;; *) exit 1; esac