forked from dan/liminix
re-package image with update dtb for tftp
the additional kernel parameters seem to get picked up: ``` Kernel command line: liminix console=ttyS0,115200 console=ttyS0,115200 panic=10 oops=panic init=/bin/init loglevel=8 root=ubi0:liminix rootfstype=squashfs fw_devlink=off mtdparts=phram0:4980736(rootfs) phram.phram=phram0,2252341248,4980736,65536 root=/dev/mtdblock0 ``` and the (a?) squashfs is mounted, but cannot load init yet. Is it OK that there are multiple `root=` parameters? ``` ============================================ Ralink UBoot Version: 5.0.0.0 -------------------------------------------- ASIC MT7621A DualCore (MAC to MT7530 Mode) DRAM_CONF_FROM: Auto-Detection DRAM_TYPE: DDR3 DRAM bus: 16 bit Xtal Mode=3 OCP Ratio=1/3 Flash component: SPI Flash Date:Feb 16 2022 Time:16:26:34 ============================================ THIS IS uboot icache: sets:256, ways:4, linesz:32 ,total:32768 dcache: sets:256, ways:4, linesz:32 ,total:32768 ##### The CPU freq = 880 MHZ #### estimate memory size =128 Mbytes Press '4' or 't' to break the booting process Press 'x' to enter recovery web server 0 #Reset_MT7530 set LAN/WAN LLLLW 4: System Enter Boot Command Line Interface. U-Boot 1.1.3 (Feb 16 2022 - 16:26:34) MT7621 # t tftpboot 0x868c3000 result/image NetLoop,call eth_halt ! NetLoop,call eth_init ! Trying Eth0 (10/100-M) Waitting for RX_DMA_BUSY status Start... done ETH_STATE_ACTIVE!! TFTP from server 192.168.0.5; our IP address is 192.168.0.1 Filename 'result/image'. TIMEOUT_COUNT=10,Load address: 0x868c3000 Loading: *Got ARP REPLY, set server/gtwy eth addr (f8:e4:3b:37:bb:82) Got it ################################################################# ################################################################# ################################################################# ################################################################# ######################################Got ARP REQUEST, return our IP ########################### ################################################################# ################################################################# ################################################################# ############################### done Bytes transferred = 2820714 (2b0a6a hex) LoadAddr=868c3000 NetBootFileXferSize= 002b0a6a MT7621 # tftpboot 0x86400000 result/rootfs NetLoop,call eth_halt ! NetLoop,call eth_init ! Trying Eth0 (10/100-M) ETH_STATE_ACTIVE!! TFTP from server 192.168.0.5; our IP address is 192.168.0.1 Filename 'result/rootfs'. TIMEOUT_COUNT=10,Load address: 0x86400000 Loading: *Got ARP REPLY, set server/gtwy eth addr (f8:e4:3b:37:bb:82) Got it ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ######################################################### done Bytes transferred = 4947968 (4b8000 hex) LoadAddr=86400000 NetBootFileXferSize= 004b8000 MT7621 # bootm 0x868c3000 ## Booting image at 868c3000 ... Image Name: MIPS Liminix Linux Image Type: MIPS Linux Kernel Image (lzma compressed) Data Size: 2820650 Bytes = 2.7 MB Load Address: 80001000 Entry Point: 80001000 Verifying Checksum ... OK Uncompressing Kernel Image ... OK No initrd nm_init:791 nm_initFwupPtnStruct:276 nm_lib_readPtnTable:738 [NM_Debug](nm_lib_readPtnTable) 00743: NM_PTN_TABLE_BASE = 0xfe0000 [NM_Debug](nm_lib_readPtnFromNvram) 00569: partition_used_len = 1054, requried len = 8192 [NM_Debug](nm_lib_readPtnTable) 00751: Reading Partition Table from NVRAM ... OK [NM_Debug](nm_lib_readPtnTable) 00759: Parsing Partition Table ... OK [NM_Debug](nm_lib_readPtnFromNvram) 00569: partition_used_len = 3, requried len = 3 [NM_Error](nm_api_checkTestMode) 00417: factory boot check testmode flag is not 1. ### test_mode=disable,boot_args:console=ttyS1,115200 root=/dev/mtdblock2 rootfstype=squashfs init=/etc/preinit mtdparts=raspi:256k(uboot),4096k(uImage),11968k@0x440000(rootfs),64k@0xff0000(ART) mem=128M test_mode=disable ## Transferring control to Linux (at address 80001000) ... ## Giving linux memsize in MB, 128 Starting kernel ... Linux version 5.15.137 (nixbld@liminix.builder) (mips-unknown-linux-musl-gcc (GCC) 13.2.0, GNU ld (GNU Binutils) 2.40) #1 SMP Sat Jan 27 10:24:12 UTC 2024 SoC Type: MediaTek MT7621 ver:1 eco:4 printk: bootconsole [early0] enabled CPU0 revision is: 0001992f (MIPS 1004Kc) MIPS: machine is TP-Link Archer AX23 v1 VPE topology {2,2} total 4 Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes. Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes MIPS secondary cache 256kB, 8-way, linesize 32 bytes. Zone ranges: Normal [mem 0x0000000000000000-0x0000000007ffffff] Movable zone start for each node Early memory node ranges node 0: [mem 0x0000000000000000-0x0000000007ffffff] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff] percpu: Embedded 11 pages/cpu s14544 r8192 d22320 u45056 pcpu-alloc: s14544 r8192 d22320 u45056 alloc=11*4096 pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 Built 1 zonelists, mobility grouping on. Total pages: 32512 Kernel command line: liminix console=ttyS0,115200 console=ttyS0,115200 panic=10 oops=panic init=/bin/init loglevel=8 root=ubi0:liminix rootfstype=squashfs fw_devlink=off mtdparts=phram0:4980736(rootfs) phram.phram=phram0,2252341248,4980736,65536 root=/dev/mtdblock0 Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear) Writing ErrCtl register=0003003d Readback ErrCtl register=0003003d mem auto-init: stack:all(zero), heap alloc:off, heap free:off Memory: 119816K/131072K available (6564K kernel code, 622K rwdata, 1244K rodata, 1220K init, 217K bss, 11256K reserved, 0K cma-reserved) SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 rcu: Hierarchical RCU implementation. rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. NR_IRQS: 256 clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0xcaf478abb4, max_idle_ns: 440795247997 ns sched_clock: 64 bits at 880MHz, resolution 1ns, wraps every 4398046511103ns Console: colour dummy device 80x25 Calibrating delay loop... 583.68 BogoMIPS (lpj=1167360) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear) Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear) rcu: Hierarchical SRCU implementation. smp: Bringing up secondary CPUs ... Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes. Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes MIPS secondary cache 256kB, 8-way, linesize 32 bytes. CPU1 revision is: 0001992f (MIPS 1004Kc) Synchronize counters for CPU 1: done. Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes. Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes MIPS secondary cache 256kB, 8-way, linesize 32 bytes. CPU2 revision is: 0001992f (MIPS 1004Kc) Synchronize counters for CPU 2: done. Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes. Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes MIPS secondary cache 256kB, 8-way, linesize 32 bytes. CPU3 revision is: 0001992f (MIPS 1004Kc) Synchronize counters for CPU 3: done. smp: Brought up 1 node, 4 CPUs devtmpfs: initialized clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns futex hash table entries: 1024 (order: 3, 32768 bytes, linear) pinctrl core: initialized pinctrl subsystem NET: Registered PF_NETLINK/PF_ROUTE protocol family FPU Affinity set after 4688 emulations vgaarb: loaded pps_core: LinuxPPS API ver. 1 registered pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it> PTP clock support registered clocksource: Switched to clocksource GIC NET: Registered PF_INET protocol family IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear) tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear) Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear) TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear) TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear) TCP: Hash tables configured (established 1024 bind 1024) UDP hash table entries: 256 (order: 1, 8192 bytes, linear) UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear) NET: Registered PF_UNIX/PF_LOCAL protocol family PCI: CLS 0 bytes, default 32 Initialise system trusted keyrings workingset: timestamp_bits=30 max_order=15 bucket_order=0 squashfs: version 4.0 (2009/01/31) Phillip Lougher Key type asymmetric registered Asymmetric key parser 'x509' registered io scheduler mq-deadline registered io scheduler kyber registered mt7621_gpio 1e000600.gpio: registering 32 gpios mt7621_gpio 1e000600.gpio: registering 32 gpios mt7621_gpio 1e000600.gpio: registering 32 gpios mt7621-pci 1e140000.pcie: host bridge /pcie@1e140000 ranges: mt7621-pci 1e140000.pcie: No bus range found for /pcie@1e140000, using [bus 00-ff] mt7621-pci 1e140000.pcie: MEM 0x0060000000..0x006fffffff -> 0x0060000000 mt7621-pci 1e140000.pcie: IO 0x001e160000..0x001e16ffff -> 0x0000000000 mt7621-pci 1e140000.pcie: pcie2 no card, disable it (RST & CLK) mt7621-pci 1e140000.pcie: PCIE0 enabled mt7621-pci 1e140000.pcie: PCIE1 enabled PCI coherence region base: 0x60000000, mask/settings: 0xf0000002 mt7621-pci 1e140000.pcie: PCI host bridge to bus 0000:00 pci_bus 0000:00: root bus resource [bus 00-ff] pci_bus 0000:00: root bus resource [mem 0x60000000-0x6fffffff] pci_bus 0000:00: root bus resource [io 0x0000-0xffff] pci 0000:00:00.0: [0e8d:0801] type 01 class 0x060400 pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x7fffffff] pci 0000:00:00.0: reg 0x14: [mem 0x00000000-0x0000ffff] pci 0000:00:00.0: supports D1 pci 0000:00:00.0: PME# supported from D0 D1 D3hot pci 0000:00:01.0: [0e8d:0801] type 01 class 0x060400 pci 0000:00:01.0: reg 0x10: [mem 0x00000000-0x7fffffff] pci 0000:00:01.0: reg 0x14: [mem 0x00000000-0x0000ffff] pci 0000:00:01.0: supports D1 pci 0000:00:01.0: PME# supported from D0 D1 D3hot pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring pci 0000:01:00.0: [14c3:7916] type 00 class 0x000280 pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x000fffff 64bit pref] pci 0000:01:00.0: reg 0x18: [mem 0x00000000-0x00003fff 64bit pref] pci 0000:01:00.0: reg 0x20: [mem 0x00000000-0x00000fff 64bit pref] pci 0000:01:00.0: supports D1 D2 pci 0000:01:00.0: PME# supported from D0 D1 D2 D3hot D3cold pci 0000:01:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s PCIe x1 link at 0000:00:00.0 (capable of 4.000 Gb/s with 5.0 GT/s PCIe x1 link) pci 0000:00:00.0: PCI bridge to [bus 01-ff] pci 0000:00:00.0: bridge window [io 0x0000-0x0fff] pci 0000:00:00.0: bridge window [mem 0x00000000-0x000fffff] pci 0000:00:00.0: bridge window [mem 0x00000000-0x000fffff pref] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01 pci 0000:02:00.0: [14c3:7915] type 00 class 0x000280 pci 0000:02:00.0: reg 0x10: [mem 0x00000000-0x000fffff 64bit pref] pci 0000:02:00.0: reg 0x18: [mem 0x00000000-0x00003fff 64bit pref] pci 0000:02:00.0: reg 0x20: [mem 0x00000000-0x00000fff 64bit pref] pci 0000:02:00.0: supports D1 D2 pci 0000:02:00.0: PME# supported from D0 D1 D2 D3hot D3cold pci 0000:02:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s PCIe x1 link at 0000:00:01.0 (capable of 4.000 Gb/s with 5.0 GT/s PCIe x1 link) pci 0000:00:01.0: PCI bridge to [bus 02-ff] pci 0000:00:01.0: bridge window [io 0x0000-0x0fff] pci 0000:00:01.0: bridge window [mem 0x00000000-0x000fffff] pci 0000:00:01.0: bridge window [mem 0x00000000-0x000fffff pref] pci_bus 0000:02: busn_res: [bus 02-ff] end is updated to 02 pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000] pci 0000:00:01.0: BAR 0: no space for [mem size 0x80000000] pci 0000:00:01.0: BAR 0: failed to assign [mem size 0x80000000] pci 0000:00:00.0: BAR 8: assigned [mem 0x60000000-0x600fffff] pci 0000:00:00.0: BAR 9: assigned [mem 0x60100000-0x602fffff pref] pci 0000:00:01.0: BAR 8: assigned [mem 0x60300000-0x603fffff] pci 0000:00:01.0: BAR 9: assigned [mem 0x60400000-0x605fffff pref] pci 0000:00:00.0: BAR 1: assigned [mem 0x60600000-0x6060ffff] pci 0000:00:01.0: BAR 1: assigned [mem 0x60610000-0x6061ffff] pci 0000:00:00.0: BAR 7: assigned [io 0x0000-0x0fff] pci 0000:00:01.0: BAR 7: assigned [io 0x1000-0x1fff] pci 0000:01:00.0: BAR 0: assigned [mem 0x60100000-0x601fffff 64bit pref] pci 0000:01:00.0: BAR 2: assigned [mem 0x60200000-0x60203fff 64bit pref] pci 0000:01:00.0: BAR 4: assigned [mem 0x60204000-0x60204fff 64bit pref] pci 0000:00:00.0: PCI bridge to [bus 01] pci 0000:00:00.0: bridge window [io 0x0000-0x0fff] pci 0000:00:00.0: bridge window [mem 0x60000000-0x600fffff] pci 0000:00:00.0: bridge window [mem 0x60100000-0x602fffff pref] pci 0000:02:00.0: BAR 0: assigned [mem 0x60400000-0x604fffff 64bit pref] pci 0000:02:00.0: BAR 2: assigned [mem 0x60500000-0x60503fff 64bit pref] pci 0000:02:00.0: BAR 4: assigned [mem 0x60504000-0x60504fff 64bit pref] pci 0000:00:01.0: PCI bridge to [bus 02] pci 0000:00:01.0: bridge window [io 0x1000-0x1fff] pci 0000:00:01.0: bridge window [mem 0x60300000-0x603fffff] pci 0000:00:01.0: bridge window [mem 0x60400000-0x605fffff pref] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled 1e000c00.uartlite: ttyS0 at MMIO 0x1e000c00 (irq = 19, base_baud = 3125000) is a 16550A 1 cmdlinepart partitions found on MTD device phram0 Creating 1 MTD partitions on "phram0": 0x000000000000-0x0000004c0000 : "rootfs" mtd: setting mtd0 (rootfs) as root device phram: phram0 device: 0x4c0000 at 0x86400000 for erasesize 0x10000 spi-mt7621 1e000b00.spi: sys_freq: 220000000 spi-nor spi0.0: en25qh128 (16384 Kbytes) 5 fixed-partitions partitions found on MTD device spi0.0 OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions Creating 5 MTD partitions on "spi0.0": 0x000000000000-0x000000040000 : "u-boot" 0x000000040000-0x000000fa0000 : "firmware" 2 uimage-fw partitions found on MTD device firmware Creating 2 MTD partitions on "firmware": 0x000000000000-0x000000400000 : "kernel" 0x000000400000-0x000000f60000 : "rootfs" 0x000000fa0000-0x000000fb0000 : "config" 0x000000fb0000-0x000000ff0000 : "tplink" 0x000000ff0000-0x000001000000 : "radio" mt7530-mdio mdio-bus:1f: MT7530 adapts as multi-chip module mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 21 mtk_soc_eth 1e100000.ethernet wan: mediatek frame engine at 0xbe100000, irq 21 i2c_dev: i2c /dev entries driver NET: Registered PF_INET6 protocol family Segment Routing with IPv6 In-situ OAM (IOAM) with IPv6 sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver NET: Registered PF_PACKET protocol family 8021q: 802.1Q VLAN Support v1.8 Loading compiled-in X.509 certificates Loaded X.509 cert 'Build time autogenerated kernel key: b6b976e6f5e4a2a6f94be9b1bd7920d81a61fb4b' Problem parsing in-kernel X.509 certificate list mt7530-mdio mdio-bus:1f: MT7530 adapts as multi-chip module mt7530-mdio mdio-bus:1f: configuring for fixed/rgmii link mode mt7530-mdio mdio-bus:1f: Link is Up - 1Gbps/Full - flow control rx/tx mt7530-mdio mdio-bus:1f lan1 (uninitialized): PHY [mt7530-0:00] driver [MediaTek MT7530 PHY] (irq=23) mt7530-mdio mdio-bus:1f lan2 (uninitialized): PHY [mt7530-0:01] driver [MediaTek MT7530 PHY] (irq=24) mt7530-mdio mdio-bus:1f lan3 (uninitialized): PHY [mt7530-0:02] driver [MediaTek MT7530 PHY] (irq=25) mt7530-mdio mdio-bus:1f lan4 (uninitialized): PHY [mt7530-0:03] driver [MediaTek MT7530 PHY] (irq=26) DSA: tree 0 setup Warning: unable to open an initial console. VFS: Mounted root (squashfs filesystem) readonly on device 31:0. Freeing unused kernel image (initmem) memory: 1220K This architecture does not have kernel memory protection. Run /bin/init as init process with arguments: /bin/init with environment: HOME=/ TERM=linux Kernel panic - not syncing: Requested init /bin/init failed (error -8). Rebooting in 10 seconds.. ```
This commit is contained in:
parent
bc588804fd
commit
2c83a2bb77
|
@ -63,8 +63,13 @@ in {
|
|||
zimage = "bootz";
|
||||
}; in choices.${cfg.kernelFormat};
|
||||
cmdline = concatStringsSep " " config.boot.commandLine;
|
||||
objcopy = "${pkgs.stdenv.cc.bintools.targetPrefix}objcopy";
|
||||
stripAndZip = ''
|
||||
${objcopy} -O binary -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id -S vmlinux.elf vmlinux.bin
|
||||
rm -f vmlinux.bin.lzma ; lzma -k -z vmlinux.bin
|
||||
'';
|
||||
in
|
||||
pkgs.runCommand "tftpboot" { nativeBuildInputs = with pkgs.pkgsBuildBuild; [ lzma dtc ]; } ''
|
||||
pkgs.runCommand "tftpboot" { nativeBuildInputs = with pkgs.pkgsBuildBuild; [ lzma dtc pkgs.stdenv.cc ubootTools ]; } ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
binsize() { local s=$(stat -L -c %s $1); echo $(($s + 0x1000 &(~0xfff))); }
|
||||
|
@ -77,12 +82,12 @@ in {
|
|||
imageSize=$(binsize ${image})
|
||||
|
||||
ln -s ${o.manifest} manifest
|
||||
ln -s ${image} image
|
||||
ln -s ${o.kernel} vmlinux # handy for gdb
|
||||
|
||||
${if cfg.compressRoot
|
||||
then ''
|
||||
lzma -z9cv ${o.rootfs} > rootfs.lz
|
||||
# TODO this is no longer correct
|
||||
rootfsLzStart=$(($imageStart + $imageSize))
|
||||
rootfsLzSize=$(binsize rootfs.lz)
|
||||
''
|
||||
|
@ -107,6 +112,14 @@ in {
|
|||
cmd="liminix ${cmdline} mtdparts=phram0:''${rootfsSize}(rootfs) phram.phram=phram0,''${rootfsStart},''${rootfsSize},${toString config.hardware.flash.eraseBlockSize} root=/dev/mtdblock0";
|
||||
fdtput -t s dtb /chosen bootargs "$cmd"
|
||||
|
||||
# re-package image with updated dtb
|
||||
cp ${o.kernel} vmlinux.elf; chmod +w vmlinux.elf
|
||||
${objcopy} --update-section .appended_dtb=dtb vmlinux.elf
|
||||
${stripAndZip}
|
||||
# TODO don't hardcode mips, entryPoint, loadAddress, name
|
||||
echo hey2 mkimage -A mips -O linux -T kernel -C lzma -a 0x80001000 -e 0x80001000 -n 'MIPS Liminix Linux' -d vmlinux.bin.lzma image
|
||||
mkimage -A mips -O linux -T kernel -C lzma -a 0x80001000 -e 0x80001000 -n 'MIPS Liminix Linux' -d vmlinux.bin.lzma image
|
||||
|
||||
# dtc -I dtb -O dts -o /dev/stdout dtb | grep -A10 chosen ; exit 1
|
||||
|
||||
cat > boot.scr << EOF
|
||||
|
|
Loading…
Reference in New Issue