diff mbox series

[bug#64068] gnu: Add u-boot-lichee-rv-dock.

Message ID tencent_74A65FAA51D6F59F8E0E5F795A096DEDD306@qq.com
State New
Headers show
Series [bug#64068] gnu: Add u-boot-lichee-rv-dock. | expand

Commit Message

Z572 June 17, 2023, 2:25 p.m. UTC
Vagrant Cascadian <vagrant@debian.org> writes:

> [[PGP Signed Part:Undecided]]
> On 2023-06-14, Z572 wrote:
>> * gnu/packages/bootloaders.scm (u-boot-lichee-rv-dock): New variable.
>> * gnu/packages/patches/u-boot-lichee-rv-dock-disable-openssl.patch: New file.
>> * gnu/local.mk(dist_patch_DATA): register it.
>
> Thanks for the patches!
>
> This also reminds me that u-boot is falling a little behind (there is
> 2023.01, 2023.04 and soon 2023.07)... and while I would not want to block
> adding support for this board, I would be curious if it still works with
> newer u-boot versions...

for now is not upstreamed.

>
>
>> +(define-public u-boot-lichee-rv-dock
> ...
>> +                  (search-patches
>> +                   "u-boot-lichee-rv-dock-disable-openssl.patch")
>> +                  ;;; rebase from %u-boot-allow-disabling-openssl-patch
>> +                  (filter (negate (cut string-contains <> "openssl"))
>> +                          (origin-patches (package-source base)))))
>
> This seems a little tricky and possibly error-prone if another patch
> with openssl in the name is included at a later time, it could break
> this package. I almost wonder if it wouldn't be better to merge the
> functionality of the two patches disabling openssl than applying a
> board-specific patch?

this new patch is modified from the original patch, because original
patch can't apply to smaeul/u-boot.

I attach a new patch.

>
>
> I have not had a chance to test that this package builds; I presume you
> have tested that it actually boots?

yes, u-boot can boot, but cann't boot guix system, i guess because
initrd is too big(even though the board has 1GB of RAM), initrd.cpio is 60M. so i send this patch first,
and try "remove initrd" or "make initrd small" in future .
(I'm not familiar with u-boot)

I attach some photo, scm file and boot log.

https://wiki.sipeed.com/hardware/en/lichee/RV/Dock.html
;; -*- mode: scheme; -*-

(use-modules (gnu)
             (gnu bootloader)
             (gnu bootloader u-boot)
             (gnu image)
             (gnu packages linux)
             (gnu services)
             (gnu services base)
             (gnu services networking)
             (gnu system)
             (gnu system file-systems)
             (gnu system image)
             (guix platforms riscv)
             (srfi srfi-26))
(use-package-modules linux firmware tls bootloaders)
(define os
  (operating-system
    (host-name "riscv")
    (timezone "Asia/Shanghai")
    (locale "en_US.utf8")
    (initrd-modules '())
    (firmware '())
    (bootloader
     (bootloader-configuration
      (bootloader
       (bootloader
        (inherit u-boot-bootloader)
        (package u-boot-lichee-rv-dock)
        (disk-image-installer
         #~(lambda (bootloader root-index image)
             (let ((u-boot (string-append
                            bootloader
                            "/libexec/u-boot-sunxi-with-spl.bin")))
               (write-file-on-device u-boot (stat:size (stat u-boot))
                                     image (* 256 512)))))))
      (targets
       (list "/dev/mmcblk0"))))

    (kernel linux-libre-riscv64-generic)
    (kernel-arguments (list "earlycon=sbi"
                            "console=ttyS0,115200n8"
                            "rootwait"))
    (file-systems (cons*
                   (file-system
                     (device
                      (file-system-label "my-root"))
                     (mount-point "/")
                     (type "ext4"))
                   %base-file-systems))))
(define licheepi-rv-dock-image-type
  (image-type
   (name 'licheepi-rv-dock)
   (constructor (lambda (os)
                  (image
                   (inherit (raw-with-offset-disk-image (expt 2 22)))
                   (partition-table-type 'gpt)
                   (operating-system os)
                   (platform riscv64-linux))))))

(define licheepi-rv-dock-raw-image
  (image
   (inherit
    (os+platform->image os riscv64-linux
                        #:type licheepi-rv-dock-image-type))
   (name 'licheepi-rv-dock-raw-image)))
licheepi-rv-dock-raw-image
>
>
> live well,
>   vagrant
>
> [[End of PGP Signed Part]]
U-Boot SPL 2022.10 (Jan 01 1970 - 00:00:01 +0000)
sunxi_ram_probe: dram-controller@3102000: probing
DRAM only have internal ZQ!!
ddr_efuse_type: 0x0
[AUTO DEBUG] single rank and full DQ!
ddr_efuse_type: 0x0
[AUTO DEBUG] rank 0 row = 16
[AUTO DEBUG] rank 0 bank = 8
[AUTO DEBUG] rank 0 page size = 2 KB
DRAM BOOT DRIVE INFO: V0.24
DRAM CLK = 792 MHz
DRAM Type = 3 (2:DDR2,3:DDR3)
DRAMC ZQ value: 0x7b7bfb
DRAM ODT value: 0x42.
ddr_efuse_type: 0x0
DRAM SIZE =1024 M
DRAM simple test OK.
mxstatus=0xc0408000 mhcr=0x00000109 mcor=0x00000003 mhint=0x00004000
Trying to boot from MMC1
PLL reg = 0xf8216300, freq = 1200000000
SPL size = 81920, sector = 400
sunxi_ram_get_info: dram-controller@3102000: getting info

OpenSBI v1.2
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name             : Sipeed Lichee RV Dock
Platform Features         : medeleg
Platform HART Count       : 1
Platform IPI Device       : ---
Platform Timer Device     : --- @ 0Hz
Platform Console Device   : uart8250
Platform HSM Device       : sun20i-d1-ppu
Platform PMU Device       : 
Platform Reboot Device    : sunxi-wdt-reset
Platform Shutdown Device  : ---
Firmware Base             : 0x40000000
Firmware Size             : 212 KB
Runtime SBI Version       : 1.0

Domain0 Name              : root
Domain0 Boot HART         : 0
Domain0 HARTs             : 0*
Domain0 Region00          : 0x0000000040000000-0x000000004003ffff ()
Domain0 Region01          : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address      : 0x0000000042e00000
Domain0 Next Arg1         : 0x0000000042e87e08
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes

Boot HART ID              : 0
Boot HART Domain          : root
Boot HART Priv Version    : v1.11
Boot HART Base ISA        : rv64imafdcvx
Boot HART ISA Extensions  : time
Boot HART PMP Count       : 8
Boot HART PMP Granularity : 2048
Boot HART PMP Address Bits: 38
Boot HART MHPM Count      : 29
Boot HART MIDELEG         : 0x0000000000020222
Boot HART MEDELEG         : 0x000000000000b109
sunxi_set_gate: (CLK#24) unhandled


U-Boot 2022.10 (Jan 01 1970 - 00:00:01 +0000) Allwinner Technology

DRAM:  1 GiB
sunxi_set_gate: (CLK#24) unhandled
Core:  50 devices, 19 uclasses, devicetree: separate
WDT:   Started watchdog@6011000 with servicing every 1000ms (16s timeout)
MMC:   mmc@4020000: 0, mmc@4021000: 1
Loading Environment from FAT... PLL reg = 0xf8216300, freq = 1200000000
Unable to use mmc 0:1...
In:    serial@2500000
Out:   serial@2500000
Err:   serial@2500000
Net:   No ethernet found.
starting USB...
Bus usb@4101000: USB EHCI 1.00
Bus usb@4101400: USB OHCI 1.0
Bus usb@4200000: USB EHCI 1.00
Bus usb@4200400: USB OHCI 1.0
scanning bus usb@4101000 for devices... 1 USB Device(s) found
scanning bus usb@4101400 for devices... 1 USB Device(s) found
scanning bus usb@4200000 for devices... 1 USB Device(s) found
scanning bus usb@4200400 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0 
PLL reg = 0xf8216300, freq = 1200000000
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
Ignoring unknown command: UI
GNU Guix Boot Options
1:      GNU with Linux-Libre-Riscv64-Generic 6.3.8
Enter choice: 1
1:      GNU with Linux-Libre-Riscv64-Generic 6.3.8
Retrieving file: /gnu/store/2x2xcnk3dpdv9q319d8gycdlm5p80bkk-raw-initrd/initrd.cpio.gz
Retrieving file: /gnu/store/y558b1zpy5f245r563g2q17vlzhl4r4z-linux-libre-riscv64-generic-6.3.8/Image
append: root=38af4c98-a64a-d769-d4b2-17f038af4c98 gnu.system=/gnu/store/d3zk8l38m3a180yk3aymf7fw9farhdir-system gnu.load=/gnu/store/d3zk8l38m3a180yk3aymf7fw9farhdir-system/boot earlycon=sbi console=ttyS0,115200n8 rootwait
Retrieving file: /gnu/store/y558b1zpy5f245r563g2q17vlzhl4r4z-linux-libre-riscv64-generic-6.3.8/lib/dtbs/sun20i-d1-lichee-rv-dock.dtb
** File not found /gnu/store/y558b1zpy5f245r563g2q17vlzhl4r4z-linux-libre-riscv64-generic-6.3.8/lib/dtbs/sun20i-d1-lichee-rv-dock.dtb **
Moving Image from 0x41000000 to 0x40200000, end=41777000
## Flattened Device Tree blob at 7fd427a0
   Booting using the fdt blob at 0x7fd427a0
Working FDT set to 7fd427a0
   Loading Ramdisk to 42175000, end 42dff82b ... OK
   Loading Device Tree to 0000000042167000, end 0000000042174617 ... OK
Working FDT set to 42167000

Starting kernel ...

[    0.000000] Linux version 6.3.8-riscv64-generic (guix@guix) (riscv64-linux-gnu-gcc (GCC) 11.3.0, GNU ld (GNU Binutils) 2.38) #1 SMP 1
[    0.000000] OF: fdt: Ignoring memory range 0x40000000 - 0x40200000
[    0.000000] Machine model: Sipeed Lichee RV Dock
[    0.000000] efi: UEFI not found.
[    0.000000] OF: reserved mem: 0x0000000040000000..0x000000004003ffff (256 KiB) map non-reusable mmode_resv0@40000000
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000040200000-0x000000007fffffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040200000-0x000000007fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040200000-0x000000007fffffff]
[    0.000000] On node 0, zone DMA32: 512 pages in unavailable ranges
[    0.000000] SBI specification v1.0 detected
[    0.000000] SBI implementation ID=0x1 Version=0x10002
[    0.000000] SBI TIME extension detected
[    0.000000] SBI IPI extension detected
[    0.000000] SBI RFENCE extension detected
[    0.000000] SBI SRST extension detected
[    0.000000] SBI HSM extension detected
[    0.000000] riscv: base ISA extensions acdfim
[    0.000000] riscv: ELF capabilities acdfim
[    0.000000] percpu: Embedded 19 pages/cpu s40056 r8192 d29576 u77824
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 257544
[    0.000000] Kernel command line: root=38af4c98-a64a-d769-d4b2-17f038af4c98 gnu.system=/gnu/store/d3zk8l38m3a180yk3aymf7fw9farhdir-system gnu.load=/gnu/store/d3zk8l38m3a180yk3aymf7fw9farhdir-system/boot earlycon=sbi console=ttyS0,115200nt
[    0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Virtual kernel memory layout:
[    0.000000]       fixmap : 0xffffffc6fea00000 - 0xffffffc6ff000000   (6144 kB)
[    0.000000]       pci io : 0xffffffc6ff000000 - 0xffffffc700000000   (  16 MB)
[    0.000000]      vmemmap : 0xffffffc700000000 - 0xffffffc800000000   (4096 MB)
[    0.000000]      vmalloc : 0xffffffc800000000 - 0xffffffd800000000   (  64 GB)
[    0.000000]      modules : 0xffffffff01577000 - 0xffffffff80000000   (2026 MB)
[    0.000000]       lowmem : 0xffffffd800000000 - 0xffffffd83fe00000   (1022 MB)
[    0.000000]       kernel : 0xffffffff80000000 - 0xffffffffffffffff   (2047 MB)
[    0.000000] Memory: 976532K/1046528K available (8281K kernel code, 4988K rwdata, 4096K rodata, 2178K init, 474K bss, 69996K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=1.
[    0.000000] rcu:     RCU debug extended QS entry/exit.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] riscv-intc: 64 local interrupts mapped
[    0.000000] plic: interrupt-controller@10000000: mapped 176 interrupts with 1 handlers for 2 contexts.
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] riscv-timer: riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0]
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.000001] sched_clock: 64 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[    0.000593] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.001820] Console: colour dummy device 80x25
[    0.001971] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=96000)
[    0.002015] pid_max: default: 32768 minimum: 301
[    0.002354] LSM: initializing lsm=capability,integrity
[    0.002730] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.002788] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.010375] cblist_init_generic: Setting adjustable number of callback queues.
[    0.010402] cblist_init_generic: Setting shift to 0 and lim to 1.
[    0.010851] riscv: ELF compat mode unsupported
[    0.010992] ASID allocator using 16 bits (65536 entries)
[    0.011536] rcu: Hierarchical SRCU implementation.
[    0.011555] rcu:     Max phase no-delay instances is 1000.
[    0.012740] EFI services will not be available.
[    0.013892] smp: Bringing up secondary CPUs ...
[    0.013911] smp: Brought up 1 node, 1 CPU
[    0.015877] devtmpfs: initialized
[    0.043396] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.043456] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[    0.044089] pinctrl core: initialized pinctrl subsystem
[    0.048866] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.049775] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations
[    0.049900] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.050107] audit: initializing netlink subsys (disabled)
[    0.052128] cpuidle: using governor menu
[    0.064853] platform soc: Fixed dependency cycle(s) with /soc/interrupt-controller@10000000
[    0.067307] platform 2001000.clock-controller: Fixed dependency cycle(s) with /soc/rtc@7090000
[    0.071177] platform 2030000.audio-codec: Fixed dependency cycle(s) with /soc/audio-codec@2030000/regulators@2030348/hpldo
[    0.071256] platform 2030000.audio-codec: Fixed dependency cycle(s) with /soc/audio-codec@2030000/regulators@2030348/aldo
[    0.092203] platform 5460000.tcon-top: Fixed dependency cycle(s) with /soc/mixer@5200000/ports/port@1/endpoint
[    0.092339] platform 5460000.tcon-top: Fixed dependency cycle(s) with /soc/mixer@5100000/ports/port@1/endpoint
[    0.093496] platform 5461000.lcd-controller: Fixed dependency cycle(s) with /soc/tcon-top@5460000/ports/port@3/endpoint@0
[    0.093676] platform 5461000.lcd-controller: Fixed dependency cycle(s) with /soc/tcon-top@5460000/ports/port@1/endpoint@0
[    0.095056] platform 5470000.lcd-controller: Fixed dependency cycle(s) with /soc/tcon-top@5460000/ports/port@4/endpoint
[    0.095308] platform 5470000.lcd-controller: Fixed dependency cycle(s) with /soc/tcon-top@5460000/ports/port@3/endpoint@2
[    0.095547] platform 5470000.lcd-controller: Fixed dependency cycle(s) with /soc/tcon-top@5460000/ports/port@1/endpoint@2
[    0.095783] platform 5470000.lcd-controller: Fixed dependency cycle(s) with /soc/tcon-top@5460000
[    0.097273] platform 5500000.hdmi: Fixed dependency cycle(s) with /soc/tcon-top@5460000/ports/port@5/endpoint
[    0.099959] platform 7010000.clock-controller: Fixed dependency cycle(s) with /soc/rtc@7090000
[    0.107952] platform connector: Fixed dependency cycle(s) with /soc/hdmi@5500000/ports/port@1/endpoint
[    0.110108] audit: type=2000 audit(0.048:1): state=initialized audit_enabled=0 res=1
[    0.112056] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages
[    0.112080] HugeTLB: 28 KiB vmemmap can be freed for a 2.00 MiB page
[    0.119125] iommu: Default domain type: Translated 
[    0.119148] iommu: DMA domain TLB invalidation policy: strict mode 
[    0.121247] SCSI subsystem initialized
[    0.122683] usbcore: registered new interface driver usbfs
[    0.122837] usbcore: registered new interface driver hub
[    0.122991] usbcore: registered new device driver usb
[    0.126627] vgaarb: loaded
[    0.127735] clocksource: Switched to clocksource riscv_clocksource
[    0.169116] NET: Registered PF_INET protocol family
[    0.169788] IP idents hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.177975] tcp_listen_portaddr_hash hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.178138] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.178194] TCP established hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.178481] TCP bind hash table entries: 8192 (order: 7, 524288 bytes, linear)
[    0.181949] TCP: Hash tables configured (established 8192 bind 8192)
[    0.182254] UDP hash table entries: 512 (order: 3, 49152 bytes, linear)
[    0.182613] UDP-Lite hash table entries: 512 (order: 3, 49152 bytes, linear)
[    0.183411] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.185624] RPC: Registered named UNIX socket transport module.
[    0.185649] RPC: Registered udp transport module.
[    0.185660] RPC: Registered tcp transport module.
[    0.185671] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.185704] PCI: CLS 0 bytes, default 64
[    0.189940] Unpacking initramfs...
[    0.190052] Initramfs unpacking failed: invalid magic at start of compressed archive
[    0.213683] Freeing initrd memory: 12840K
[    0.214076] workingset: timestamp_bits=46 max_order=18 bucket_order=0
[    0.214432] zbud: loaded
[    0.217051] NFS: Registering the id_resolver key type
[    0.217184] Key type id_resolver registered
[    0.217202] Key type id_legacy registered
[    0.217319] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.217343] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.218810] NET: Registered PF_ALG protocol family
[    0.219010] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 246)
[    0.219121] io scheduler mq-deadline registered
[    0.219142] io scheduler kyber registered
[    0.219270] io scheduler bfq registered
[    0.487991] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.493721] SuperH (H)SCI(F) driver initialized
[    0.519217] loop: module loaded
[    0.528524] e1000e: Intel(R) PRO/1000 Network Driver
[    0.528544] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    0.532884] usbcore: registered new interface driver uas
[    0.533053] usbcore: registered new interface driver usb-storage
[    0.533889] mousedev: PS/2 mouse device common for all mice
[    0.538635] sun6i-rtc 7090000.rtc: registered as rtc0
[    0.538795] sun6i-rtc 7090000.rtc: setting system clock to 1970-01-02T00:00:21 UTC (86421)
[    0.539217] sun6i-rtc 7090000.rtc: RTC enabled
[    0.542519] sunxi-wdt 6011000.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[    0.544816] sdhci: Secure Digital Host Controller Interface driver
[    0.544836] sdhci: Copyright(c) Pierre Ossman
[    0.546179] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.547221] usbcore: registered new interface driver usbhid
[    0.547243] usbhid: USB HID core driver
[    0.548069] riscv-pmu-sbi: SBI PMU extension is available
[    0.548185] riscv-pmu-sbi: 16 firmware and 31 hardware counters
[    0.552529] NET: Registered PF_INET6 protocol family
[    0.556182] Segment Routing with IPv6
[    0.556409] In-situ OAM (IOAM) with IPv6
[    0.556678] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    0.558718] NET: Registered PF_PACKET protocol family
[    0.558988] Key type dns_resolver registered
[    0.600728] zswap: loaded using pool lzo/zbud
[    0.629890] debug_vm_pgtable: [debug_vm_pgtable         ]: Validating architecture page table helpers
[    0.692033] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.716497] sun20i-d1-pinctrl 2000000.pinctrl: initialized sunXi PIO driver
[    0.721375] printk: console [ttyS0] disabled
[    0.741890] 2500000.serial: ttyS0 at MMIO 0x2500000 (irq = 204, base_baud = 1500000) is a 16550A
[    0.742015] printk: console [ttyS0] enabled
[    1.817436] 2500400.serial: ttyS1 at MMIO 0x2500400 (irq = 205, base_baud = 1500000) is a 16550A
[    1.845406] sunxi-mmc 4021000.mmc: allocated mmc-pwrseq
[    1.876610] sunxi-mmc 4021000.mmc: initialized, max. request size: 2048 KB, uses new timings mode
[    1.890239] sunxi-mmc 4020000.mmc: initialized, max. request size: 2048 KB, uses new timings mode
[    1.899833] Waiting for root device 38af4c98-a64a-d769-d4b2-17f038af4c98...
[    1.917326] sunxi-mmc 4021000.mmc: card claims to support voltages below defined range
[    1.949114] mmc1: new high speed SDIO card at address 0001
[    1.975007] mmc0: new high speed SDXC card at address aaaa
[    1.982799] mmcblk0: mmc0:aaaa SD64G 59.5 GiB 
[    2.002701] GPT:Primary header thinks Alt. header is not at the end of the disk.
[    2.010247] GPT:3421863 != 124735487
[    2.013907] GPT:Alternate GPT header not at the end of the disk.
[    2.020013] GPT:3421863 != 124735487
[    2.023613] GPT: Use GNU Parted to correct GPT errors.
[    2.028913]  mmcblk0: p1
[  252.019829] random: crng init done

