Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mx4300 bootargs patch #2

Merged
merged 1 commit into from
Aug 4, 2024

Conversation

asd333111
Copy link

A patch that can search the original command line and replace it if it matches the key.

find-rootblock = "ubi.mtd=";
bootargs-append = "";
bootargs-match-key-1 = "ubi.mtd=22,2048";
bootargs-sel-1 = "rootfstype=squashfs ubi.mtd=22,4096 ubi.block=0,0 root=/dev/ubiblock0_0 rootwait ro";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think replacing the entire bootargs command is not a good idea.
It will overwrite any changes you made manually.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can change the match-key to the full boot command passed by the vanilla u-boot config. If the user changed the bootargs in u-boot, then it won't match, and thus replacement won't happen.

In my thought, there are two cases.

  1. The user doesn't modify the bootargs in u-boot.
  2. The user changed the bootargs manually.

In case 1, I think a full replacement is appropriate. In case 2, we can assume the user knows what they are doing. We just leave the boot command as it is.

@asd333111 asd333111 force-pushed the mx4300-bootargs-patch branch 2 times, most recently from 4328963 to 943ecb4 Compare August 3, 2024 10:30
@testuser7 testuser7 force-pushed the mx4300 branch 2 times, most recently from 018877d to d42bf52 Compare August 3, 2024 12:05
@asd333111 asd333111 force-pushed the mx4300-bootargs-patch branch from 943ecb4 to 5a5dd45 Compare August 3, 2024 17:29
@asd333111 asd333111 force-pushed the mx4300-bootargs-patch branch 5 times, most recently from ee6aa76 to bf70df2 Compare August 3, 2024 21:09
@asd333111
Copy link
Author

asd333111 commented Aug 3, 2024

Rebased and

  1. Added back init=/sbin/init to kernel command line.
  2. Added "bootargs-exact-match". When exact match is set, replacement only happens when the command line is identical to "bootargs-find". Now it won't modify the command line that has been edited by the user.
  3. Moved the patch from generic to qualcommax to avoid breaking other platforms' patches.

@asd333111 asd333111 force-pushed the mx4300-bootargs-patch branch 3 times, most recently from d89569f to ed9f006 Compare August 3, 2024 21:27
@asd333111
Copy link
Author

I think this commit now satisfies OpenWrt's commit guideline. Let me know if there are any other problems.

@asd333111 asd333111 force-pushed the mx4300-bootargs-patch branch from ed9f006 to 3cae3ad Compare August 3, 2024 21:32
@testuser7
Copy link
Owner

Thanks for your changes.

In the case of bootargs, the last occurrence of the variable is taken into account.
I still think a better option would be:

  1. Find the partition number (like in find-rootblock)
  2. Append ubi.mtd=XX,4096 at the end with the actual partition number

@asd333111
Copy link
Author

I did try that with bootargs-append before, and I recall that the OS will try to attach both ubi.
Let me test it once more, so I can tell you a concrete answer.

@asd333111
Copy link
Author

I can confirm that the OS will try to attach both.

`
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[ 0.000000] Linux version 6.6.43 (shaoyu@PLDI) (aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 13.3.0 r27000-b009b16094) 13.3.0, GNU ld (GNU Binutils) 2.42) #0 SMP Sat Aug 3 21:00:07 2024
[ 0.000000] Machine model: Linksys MX4300
[ 0.000000] OF: reserved mem: 0x0000000040000000..0x0000000040ffffff (16384 KiB) nomap non-reusable nss@40000000
[ 0.000000] OF: reserved mem: 0x000000004a400000..0x000000004a5fffff (2048 KiB) nomap non-reusable tzapp@4a400000
[ 0.000000] OF: reserved mem: 0x000000004a600000..0x000000004a9fffff (4096 KiB) nomap non-reusable bootloader@4a600000
[ 0.000000] OF: reserved mem: 0x000000004aa00000..0x000000004aafffff (1024 KiB) nomap non-reusable sbl@4aa00000
[ 0.000000] OF: reserved mem: 0x000000004ab00000..0x000000004abfffff (1024 KiB) nomap non-reusable smem@4ab00000
[ 0.000000] OF: reserved mem: 0x000000004ac00000..0x000000004affffff (4096 KiB) nomap non-reusable memory@4ac00000
[ 0.000000] OF: reserved mem: 0x000000004b000000..0x0000000050efffff (97280 KiB) nomap non-reusable wcnss@4b000000
[ 0.000000] OF: reserved mem: 0x0000000050f00000..0x0000000050ffffff (1024 KiB) nomap non-reusable q6_etr_dump@50f00000
[ 0.000000] OF: reserved mem: 0x0000000051000000..0x00000000510fffff (1024 KiB) nomap non-reusable m3_dump@51000000
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x0000000040000000-0x00000000bfffffff]
[ 0.000000] DMA32 empty
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000040000000-0x0000000040ffffff]
[ 0.000000] node 0: [mem 0x0000000041000000-0x000000004a3fffff]
[ 0.000000] node 0: [mem 0x000000004a400000-0x00000000510fffff]
[ 0.000000] node 0: [mem 0x0000000051100000-0x00000000bfffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x00000000bfffffff]
[ 0.000000] psci: probing for conduit method from DT.
[ 0.000000] psci: PSCIv1.0 detected in firmware.
[ 0.000000] psci: Using standard PSCI v0.2 function IDs
[ 0.000000] psci: MIGRATE_INFO_TYPE not supported.
[ 0.000000] psci: SMC Calling Convention v1.0
[ 0.000000] percpu: Embedded 18 pages/cpu s35240 r8192 d30296 u73728
[ 0.000000] pcpu-alloc: s35240 r8192 d30296 u73728 alloc=184096
[ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[ 0.000000] Detected VIPT I-cache on CPU0
[ 0.000000] alternatives: applying boot alternatives
[ 0.000000] Kernel command line: init=/sbin/init rootfstype=squashfs ubi.mtd=24,4096 ubi.block=0,0 root=/dev/ubiblock0_0 rootwait ro ubi.mtd=22,4096
[ 0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 516096
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] software IO TLB: SWIOTLB bounce buffer size adjusted to 2MB
[ 0.000000] software IO TLB: area num 4.
[ 0.000000] software IO TLB: mapped [mem 0x00000000bd600000-0x00000000bd800000] (2MB)
[ 0.000000] Memory: 1913324K/2097152K available (8128K kernel code, 892K rwdata, 2476K rodata, 1472K init, 276K bss, 183828K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] Tracing variant of Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] Root IRQ handler: gic_handle_irq
[ 0.000000] GICv2m: range[mem 0x0b00a000-0x0b00affc], SPI[448:479]
[ 0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[ 0.000000] arch_timer: cp15 and mmio timer(s) running at 19.20MHz (virt/virt).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[ 0.000001] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[ 0.000103] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[ 0.000116] pid_max: default: 32768 minimum: 301
[ 0.005158] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes, linear)
[ 0.005175] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes, linear)
[ 0.009425] RCU Tasks Trace: Setting shift to 2 and lim to 1 rcu_task_cb_adjust=1.
[ 0.009652] rcu: Hierarchical SRCU implementation.
[ 0.009657] rcu: Max phase no-delay instances is 1000.
[ 0.010595] smp: Bringing up secondary CPUs ...
[ 0.011265] Detected VIPT I-cache on CPU1
[ 0.011368] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[ 0.012045] Detected VIPT I-cache on CPU2
[ 0.012114] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[ 0.012764] Detected VIPT I-cache on CPU3
[ 0.012831] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[ 0.012895] smp: Brought up 1 node, 4 CPUs
[ 0.012903] SMP: Total of 4 processors activated.
[ 0.012909] CPU features: detected: 32-bit EL0 Support
[ 0.012913] CPU features: detected: CRC32 instructions
[ 0.012982] CPU features: emulated: Privileged Access Never (PAN) using TTBR0_EL1 switching
[ 0.012990] CPU: All CPU(s) started at EL1
[ 0.012993] alternatives: applying system-wide alternatives
[ 0.023482] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.023507] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[ 0.025235] pinctrl core: initialized pinctrl subsystem
[ 0.026955] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[ 0.027564] DMA: preallocated 256 KiB GFP_KERNEL pool for atomic allocations
[ 0.027619] DMA: preallocated 256 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[ 0.027670] DMA: preallocated 256 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[ 0.028057] thermal_sys: Registered thermal governor 'step_wise'
[ 0.028116] cpuidle: using governor menu
[ 0.028341] ASID allocator initialised with 65536 entries
[ 0.054870] qcom,cpr4-apss-regulator b018000.cpr4-ctrl: CPR valid fuse count: 4
[ 0.056794] Modules: 29408 pages in range for non-PLT usage
[ 0.056803] Modules: 520928 pages in range for PLT usage
[ 0.061669] SCSI subsystem initialized
[ 0.061860] usbcore: registered new interface driver usbfs
[ 0.061895] usbcore: registered new interface driver hub
[ 0.061957] usbcore: registered new device driver usb
[ 0.062368] qcom_scm: convention: smc arm 64
[ 0.064081] clocksource: Switched to clocksource arch_sys_counter
[ 0.067826] NET: Registered PF_INET protocol family
[ 0.068015] IP idents hash table entries: 32768 (order: 6, 262144 bytes, linear)
[ 0.071531] tcp_listen_portaddr_hash hash table entries: 1024 (order: 2, 16384 bytes, linear)
[ 0.071563] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.071578] TCP established hash table entries: 16384 (order: 5, 131072 bytes, linear)
[ 0.071739] TCP bind hash table entries: 16384 (order: 7, 524288 bytes, linear)
[ 0.072284] TCP: Hash tables configured (established 16384 bind 16384)
[ 0.072401] UDP hash table entries: 1024 (order: 3, 32768 bytes, linear)
[ 0.072468] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes, linear)
[ 0.072952] NET: Registered PF_UNIX/PF_LOCAL protocol family
[ 0.073010] PCI: CLS 0 bytes, default 64
[ 0.074729] workingset: timestamp_bits=46 max_order=19 bucket_order=0
[ 0.075324] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.075331] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 0.081576] qcom-qmp-usb-phy 78000.phy: supply vdda-phy not found, using dummy regulator
[ 0.081747] qcom-qmp-usb-phy 78000.phy: supply vdda-pll not found, using dummy regulator
[ 0.082963] qcom-qusb2-phy 79000.phy: supply vdd not found, using dummy regulator
[ 0.083116] qcom-qusb2-phy 79000.phy: supply vdda-pll not found, using dummy regulator
[ 0.083157] qcom-qusb2-phy 79000.phy: supply vdda-phy-dpdm not found, using dummy regulator
[ 0.083348] qcom-qusb2-phy 79000.phy: Registered Qcom-QUSB2 phy
[ 0.091753] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[ 0.092927] msm_serial 78b1000.serial: msm_serial: detected port #1
[ 0.092966] msm_serial 78b1000.serial: uartclk = 19200000
[ 0.093294] 78b1000.serial: ttyMSM1 at MMIO 0x78b1000 (irq = 20, base_baud = 1200000) is a MSM
[ 0.093750] msm_serial 78b3000.serial: msm_serial: detected port #0
[ 0.093781] msm_serial 78b3000.serial: uartclk = 3686400
[ 0.094129] 78b3000.serial: ttyMSM0 at MMIO 0x78b3000 (irq = 21, base_baud = 230400) is a MSM
[ 0.094159] msm_serial: console setup on port #0
[ 0.094201] printk: console [ttyMSM0] enabled
[ 0.879889] msm_serial: driver initialized
[ 0.889043] loop: module loaded
[ 0.890467] nand: device found, Manufacturer ID: 0x01, Chip ID: 0xa3
[ 0.890999] nand: AMD/Spansion S34MS08G2
[ 0.897616] nand: 1024 MiB, SLC, erase size: 256 KiB, page size: 4096, OOB size: 256
[ 0.901865] 32 fixed-partitions partitions found on MTD device qcom_nand.0
[ 0.909261] Creating 32 MTD partitions on "qcom_nand.0":
[ 0.915973] 0x000000000000-0x000000100000 : "0:sbl1"
[ 0.922523] 0x000000100000-0x000000200000 : "0:mibib"
[ 0.927380] 0x000000200000-0x000000280000 : "0:bootconfig"
[ 0.932011] 0x000000280000-0x000000300000 : "0:bootconfig1"
[ 0.937550] 0x000000300000-0x000000600000 : "0:qsee"
[ 0.944053] 0x000000600000-0x000000900000 : "0:qsee_1"
[ 0.949235] 0x000000900000-0x000000980000 : "0:devcfg"
[ 0.953006] 0x000000980000-0x000000a00000 : "0:devcfg_1"
[ 0.958163] 0x000000a00000-0x000000a80000 : "0:apdp"
[ 0.963583] 0x000000a80000-0x000000b00000 : "0:apdp_1"
[ 0.968586] 0x000000b00000-0x000000b80000 : "0:rpm"
[ 0.973466] 0x000000b80000-0x000000c00000 : "0:rpm_1"
[ 0.978282] 0x000000c00000-0x000000c80000 : "0:cdt"
[ 0.983539] 0x000000c80000-0x000000d00000 : "0:cdt_1"
[ 0.988271] 0x000000d00000-0x000000d80000 : "0:appsblenv"
[ 0.993375] 0x000000d80000-0x000000e80000 : "0:appsbl"
[ 0.999055] 0x000000e80000-0x000000f80000 : "0:appsbl_1"
[ 1.004048] 0x000000f80000-0x000001000000 : "0:art"
[ 1.009309] 0x000001000000-0x000001100000 : "u_env"
[ 1.014118] 0x000001100000-0x000001200000 : "s_env"
[ 1.018968] 0x000001200000-0x000001240000 : "devinfo"
[ 1.023458] 0x000001240000-0x00000c180000 : "kernel"
[ 1.112244] 0x000001a40000-0x00000c180000 : "rootfs"
[ 1.192633] mtd: setting mtd22 (rootfs) as root device
[ 1.193254] mtdsplit: no squashfs found in "rootfs"
[ 1.196699] 0x00000c180000-0x0000170c0000 : "alt_kernel"
[ 1.285549] 0x00000c980000-0x0000170c0000 : "alt_rootfs"
[ 1.365921] 0x0000170c0000-0x0000174c0000 : "sysdiag"
[ 1.368391] 0x0000174c0000-0x000017540000 : "0:ethphyfw"
[ 1.370681] 0x000017540000-0x00001ef00000 : "syscfg"
[ 1.433946] 0x00001ef00000-0x00001f300000 : "secured_store"
[ 1.436443] 0x00001f300000-0x000020c00000 : "0:wififw"
[ 1.450803] 0x000020c00000-0x000036d80000 : "app2_data"
[ 1.619773] 0x000036d80000-0x000040000000 : "app2"
[ 1.701500] spmi spmi-0: PMIC arbiter version v2 (0x20010000)
[ 1.720147] i2c_dev: i2c /dev entries driver
[ 1.727502] sdhci: Secure Digital Host Controller Interface driver
[ 1.727542] sdhci: Copyright(c) Pierre Ossman
[ 1.732577] sdhci-pltfm: SDHCI platform and OF driver helper
[ 1.738859] remoteproc remoteproc0: releasing cd00000.q6v5_wcss
[ 1.745540] NET: Registered PF_INET6 protocol family
[ 1.749260] Segment Routing with IPv6
[ 1.753609] In-situ OAM (IOAM) with IPv6
[ 1.757269] NET: Registered PF_PACKET protocol family
[ 1.761312] 8021q: 802.1Q VLAN Support v1.8
[ 1.794571] qcom,cpr4-apss-regulator b018000.cpr4-ctrl: CPR valid fuse count: 4
[ 1.794897] cpr4_ipq807x_apss_read_fuse_data: apc_corner: speed bin = 0
[ 1.800699] cpr4_ipq807x_apss_read_fuse_data: apc_corner: CPR fusing revision = 1
[ 1.807332] cpr4_ipq807x_apss_read_fuse_data: apc_corner: CPR misc fuse value = 0
[ 1.814974] cpr4_ipq807x_apss_read_fuse_data: apc_corner: Voltage boost fuse config = 0 boost = disable
[ 1.822469] cpr3_mem_acc_init: apc: not using memory accelerator regulator
[ 1.831609] cpr4_ipq807x_apss_calculate_open_loop_voltages: apc_corner: fused SVS: open-loop= 704000 uV
[ 1.838558] cpr4_ipq807x_apss_calculate_open_loop_voltages: apc_corner: fused NOM: open-loop= 808000 uV
[ 1.848539] cpr4_ipq807x_apss_calculate_open_loop_voltages: apc_corner: fused TURBO: open-loop= 872000 uV
[ 1.858349] cpr4_ipq807x_apss_calculate_open_loop_voltages: apc_corner: fused STURBO: open-loop= 952000 uV
[ 1.868208] cpr4_ipq807x_apss_calculate_target_quotients: apc_corner: fused SVS: quot[ 7]= 744, quot_offset[ 7]= 0
[ 1.877975] cpr4_ipq807x_apss_calculate_target_quotients: apc_corner: fused NOM: quot[ 7]= 943, quot_offset[ 7]= 195
[ 1.888819] cpr4_ipq807x_apss_calculate_target_quotients: apc_corner: fused TURBO: quot[ 7]=1055, quot_offset[ 7]= 110
[ 1.899758] cpr4_ipq807x_apss_calculate_target_quotients: apc_corner: fused STURBO: quot[ 7]=1204, quot_offset[ 7]= 145
[ 1.910921] cpr3_regulator_init_ctrl: apc: Default CPR mode = closed-loop
[ 1.913624] cpufreq: cpufreq_online: CPU0: Running at unlisted initial frequency: 800000 KHz, changing to: 1017600 KHz
[ 1.930478] remoteproc remoteproc0: cd00000.q6v5_wcss is available
[ 1.939400] ubi0: attaching mtd24
[ 2.334094] random: crng init done
[ 2.760229] ubi0: scanning is finished
[ 2.767883] ubi0: attached mtd24 (name "alt_rootfs", size 167 MiB)
[ 2.767921] ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 253952 bytes
[ 2.772961] ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 4096
[ 2.779841] ubi0: VID header offset: 4096 (aligned 4096), data offset: 8192
[ 2.786683] ubi0: good PEBs: 669, bad PEBs: 0, corrupted PEBs: 0
[ 2.793446] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
[ 2.799703] ubi0: max/mean erase counter: 2/0, WL threshold: 4096, image sequence number: 1722718807
[ 2.806739] ubi0: available PEBs: 0, total reserved PEBs: 669, PEBs reserved for bad PEB handling: 80
[ 2.816039] ubi0: background thread "ubi_bgt0d" started, PID 673
[ 2.816560] block ubiblock0_0: created from ubi0:0(rootfs)
[ 2.831220] ubi1: attaching mtd22
[ 2.837258] ubi1 error: validate_ec_hdr: bad VID header offset 2048, expected 4096
[ 2.839889] ubi1 error: validate_ec_hdr: bad EC header
[ 2.847362] Erase counter header dump:
[ 2.852468] magic 0x55424923
[ 2.856207] version 1
[ 2.859931] ec 0
[ 2.862969] vid_hdr_offset 2048
[ 2.865927] data_offset 4096
[ 2.869220] image_seq 71654230
[ 2.872434] hdr_crc 0xd8a31093
[ 2.875997] erase counter header hexdump:
[ 2.879554] 00000000: 55 42 49 23 01 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 10 00 04 45 5b 56 00 00 00 00 UBI#.....................E[V....
[ 2.879561] 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 d8 a3 10 93 ................................
[ 2.879568] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.6.43 #0
[ 2.883635] Hardware name: Linksys MX4300 (DT)
[ 2.889362] Call trace:
[ 2.893872] dump_backtrace+0xa0/0xe0
[ 2.896218] show_stack+0x18/0x24
[ 2.900037] dump_stack_lvl+0x48/0x60
[ 2.903336] dump_stack+0x18/0x24
[ 2.906980] validate_ec_hdr+0xa0/0xec
[ 2.910280] ubi_io_read_ec_hdr+0x190/0x1f0
[ 2.913927] ubi_attach+0x35c/0x12e4
[ 2.918005] ubi_attach_mtd_dev+0x494/0xaf4
[ 2.921826] ubi_init_attach+0xac/0x2e4
[ 2.925732] do_one_initcall+0x6c/0x1fc
[ 2.929551] kernel_init_freeable+0x204/0x2e4
[ 2.933372] kernel_init+0x28/0x1e0
[ 2.937883] ret_from_fork+0x10/0x20
[ 2.941197] ubi1 error: ubi_io_read_ec_hdr: validation failed for PEB 0
[ 2.945018] ubi1 error: ubi_attach_mtd_dev: failed to attach mtd22, error -22
[ 2.951373] UBI error: cannot attach mtd22
[ 2.958750] clk: Disabling unused clocks
[ 2.967165] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[ 2.967700] Freeing unused kernel memory: 1472K
[ 2.973389] Run /sbin/init as init process
[ 2.977649] with arguments:
[ 2.977652] /sbin/init
[ 2.977655] with environment:
[ 2.977657] HOME=/
[ 2.977660] TERM=linux
[ 3.172600] init: Console is alive
[ 3.172736] init: - watchdog -
[ 3.929450] kmodloader: loading kernel modules from /etc/modules-boot.d/

[ 3.963765] gpio_button_hotplug: loading out-of-tree module taints kernel.
[ 4.007459] ssdk_dt_parse_interrupt[941]:INFO:intr-gpio does not exist
[ 4.308155] adpt_hppe_uniphy_mode_set[1398]:INFO:ssdk doesn't support mode:0 in uniphy:0 on platform!
[ 4.308314] regi_init[2525]:INFO:Initializing HPPE Done!!
[ 4.316457] regi_init[2574]:INFO:qca-ssdk module init succeeded!
[ 4.324327] EDMA ver 1 hw init
[ 4.328044] EDMA HW Reset completed succesfully
[ 4.330716] Num rings - TxDesc:1 (23-23) TxCmpl:1 (7-7)
[ 4.335123] RxDesc:1 (15-15) RxFill:1 (7-7)
[ 4.340710] dp2: ppe offload disabled: 0 for macid 2
[ 4.344505] dp2: Switch attached to macid 2 status: 0
[ 4.504862] Qualcomm QCA8075 90000.mdio-1:01: attached PHY driver (mii_bus:phy_addr=90000.mdio-1:01, irq=POLL)
[ 4.505789] dp3: ppe offload disabled: 0 for macid 3
[ 4.513751] dp3: Switch attached to macid 3 status: 0
[ 4.594445] Qualcomm QCA8075 90000.mdio-1:02: attached PHY driver (mii_bus:phy_addr=90000.mdio-1:02, irq=POLL)
[ 4.595374] GMAC4(ffffff8004447900) Invalid MAC@ - using 56:1f:e2:3c:8c:52
[ 4.603338] dp4: ppe offload disabled: 0 for macid 4
[ 4.610216] dp4: Switch attached to macid 4 status: 0
[ 4.694446] Qualcomm QCA8075 90000.mdio-1:03: attached PHY driver (mii_bus:phy_addr=90000.mdio-1:03, irq=POLL)
[ 4.695379] GMAC5(ffffff8004441900) Invalid MAC@ - using fe:3d:6d:bd:28:65
[ 4.703339] dp5: ppe offload disabled: 0 for macid 5
[ 4.710214] dp5: Switch attached to macid 5 status: 0
[ 4.784443] Qualcomm QCA8075 90000.mdio-1:04: attached PHY driver (mii_bus:phy_addr=90000.mdio-1:04, irq=POLL)
[ 4.785310] **********************************************************
[ 4.793332] * NSS Data Plane driver
[ 4.799858] **********************************************************
[ 4.816102] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[ 4.816155] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 1
[ 4.820635] xhci-hcd xhci-hcd.1.auto: hcc params 0x0220fe65 hci version 0x110 quirks 0x0000008002000010
[ 4.828120] xhci-hcd xhci-hcd.1.auto: irq 39, io mem 0x08a00000
[ 4.837557] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[ 4.843322] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 2
[ 4.848894] xhci-hcd xhci-hcd.1.auto: Host supports USB 3.0 SuperSpeed
[ 4.856955] hub 1-0:1.0: USB hub found
[ 4.863050] hub 1-0:1.0: 1 port detected
[ 4.867179] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[ 4.871199] hub 2-0:1.0: USB hub found
[ 4.878957] hub 2-0:1.0: 1 port detected
[ 4.886219] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[ 4.889220] init: - preinit -
[ 5.345195] mtdblock: MTD device 'devinfo' is NAND, please consider using UBI block devices instead.
[ 5.400633] mtdblock: MTD device 'u_env' is NAND, please consider using UBI block devices instead.
[ 5.596612] mtdblock: MTD device 'u_env' is NAND, please consider using UBI block devices instead.
[ 7.985125] UBIFS (ubi0:1): Mounting in unauthenticated mode
[ 7.985262] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 950
[ 8.061462] UBIFS (ubi0:1): recovery needed
[ 8.236994] UBIFS (ubi0:1): recovery completed
[ 8.237099] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "rootfs_data"
[ 8.240346] UBIFS (ubi0:1): LEB size: 253952 bytes (248 KiB), min./max. I/O unit sizes: 4096 bytes/4096 bytes
[ 8.248265] UBIFS (ubi0:1): FS size: 138149888 bytes (131 MiB, 544 LEBs), max 554 LEBs, journal size 6856704 bytes (6 MiB, 27 LEBs)
[ 8.258157] UBIFS (ubi0:1): reserved for root: 4952683 bytes (4836 KiB)
[ 8.269778] UBIFS (ubi0:1): media format: w5/r0 (latest is w5/r0), UUID FFCCDDF7-7DE7-4EF7-B4C9-A5B294EE6EC0, small LPT model
[ 8.283408] mount_root: switching to ubifs overlay
[ 8.295537] overlayfs: null uuid detected in lower fs '/', falling back to xino=off,index=off,nfs_export=off.
[ 8.303815] urandom-seed: Seeding with /etc/urandom.seed
[ 8.369888] procd: - early -
[ 8.370000] procd: - watchdog -
[ 8.935037] procd: - watchdog -
[ 8.935642] procd: - ubus -
[ 9.089451] procd: - init -
[ 9.390605] kmodloader: loading kernel modules from /etc/modules.d/*
[ 9.517083] hid: raw HID events driver (C) Jiri Kosina
[ 9.528772] Bluetooth: Core ver 2.22
[ 9.528896] NET: Registered PF_BLUETOOTH protocol family
[ 9.531424] Bluetooth: HCI device and connection manager initialized
[ 9.536833] Bluetooth: HCI socket layer initialized
[ 9.543058] Bluetooth: L2CAP socket layer initialized
[ 9.547681] Bluetooth: SCO socket layer initialized
[ 9.554030] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 9.557651] Bluetooth: BNEP filters: protocol multicast
[ 9.563116] Bluetooth: BNEP socket layer initialized
[ 9.571760] usbcore: registered new interface driver btusb
[ 9.573737] Loading modules backported from Linux version v6.9.9-0-g28fdf4518483
[ 9.578584] Backport generated by backports.git v6.1.97-1-29-gf1d24a3683b2
[ 9.587408] Bluetooth: HCI UART driver ver 2.3
[ 9.592796] Bluetooth: HCI UART protocol H4 registered
[ 9.597248] Bluetooth: HCI UART protocol BCSP registered
[ 9.603488] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[ 9.607892] Bluetooth: HIDP socket layer initialized
[ 9.620803] NET: Registered PF_QIPCRTR protocol family
[ 9.623262] Bluetooth: RFCOMM TTY layer initialized
[ 9.624936] Bluetooth: RFCOMM socket layer initialized
[ 9.629627] Bluetooth: RFCOMM ver 1.11
[ 9.630442] urngd: v1.0.2 started.
[ 9.688726] PPP generic driver version 2.4.2
[ 9.689582] NET: Registered PF_PPPOX protocol family
[ 9.702187] ath11k c000000.wifi: ipq8074 hw2.0
[ 9.702222] ath11k c000000.wifi: FW memory mode: 0
[ 9.757531] remoteproc remoteproc0: powering up cd00000.q6v5_wcss
[ 9.757927] remoteproc remoteproc0: Booting fw image IPQ8074/q6_fw.mdt, size 668
[ 10.995928] remoteproc remoteproc0: remote processor cd00000.q6v5_wcss is now up
[ 11.039887] ath11k c000000.wifi: qmi ignore invalid mem req type 3
[ 11.047336] ath11k c000000.wifi: chip_id 0x0 chip_family 0x0 board_id 0xff soc_id 0xffffffff
[ 11.047372] ath11k c000000.wifi: fw_version 0x290604a5 fw_build_timestamp 2023-10-12 02:06 fw_build_id WLAN.HK.2.9.0.1-01977-QCAHKSWPL_SILICONZ-1
[ 11.207535] remoteproc remoteproc0: stopped remote processor cd00000.q6v5_wcss
[ 11.207579] remoteproc remoteproc0: powering up cd00000.q6v5_wcss
[ 11.213741] remoteproc remoteproc0: Booting fw image IPQ8074/q6_fw.mdt, size 668
[ 11.566073] remoteproc remoteproc0: remote processor cd00000.q6v5_wcss is now up
[ 11.569238] kmodloader: done loading kernel modules from /etc/modules.d/*
[ 11.610066] ath11k c000000.wifi: qmi ignore invalid mem req type 3
[ 11.617577] ath11k c000000.wifi: chip_id 0x0 chip_family 0x0 board_id 0xff soc_id 0xffffffff
[ 11.617632] ath11k c000000.wifi: fw_version 0x290604a5 fw_build_timestamp 2023-10-12 02:06 fw_build_id WLAN.HK.2.9.0.1-01977-QCAHKSWPL_SILICONZ-1
[ 12.004094] ath11k c000000.wifi: htt event 48 not handled
[ 14.505699] br-lan: port 1(lan1) entered blocking state
[ 14.505749] br-lan: port 1(lan1) entered disabled state
[ 14.509780] nss-dp 3a001800.dp5 lan1: entered allmulticast mode
[ 14.515269] nss-dp 3a001800.dp5 lan1: entered promiscuous mode
[ 14.527521] br-lan: port 2(lan2) entered blocking state
[ 14.527568] br-lan: port 2(lan2) entered disabled state
[ 14.531920] nss-dp 3a001600.dp4 lan2: entered allmulticast mode
[ 14.537480] nss-dp 3a001600.dp4 lan2: entered promiscuous mode
[ 14.548031] br-lan: port 3(lan3) entered blocking state
[ 14.548900] br-lan: port 3(lan3) entered disabled state
[ 14.554058] nss-dp 3a001400.dp3 lan3: entered allmulticast mode
[ 14.559452] nss-dp 3a001400.dp3 lan3: entered promiscuous mode
[ 17.684574] nss-dp 3a001800.dp5 lan1: PHY Link up speed: 1000
[ 17.684656] br-lan: port 1(lan1) entered blocking state
[ 17.689311] br-lan: port 1(lan1) entered forwarding state

`