Comments

Vagrant Cascadian July 2, 2023, 2:54 a.m. UTC | #1
On 2023-06-17, Z572 wrote:
> Vagrant Cascadian <vagrant@debian.org> writes:
>> On 2023-06-14, Z572 wrote:
>> This also reminds me that u-boot is falling a little behind (there is
>> 2023.01, 2023.04 and soon 2023.07)... and while I would not want to block
>> adding support for this board, I would be curious if it still works with
>> newer u-boot versions...
>
> for now is not upstreamed.

Ah, I missed that!

Since it is not from the upstream version, it should also specify the
version to match the version it is based on, even though it happens to
match right now (e.g. 2022.10)... Otherwise, once the u-boot it inherits
from is updated, I think it will list the package with the wrong
version...


>>> +(define-public u-boot-lichee-rv-dock
>> ...
>>> +                  (search-patches
>>> +                   "u-boot-lichee-rv-dock-disable-openssl.patch")
>>> +                  ;;; rebase from %u-boot-allow-disabling-openssl-patch
>>> +                  (filter (negate (cut string-contains <> "openssl"))
>>> +                          (origin-patches (package-source base)))))
>>
>> This seems a little tricky and possibly error-prone if another patch
>> with openssl in the name is included at a later time, it could break
>> this package. I almost wonder if it wouldn't be better to merge the
>> functionality of the two patches disabling openssl than applying a
>> board-specific patch?
>
> this new patch is modified from the original patch, because original
> patch can't apply to smaeul/u-boot.
>
> I attach a new patch.

Got it, thanks!

Once u-boot updates to 2023.07 or later, there will likely be more patch
conflicts... not sure of the best way to handle that...


>> I have not had a chance to test that this package builds; I presume you
>> have tested that it actually boots?
>
> yes, u-boot can boot, but cann't boot guix system, i guess because
> initrd is too big(even though the board has 1GB of RAM), initrd.cpio is 60M. so i send this patch first,
> and try "remove initrd" or "make initrd small" in future .
> (I'm not familiar with u-boot)

Hrm. Mixed feelings about getting it into guix at this point... with it
being a non-upstream fork and it cannot actually boot guix yet.


A few more comments:

> From: Z572 <873216071@qq.com>
> Date: Sat, 17 Jun 2023 22:19:34 +0800
> Subject: [PATCH] gnu: Add u-boot-lichee-rv-dock.
> 
> * gnu/packages/bootloaders.scm (u-boot-lichee-rv-dock): New variable.
> * gnu/packages/patches/u-boot-lichee-rv-dock-disable-openssl.patch: New file.
> * gnu/local.mk(dist_patch_DATA): register it.
...
> diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
> index a9685a9ef9..bd89280f1b 100644
> --- a/gnu/packages/bootloaders.scm
> +++ b/gnu/packages/bootloaders.scm
> @@ -18,6 +18,7 @@
>  ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
>  ;;; Copyright © 2021 Stefan <stefan-guix@vodafonemail.de>
>  ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
> +;;; Cournoyer © 2023 Zheng Junjie <873216071@qq.com>

I suspect you want "Copyright" not "Cournoyer" :)

> diff --git a/gnu/packages/patches/u-boot-lichee-rv-dock-disable-openssl.patch b/gnu/packages/patches/u-boot-lichee-rv-dock-disable-openssl.patch
> new file mode 100644
> index 0000000000..f8e22d2c57
> --- /dev/null
> +++ b/gnu/packages/patches/u-boot-lichee-rv-dock-disable-openssl.patch
> @@ -0,0 +1,216 @@
> +From b2dff4fe9d1a53bbe3565435e190db19e7d6f4e7 Mon Sep 17 00:00:00 2001
> +From: Z572 <zhengjunjie@iscas.ac.cn>
> +Date: Mon, 8 May 2023 18:00:55 +0800
> +Subject: [PATCH] remove openssl

If this is a rewrite of the removing openssl patch already in guix, it
should probably credit the original patch author...


live well,
  vagrant
diff mbox series

Patch

From 058efe4b42d6cae866c30de22eace1ef2ff00f48 Mon Sep 17 00:00:00 2001
Message-Id: <058efe4b42d6cae866c30de22eace1ef2ff00f48.1687012310.git.873216071@qq.com>
From: Z572 <873216071@qq.com>
Date: Sat, 17 Jun 2023 22:19:34 +0800
Subject: [PATCH] gnu: Add u-boot-lichee-rv-dock.

* gnu/packages/bootloaders.scm (u-boot-lichee-rv-dock): New variable.
* gnu/packages/patches/u-boot-lichee-rv-dock-disable-openssl.patch: New file.
* gnu/local.mk(dist_patch_DATA): register it.
---
 gnu/local.mk                                  |   1 +
 gnu/packages/bootloaders.scm                  |  39 ++++
 ...-boot-lichee-rv-dock-disable-openssl.patch | 216 ++++++++++++++++++
 3 files changed, 256 insertions(+)
 create mode 100644 gnu/packages/patches/u-boot-lichee-rv-dock-disable-openssl.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 2b3df5d75a..1cfdebd405 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1996,6 +1996,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
   %D%/packages/patches/u-boot-fix-build-python-3.10.patch	\
   %D%/packages/patches/u-boot-infodocs-target.patch		\
+  %D%/packages/patches/u-boot-lichee-rv-dock-disable-openssl.patch	\
   %D%/packages/patches/u-boot-patman-guix-integration.patch	\
   %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
   %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index a9685a9ef9..bd89280f1b 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -18,6 +18,7 @@ 
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
 ;;; Copyright © 2021 Stefan <stefan-guix@vodafonemail.de>
 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Cournoyer © 2023 Zheng Junjie <873216071@qq.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1188,6 +1189,44 @@  (define-public u-boot-sifive-unmatched
        (modify-inputs (package-inputs base)
          (append opensbi-generic))))))
 
+(define-public u-boot-lichee-rv-dock
+  (let ((commit "528ae9bc6c55edd3ffe642734b4132a8246ea777")
+        (base (make-u-boot-package
+               "lichee_rv_dock"
+               "riscv64-linux-gnu")))
+    (package
+      (inherit base)
+      (source (origin
+                (inherit (package-source base))
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/smaeul/u-boot")
+                      (commit commit)))
+                (file-name (git-file-name
+                            (package-name base)
+                            (package-version base)))
+                (patches
+                 (append
+                  ;; rebase from %u-boot-allow-disabling-openssl-patch
+                  (search-patches
+                   "u-boot-lichee-rv-dock-disable-openssl.patch")
+                  (delete %u-boot-allow-disabling-openssl-patch
+                          (origin-patches (package-source base)))))
+                (sha256
+                 (base32
+                  "1rfk2d9wxxmf8ypvmwq07g1vifkvzy2nzs4mdwdgxsadlhi8dn9s"))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'set-environment
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (setenv "OPENSBI" (search-input-file inputs
+                                                       "fw_dynamic.bin"))))))))
+      (inputs
+       (modify-inputs (package-inputs base)
+         (append opensbi-generic))))))
+
 (define-public u-boot-rock64-rk3328
   (let ((base (make-u-boot-package "rock64-rk3328" "aarch64-linux-gnu")))
     (package
diff --git a/gnu/packages/patches/u-boot-lichee-rv-dock-disable-openssl.patch b/gnu/packages/patches/u-boot-lichee-rv-dock-disable-openssl.patch
new file mode 100644
index 0000000000..f8e22d2c57
--- /dev/null
+++ b/gnu/packages/patches/u-boot-lichee-rv-dock-disable-openssl.patch
@@ -0,0 +1,216 @@ 
+From b2dff4fe9d1a53bbe3565435e190db19e7d6f4e7 Mon Sep 17 00:00:00 2001
+From: Z572 <zhengjunjie@iscas.ac.cn>
+Date: Mon, 8 May 2023 18:00:55 +0800
+Subject: [PATCH] remove openssl
+
+---
+ include/image.h    |  2 ++
+ tools/fit_image.c  |  3 ++-
+ tools/image-host.c |  4 ++++
+ tools/kwbimage.c   | 21 +++++++++++++++++++--
+ 4 files changed, 27 insertions(+), 3 deletions(-)
+
+diff --git a/include/image.h b/include/image.h
+index e5e12ce5..5c858a16 100644
+--- a/include/image.h
++++ b/include/image.h
+@@ -1172,6 +1172,7 @@ int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value,
+ 
+ int fit_set_timestamp(void *fit, int noffset, time_t timestamp);
+ 
++#ifdef CONFIG_FIT_PRELOAD
+ /**
+  * fit_pre_load_data() - add public key to fdt blob
+  *
+@@ -1186,6 +1187,7 @@ int fit_set_timestamp(void *fit, int noffset, time_t timestamp);
+  *	< 0, on failure
+  */
+ int fit_pre_load_data(const char *keydir, void *keydest, void *fit);
++#endif
+ 
+ int fit_cipher_data(const char *keydir, void *keydest, void *fit,
+ 		    const char *comment, int require_keys,
+diff --git a/tools/fit_image.c b/tools/fit_image.c
+index 923a9755..7a73f24a 100644
+--- a/tools/fit_image.c
++++ b/tools/fit_image.c
+@@ -59,9 +59,10 @@ static int fit_add_file_data(struct image_tool_params *params, size_t size_inc,
+ 		ret = fit_set_timestamp(ptr, 0, time);
+ 	}
+ 
++#ifdef CONFIG_FIT_PRELOAD
+ 	if (!ret)
+ 		ret = fit_pre_load_data(params->keydir, dest_blob, ptr);
+-
++#endif
+ 	if (!ret) {
+ 		ret = fit_cipher_data(params->keydir, dest_blob, ptr,
+ 				      params->comment,
+diff --git a/tools/image-host.c b/tools/image-host.c
+index 4e0512be..da70fcb4 100644
+--- a/tools/image-host.c
++++ b/tools/image-host.c
+@@ -14,9 +14,11 @@
+ #include <image.h>
+ #include <version.h>
+ 
++#ifdef CONFIG_FIT_PRELOAD
+ #include <openssl/pem.h>
+ #include <openssl/evp.h>
+ 
++#endif
+ /**
+  * fit_set_hash_value - set hash value in requested has node
+  * @fit: pointer to the FIT format image header
+@@ -1119,6 +1121,7 @@ static int fit_config_add_verification_data(const char *keydir,
+ 	return 0;
+ }
+ 
++#ifdef CONFIG_FIT_PRELOAD
+ /*
+  * 0) open file (open)
+  * 1) read certificate (PEM_read_X509)
+@@ -1227,6 +1230,7 @@ int fit_pre_load_data(const char *keydir, void *keydest, void *fit)
+  out:
+ 	return ret;
+ }
++#endif
+ 
+ int fit_cipher_data(const char *keydir, void *keydest, void *fit,
+ 		    const char *comment, int require_keys,
+diff --git a/tools/kwbimage.c b/tools/kwbimage.c
+index 6abb9f2d..d8159070 100644
+--- a/tools/kwbimage.c
++++ b/tools/kwbimage.c
+@@ -19,6 +19,7 @@
+ #include <stdint.h>
+ #include "kwbimage.h"
+ 
++#ifdef CONFIG_KWB_SECURE
+ #include <openssl/bn.h>
+ #include <openssl/rsa.h>
+ #include <openssl/pem.h>
+@@ -44,7 +45,7 @@ void EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx)
+ 	EVP_MD_CTX_reset(ctx);
+ }
+ #endif
+-
++#endif
+ /* fls - find last (most-significant) bit set in 4-bit integer */
+ static inline int fls4(int num)
+ {
+@@ -62,8 +63,9 @@ static inline int fls4(int num)
+ 
+ static struct image_cfg_element *image_cfg;
+ static int cfgn;
++#ifdef CONFIG_KWB_SECURE
+ static int verbose_mode;
+-
++#endif
+ struct boot_mode {
+ 	unsigned int id;
+ 	const char *name;
+@@ -278,6 +280,8 @@ image_count_options(unsigned int optiontype)
+ 	return count;
+ }
+ 
++#if defined(CONFIG_KWB_SECURE)
++
+ static int image_get_csk_index(void)
+ {
+ 	struct image_cfg_element *e;
+@@ -288,6 +292,7 @@ static int image_get_csk_index(void)
+ 
+ 	return e->csk_idx;
+ }
++#endif
+ 
+ static bool image_get_spezialized_img(void)
+ {
+@@ -432,6 +437,7 @@ static uint8_t baudrate_to_option(unsigned int baudrate)
+ 	}
+ }
+ 
++#if defined(CONFIG_KWB_SECURE)
+ static void kwb_msg(const char *fmt, ...)
+ {
+ 	if (verbose_mode) {
+@@ -926,6 +932,7 @@ static int kwb_dump_fuse_cmds(struct secure_hdr_v1 *sec_hdr)
+ done:
+ 	return ret;
+ }
++#endif
+ 
+ static size_t image_headersz_align(size_t headersz, uint8_t blockid)
+ {
+@@ -1079,11 +1086,13 @@ static size_t image_headersz_v1(int *hasext)
+ 	 */
+ 	headersz = sizeof(struct main_hdr_v1);
+ 
++#if defined(CONFIG_KWB_SECURE)
+ 	if (image_get_csk_index() >= 0) {
+ 		headersz += sizeof(struct secure_hdr_v1);
+ 		if (hasext)
+ 			*hasext = 1;
+ 	}
++#endif
+ 
+ 	cpu_sheeva = image_is_cpu_sheeva();
+ 
+@@ -1270,6 +1279,7 @@ err_close:
+ 	return -1;
+ }
+ 
++#if defined(CONFIG_KWB_SECURE)
+ static int export_pub_kak_hash(RSA *kak, struct secure_hdr_v1 *secure_hdr)
+ {
+ 	FILE *hashf;
+@@ -1382,6 +1392,7 @@ static int add_secure_header_v1(struct image_tool_params *params, uint8_t *ptr,
+ 
+ 	return 0;
+ }
++#endif
+ 
+ static void finish_register_set_header_v1(uint8_t **cur, uint8_t **next_ext,
+ 					  struct register_set_hdr_v1 *register_set_hdr,
+@@ -1406,7 +1417,9 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
+ 	struct main_hdr_v1 *main_hdr;
+ 	struct opt_hdr_v1 *ohdr;
+ 	struct register_set_hdr_v1 *register_set_hdr;
++#if defined(CONFIG_KWB_SECURE)
+ 	struct secure_hdr_v1 *secure_hdr = NULL;
++#endif
+ 	size_t headersz;
+ 	uint8_t *image, *cur;
+ 	int hasext = 0;
+@@ -1491,6 +1504,7 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
+ 	if (main_hdr->blockid == IBR_HDR_PEX_ID)
+ 		main_hdr->srcaddr = cpu_to_le32(0xFFFFFFFF);
+ 
++#if defined(CONFIG_KWB_SECURE)
+ 	if (image_get_csk_index() >= 0) {
+ 		/*
+ 		 * only reserve the space here; we fill the header later since
+@@ -1502,6 +1516,7 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
+ 		next_ext = &secure_hdr->next;
+ 	}
+ 
++#endif
+ 	datai = 0;
+ 	for (cfgi = 0; cfgi < cfgn; cfgi++) {
+ 		e = &image_cfg[cfgi];
+@@ -1552,9 +1567,11 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
+ 					      &datai, delay);
+ 	}
+ 
++#if defined(CONFIG_KWB_SECURE)
+ 	if (secure_hdr && add_secure_header_v1(params, ptr, payloadsz + headersz,
+ 					       headersz, image, secure_hdr))
+ 		return NULL;
++#endif
+ 
+ 	*imagesz = headersz;
+ 
+-- 
+2.39.2
+

base-commit: 428b810ca23fa1c1c565da15c0e95273f6487384
-- 
2.40.1