@asd333111
Copy link
Author

So we should only keep the ubi.mtd that we want to attach in the command line.

@testuser7
Copy link
Owner

Thanks for the logs.
What about reuse this code and additionally add option to set ubi size?

		find-rootblock = "ubi.mtd=";  /* look for root deviceblock nbr in this bootarg */
		set-ubi-size = "4096"; /* set specified size for ubi.mtd root deviceblok */
		append-rootblock = "ubi.mtd=";  /* append to bootargs adding the root deviceblock nbr from bootloader */

@asd333111
Copy link
Author

I think the sole purpose of this patch is only to help people smoothly convert their devices from stock firmware to OpenWrt without using a serial adapter. If a simple solution can achieve the goal, I prefer not to do more complex things such as parsing or regexp in the kernel because they are more error-prone.

Also, that patch requires hard coding part of the bootargs into the device tree. It parses the command line from u-boot and appends the partition number to the command line hardcoded in the device tree.

I think that patch is worse than the current find-and-replace design since the current design allows users to modify the bootargs without recompiling the kernel. In addition, the app2_data and app2 partitions are unused on MX4300. I think some users will like to put the rootfs_data on them and attach them at boot time, which requires modifying the bootargs and is incompatible with that patch.

This is just my thoughts. Please let me know what you think.

@asd333111
Copy link
Author

Another thing is code reusability. The current design can do more things than fixing the ubi offset, which I think can be helpful for adding support for other devices in the future.

For example, it can remove an unwanted argument in the middle of the cmdline.

@asd333111 asd333111 force-pushed the mx4300-bootargs-patch branch from 3cae3ad to bed40f9 Compare August 4, 2024 00:50
@@ -7,6 +7,19 @@
/ {
model = "Linksys MX4300";
compatible = "linksys,mx4300", "qcom,ipq8074";

chosen {
bootargs-append = "";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used now.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@asd333111 asd333111 force-pushed the mx4300-bootargs-patch branch 2 times, most recently from 1d99eca to 28a031f Compare August 4, 2024 01:32
@@ -7,6 +7,17 @@
/ {
model = "Linksys MX4300";
compatible = "linksys,mx4300", "qcom,ipq8074";

chosen {
// Replace the bootargs from u-boot with find and replace
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect comment in dts. Should be: /* text */.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to change it. Although I found // is legit too.
https://devicetree-specification.readthedocs.io/en/v0.3/source-language.html

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is fixed and improved.

// Replace the bootargs from u-boot with find and replace
bootargs-find-1 = "init=/sbin/init rootfstype=squashfs ubi.mtd=22,2048 ubi.block=0,0 root=/dev/ubiblock0_0 rootwait ro";
bootargs-exact-match-1 = "y";
bootargs-replace-1 = "init=/sbin/init rootfstype=squashfs ubi.mtd=22,4096 ubi.block=0,0 root=/dev/ubiblock0_0 rootwait ro";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to replace only ubi.mtd in the current implementation?

		bootargs-find-1 = "ubi.mtd=22,2048";
		bootargs-exact-match-1 = "y";
		bootargs-replace-1 = "ubi.mtd=22,4096";

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is possible. But do we need to consider the case that a user modifies the bootargs?
Without using the full command for matching, we may accidentally replace a user's modified bootargs. For example, ... ubi.mtd=22,2048 ubi.mtd=24,4096 ... suppose this is what the user deliberately wants to do.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why I think the replacement should happen only if the kernel command line is identical to the default one.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think that replacing just the ubi.mtd parameter is sufficient. There is no perfect solution in this case. If someone adds something to bootargs but forgets to change the size, the current solution will not work.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, now it only replaces the ubi.mtd

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git format-patch is used to generate patches that are pushed to the Linux kernel, etc.
Some people push such patches directly to OpenWrt: openwrt@ca44690
But you can edit it before adding it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the current version acceptable?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some trail and error, I finally figured out quilt refresh --diffstat will put the diffstat into the patch.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the summary is included in the patch.

@asd333111 asd333111 force-pushed the mx4300-bootargs-patch branch from 28a031f to 62f25b2 Compare August 4, 2024 11:22
@testuser7 testuser7 force-pushed the mx4300 branch 3 times, most recently from 75a987c to 9cc8ee8 Compare August 4, 2024 15:57
@asd333111 asd333111 force-pushed the mx4300-bootargs-patch branch from 62f25b2 to 52feff1 Compare August 4, 2024 17:47
@asd333111 asd333111 force-pushed the mx4300-bootargs-patch branch from 52feff1 to c57d30d Compare August 4, 2024 17:49
@asd333111 asd333111 force-pushed the mx4300-bootargs-patch branch 2 times, most recently from dfd6644 to b963796 Compare August 4, 2024 18:05
@asd333111
Copy link
Author

Copied the usage of the hack into the commit message. Now it looks good to me.

@asd333111 asd333111 force-pushed the mx4300-bootargs-patch branch from b963796 to e4ddf15 Compare August 4, 2024 18:50
@github-actions github-actions bot removed the kernel label Aug 4, 2024
@asd333111 asd333111 force-pushed the mx4300-bootargs-patch branch 2 times, most recently from 9775623 to 124fda1 Compare August 4, 2024 19:59
Add kernel command line replacement hack to qualcommax. Now we can
find and replace arguments in the kernel command line by setting
bootargs-find-1, bootargs-replace-1, bootargs-exact-match-1
and bootargs-find-2, bootargs-replace-2, bootargs-exact-match-2
under the chosen node in the device tree.

This hack replaces the first occurence of bootargs-find-X with
bootargs-replace-X. When bootargs-exact-match-X is set to "y",
then the replacement happens only if the kernel command line is
identical to bootargs-find-X.

Signed-off-by: Qiyuan Zhang <[email protected]>
@asd333111 asd333111 force-pushed the mx4300-bootargs-patch branch from 124fda1 to 8c179fe Compare August 4, 2024 20:13
@testuser7 testuser7 merged commit 881d29d into testuser7:mx4300 Aug 4, 2024
2 checks passed
tannerkrewson pushed a commit to tannerkrewson/openwrt that referenced this pull request Sep 1, 2024
QSDK NSS builds utilize skbuff recycling for better handling of memory.

On a Dynalink DL-WRX36 (pbuf script should be set to 'auto') a significant drop in
memory usage was observed as well consistent sustained RX/TX speeds.

BEFORE:
echo 3 >! /proc/sys/vm/drop_caches

free -m
               total        used        free      shared  buff/cache   available
Mem:             867         338         547          90         101         528
Swap:              0           0           0

AFTER:
               total        used        free      shared  buff/cache   available
Mem:             867         242         594           1          81         624
Swap:              0           0           0

NOTE:

For 512MB platforms, users need to test with the following scenarios,
as the patch `999-233-ath11k-Disable-rx_header-tlv-for-2K-SKB.patch` is
really only testable on platforms with 512M or less RAM.

1.) Explicitly setting 'ATH11K_MEM_PROFILE_512M' on and see if system
    crashes on boot.

2.) Explicitly setting 'ATH11K_MEM_PROFILE_1G'

3.) Remove patches
    999-233-ath11k-Disable-rx_header-tlv-for-2K-SKB.patch
    999-311-ath11k-configure-nss-thread-priority-during-pdev_ini.patch

    And re-test with testuser7#1 and testuser7#2

It was incorrectly assumed that setting a 512M for 1G platforms would save
memory, instead it needs to be explicitly set to know proper memory
regions, otherwise it would cause fw crash.

ath11k_nss: fix typo in 512M memory profile

ath11k_nss: remove SFE patch 718-e-mac80211-Deliver-the-frame-to-driver-tx-ops-directly

It is not relevant to NSS builds and only meant for SFE.

ath11k_nss: remove unecessary patches

Color collision should be left on by default, as it's a primary feature
of 802.11AX.

ath11k_nss: fix spacing

ath11k_nss: Remove unnecessary TKIP bloat

Remove TKIP patches that are not being used as 99% of folks are running
modern encryption (AES-CCMP,SAE,etc).

ath11k_nss: parameterize DP_RXDMA_REFILL_RING_SIZE memory profile

ath11k_nss: Remove SFE related code

Cleanup SFE (shortcut fe) related code as we're not using it on NSS

ath11k_nss: idr, ampdu, and skb headroom check optimizations

ath11k_nss: get valid last_rate for rx_bitrate from cpu stats

ath11k_nss: Fix BCCA counter for EMA

Currently BCCA counter is updated to FW via csa counter offs and
beacon with new countdown is updated for every beacon tx completion event.
For EMA, all EMA beacons are updated in one shot, and counter update for
every tx event will mess up the actual sequence of countdown sent over the air.

Allow FW to update the countdown till 1 and finalize the color
change.

ath11k_nss: Fix compile for TRACE feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants