[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#928451: linux: riscv64 updates (change kernel image type to flat image and enable vdso)



Source: linux
Version: 5.0.10-1~exp1
Severity: wishlist
Tags: patch

Hello,

the riscv64 architecture is changing its standard kernel image
format from ELF to a flat kernel image with a PE/COFF-compatible
header (similar to arm64) to make EFI stub support possible, so
we need to ship arch/riscv/boot/Image instead of an ELF vmlinux. 
This also enables us to get rid of BBL (the RISC-V Berkeley
BootLoader) and make the move to U-Boot/GRUB on riscv64.

With kernel 5.0 we can now also enable the vdso config option in
the package for riscv64 as the necessary infrastructure is now in
the upstream kernel (this wasn't the case when riscv64 support
was originally added to the Debian kernel package).

Attached are two corresponding patches; alternatively they are
available as a merge request on salsa at

  https://salsa.debian.org/kernel-team/linux/merge_requests/145

The changes have been successfully tested on a qemu riscv64
"virt" system with OpenSBI and U-Boot.

Regards,
Karsten

Bootlog with the patches applied:
=================================

OpenSBI v0.3 (May  4 2019 20:32:00)
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name          : QEMU Virt Machine
Platform HART Features : RV64ACDFIMSU
Platform Max HARTs     : 8
Current Hart           : 0
Firmware Base          : 0x80000000
Firmware Size          : 100 KB
Runtime SBI Version    : 0.1

PMP0: 0x0000000080000000-0x000000008001ffff (A)
PMP1: 0x0000000000000000-0xffffffffffffffff (A,R,W,X)


U-Boot 2019.07-rc1-00001-g6b6a8d27ea-dirty (May 05 2019 - 01:05:15 +0200)

CPU:   rv64imafdcsu
Model: riscv-virtio,qemu
DRAM:  8 GiB
In:    uart@10000000
Out:   uart@10000000
Err:   uart@10000000
Net:   
Warning: virtio-net#2 using MAC address from ROM
eth0: virtio-net#2
Hit any key to stop autoboot:  0 

Device 0: QEMU VirtIO Block Device
            Type: Hard Disk
            Capacity: 204800.0 MB = 200.0 GB (419430400 x 512)
... is now current device
Scanning virtio 0:1...
Found U-Boot script /boot/boot.scr
281 bytes read in 1 ms (274.4 KiB/s)
## Executing script at 82100000
9073676 bytes read in 3 ms (2.8 GiB/s)
45823535 bytes read in 13 ms (3.3 GiB/s)
## Flattened Device Tree blob at ff77bd30
   Booting using the fdt blob at 0xff77bd30
   Using Device Tree in place at 00000000ff77bd30, end 00000000ff77fda5

Starting kernel ...

[    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[    0.000000] No DTB passed to the kernel
[    0.000000] Linux version 5.0.0-trunk-riscv64 (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-7)) #1 SMP Debian 5.0.10-1~exp1 (2019-03-22)
[    0.000000] Initial ramdisk at: 0x(____ptrval____) (45823535 bytes)
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000080200000-0x00000000ffffffff]
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000027fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080200000-0x000000027fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x000000027fffffff]
[    0.000000] software IO TLB: mapped [mem 0xfb77b000-0xff77b000] (64MB)
[    0.000000] elf_hwcap is 0x112d
[    0.000000] percpu: Embedded 19 pages/cpu s39192 r8192 d30440 u77824
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 2063880
[    0.000000] Kernel command line: console=ttyS0 rw root=/dev/vda1
[    0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes)
[    0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes)
[    0.000000] Sorting __ex_table...
[    0.000000] Memory: 8123324K/8386560K available (5111K kernel code, 649K rwdata, 1688K rodata, 454K init, 938K bss, 263236K reserved, 0K cma-reserved)
[    0.000000] random: get_random_u64 called from __kmem_cache_create+0x46/0x556 with crng_init=0
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] ftrace: allocating 21448 entries in 84 pages
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
[    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=4
[    0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
[    0.000000] plic: mapped 53 interrupts to 4 (out of 8) handlers.
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
[    0.000153] sched_clock: 64 bits at 10MHz, resolution 100ns, wraps every 4398046511100ns
[    0.004429] Console: colour dummy device 80x25
[    0.008666] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=40000)
[    0.008852] pid_max: default: 32768 minimum: 301
[    0.010075] LSM: Security Framework initializing
[    0.010291] Yama: disabled by default; enable with sysctl kernel.yama.*
[    0.012943] AppArmor: AppArmor initialized
[    0.013668] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes)
[    0.013788] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes)
[    0.047041] rcu: Hierarchical SRCU implementation.
[    0.059352] smp: Bringing up secondary CPUs ...
[    0.076029] smp: Brought up 1 node, 4 CPUs
[    0.124450] devtmpfs: initialized
[    0.141761] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.142069] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.150389] NET: Registered protocol family 16
[    0.152517] audit: initializing netlink subsys (disabled)
[    0.154910] audit: type=2000 audit(0.140:1): state=initialized audit_enabled=0 res=1
[    0.195040] vgaarb: loaded
[    0.196393] pps_core: LinuxPPS API ver. 1 registered
[    0.196451] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.196601] PTP clock support registered
[    0.211641] clocksource: Switched to clocksource riscv_clocksource
[    0.325442] VFS: Disk quotas dquot_6.6.0
[    0.325732] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.329830] AppArmor: AppArmor Filesystem Enabled
[    0.409145] NET: Registered protocol family 2
[    0.416338] tcp_listen_portaddr_hash hash table entries: 4096 (order: 4, 65536 bytes)
[    0.416574] TCP established hash table entries: 65536 (order: 7, 524288 bytes)
[    0.417234] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes)
[    0.418074] TCP: Hash tables configured (established 65536 bind 65536)
[    0.419780] UDP hash table entries: 4096 (order: 5, 131072 bytes)
[    0.420298] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes)
[    0.422427] NET: Registered protocol family 1
[    0.422811] NET: Registered protocol family 44
[    0.428716] Unpacking initramfs...
[    4.949360] Initialise system trusted keyrings
[    4.952526] workingset: timestamp_bits=46 max_order=21 bucket_order=0
[    4.970380] zbud: loaded
[    7.470944] Key type asymmetric registered
[    7.471108] Asymmetric key parser 'x509' registered
[    7.472020] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[    7.473638] io scheduler mq-deadline registered
[    7.483814] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    7.498766] printk: console [ttyS0] disabled
[    7.500474] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 10, base_baud = 230400) is a 16550A
[    7.532602] printk: console [ttyS0] enabled
[    7.538274] mousedev: PS/2 mouse device common for all mice
[    7.542510] ledtrig-cpu: registered to indicate activity on CPUs
[    7.545993] NET: Registered protocol family 10
[    7.771131] Segment Routing with IPv6
[    7.772291] mip6: Mobile IPv6
[    7.772707] NET: Registered protocol family 17
[    7.774184] mpls_gso: MPLS GSO support
[    7.777244] registered taskstats version 1
[    7.777554] Loading compiled-in X.509 certificates
[    7.936282] Loaded X.509 cert 'Debian Secure Boot CA: 6ccece7e4c6c0d1f6149f3dd27dfcc5cbb419ea1'
[    7.937468] Loaded X.509 cert 'Debian Secure Boot Signer: 00a7468def'
[    7.938770] zswap: loaded using pool lzo/zbud
[    7.940568] AppArmor: AppArmor sha1 policy hashing enabled
[    7.941967] hctosys: unable to open rtc device (rtc0)
[    8.723031] Freeing unused kernel memory: 452K
[    8.723697] This architecture does not have kernel memory protection.
[    8.724225] Run /init as init process
Loading, please wait...
Starting version 241
[   12.067982] virtio_blk virtio1: [vda] 419430400 512-byte logical blocks (215 GB/200 GiB)
[   12.184343]  vda: vda1
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... done.
Begin: Will now check root file system ... fsck from util-linux 2.33.1
[/sbin/fsck.ext4 (1) -- /dev/vda1] fsck.ext4 -a -C0 /dev/vda1 
/dev/vda1: clean, 426952/13107200 files, 9795635/52428768 blocks
done.
[   19.852891] EXT4-fs (vda1): mounted filesystem with ordered data mode. Opts: (null)
done.
Begin: Running /scripts/local-bottom ... done.
Begin: Running /scripts/init-bottom ... done.
[   20.197688] random: fast init done
[   23.126161] hrtimer: interrupt took 15528000 ns
[   24.365058] systemd[1]: System time before build time, advancing clock.
[   24.902281] systemd[1]: Inserted module 'autofs4'
[   25.613041] systemd[1]: systemd 241 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid)
[   25.641857] systemd[1]: Detected architecture riscv64.

Welcome to Debian GNU/Linux 10 (buster)!

[   26.106167] systemd[1]: Set hostname to <riscv64>.
[   27.981084] random: systemd: uninitialized urandom read (16 bytes read)
[   28.064689] random: systemd: uninitialized urandom read (16 bytes read)
[   28.069330] systemd[1]: Listening on initctl Compatibility Named Pipe.
[  OK  ] Listening on initctl Compatibility Named Pipe.
[   28.075829] random: systemd: uninitialized urandom read (16 bytes read)
[   28.080579] systemd[1]: Listening on fsck to fsckd communication Socket.
[  OK  ] Listening on fsck to fsckd communication Socket.
[   28.106345] systemd[1]: Created slice User and Session Slice.
[  OK  ] Created slice User and Session Slice.
[   28.142166] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[  OK  ] Set up automount Arbitrary…s File System Automount Point.
[   28.162452] systemd[1]: Listening on Journal Socket.
[  OK  ] Listening on Journal Socket.
[   28.229247] systemd[1]: Starting Create list of required static device nodes for the current kernel...
         Starting Create list of re…odes for the current kernel...
[   28.239253] systemd[1]: Condition check resulted in File System Check on Root Device being skipped.
         Starting Remount Root and Kernel File Systems...
         Mounting Kernel Debug File System...
[  OK  ] Listening on Journal Socket (/dev/log).
[  OK  ] Started Forward Password R…uests to Wall Directory Watch.
         Mounting POSIX Message Queue File System...
[  OK  ] Listening on udev Control Socket.
[  OK  ] Created slice system-getty.slice.
[  OK  ] Reached target Remote File Systems.
[  OK  ] Listening on udev Kernel Socket.
         Starting udev Coldplug all Devices...
[  OK  ] Reached target System Time Synchronized.
[  OK  ] Reached target Slices.
[  OK  ] Listening on Journal Audit Socket.
[  OK  ] Started Dispatch Password …ts to Console Directory Watch.
[  OK  ] Reached target Local Encrypted Volumes.
[  OK  ] Listening on Syslog Socket.
[   28.556272] EXT4-fs (vda1): re-mounted. Opts: errors=remount-ro
[  OK  ] Created slice system-serial\x2dgetty.slice.
         Starting Load Kernel Modules...
[  OK  ] Reached target Swap.
         Starting Journal Service...
[  OK  ] Reached target Paths.
[  OK  ] Started Create list of req… nodes for the current kernel.
[  OK  ] Started Remount Root and Kernel File Systems.
[  OK  ] Mounted Kernel Debug File System.
[  OK  ] Mounted POSIX Message Queue File System.
[  OK  ] Started Load Kernel Modules.
         Starting Apply Kernel Variables...
         Starting Load/Save Random Seed...
         Starting Create System Users...
[  OK  ] Started Apply Kernel Variables.
[  OK  ] Started Journal Service.
[  OK  ] Started Load/Save Random Seed.
         Starting Flush Journal to Persistent Storage...
[  OK  ] Started Create System Users.
         Starting Create Static Device Nodes in /dev...
[   29.640454] systemd-journald[182]: Received request to flush runtime journal from PID 1
[  OK  ] Started Flush Journal to Persistent Storage.
[  OK  ] Started Create Static Device Nodes in /dev.
         Starting udev Kernel Device Manager...
[  OK  ] Reached target Local File Systems (Pre).
[  OK  ] Reached target Local File Systems.
         Starting Create Volatile Files and Directories...
[  OK  ] Started udev Coldplug all Devices.
         Starting Helper to synchronize boot up for ifupdown...
[  OK  ] Started udev Kernel Device Manager.
[  OK  ] Started Create Volatile Files and Directories.
[   30.874871] random: crng init done
[   30.875785] random: 7 urandom warning(s) missed due to ratelimiting
[  OK  ] Found device /dev/ttyS0.
[  OK  ] Started Helper to synchronize boot up for ifupdown.
         Starting Raise network interfaces...
         Starting Update UTMP about System Boot/Shutdown...
[  OK  ] Started Update UTMP about System Boot/Shutdown.
[  OK  ] Reached target System Initialization.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Started Periodic ext4 Onli…ata Check for All Filesystems.
[  OK  ] Reached target Basic System.
         Starting Login Service...
[  OK  ] Started D-Bus System Message Bus.
[  OK  ] Started Daily rotation of log files.
         Starting Deferred execution scheduler...
         Starting Remove Stale Onli…t4 Metadata Check Snapshots...
[  OK  ] Started Daily apt download activities.
[  OK  ] Started Daily man-db regeneration.
[  OK  ] Started Daily apt upgrade and clean activities.
         Starting Recover schroot sessions...
         Starting System Logging Service...
[  OK  ] Started Daily Cleanup of Temporary Directories.
[  OK  ] Reached target Timers.
[  OK  ] Started Regular background program processing daemon.
[  OK  ] Started Deferred execution scheduler.
[  OK  ] Started Login Service.
[  OK  ] Started System Logging Service.
[  OK  ] Started Remove Stale Onlin…ext4 Metadata Check Snapshots.
         Starting OpenNTPd Network Time Protocol...
[  OK  ] Started OpenNTPd Network Time Protocol.
[  OK  ] Started Raise network interfaces.
         Starting Online ext4 Metad…a Check for All Filesystems...
         Starting Rotate log files...
         Starting Daily man-db regeneration...
[  OK  ] Reached target Network.
         Starting Permit User Sessions...
         Starting OpenBSD Secure Shell server...
[  OK  ] Reached target Network is Online.
         Starting LSB: exim Mail Transport Agent...
         Starting Daily apt download activities...
[  OK  ] Started Permit User Sessions.
[  OK  ] Started Serial Getty on ttyS0.
[  OK  ] Started Getty on tty1.
[  OK  ] Reached target Login Prompts.
[  OK  ] Started OpenBSD Secure Shell server.
[  OK  ] Started Online ext4 Metadata Check for All Filesystems.
[  OK  ] Started Rotate log files.
[  OK  ] Started Recover schroot sessions.

Debian GNU/Linux 10 riscv64 ttyS0

riscv64 login: 

-- 
Ich widerspreche hiermit ausdrücklich der Nutzung sowie der
Weitergabe meiner personenbezogenen Daten für Zwecke der Werbung
sowie der Markt- oder Meinungsforschung.
>From de70ae43563da85568562e49c6f3bc1f27741dfc Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Sat, 4 May 2019 19:41:45 +0200
Subject: [PATCH 1/2] [riscv64] Change the kernel image format from ELF to flat
 Image.

The riscv64 architecture is changing its standard kernel image
format from ELF to a flat kernel image with a PE/COFF-compatible
header (similar to arm64) to make EFI stub support possible.
Ship arch/riscv/boot/Image instead of an ELF vmlinux in
accordance with this change.
---
 debian/config/riscv64/defines | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/config/riscv64/defines b/debian/config/riscv64/defines
index 2ea6d75977f1..e83b750ea74a 100644
--- a/debian/config/riscv64/defines
+++ b/debian/config/riscv64/defines
@@ -4,7 +4,7 @@ featuresets:
  none
 
 [build]
-image-file: vmlinux
+image-file: arch/riscv/boot/Image
 
 [image]
 install-stem: vmlinux
-- 
2.20.1

>From 5fda00263bfe81d8a62dd4162c66527b51ea1755 Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Sat, 4 May 2019 19:51:14 +0200
Subject: [PATCH 2/2] [riscv64] Enable vdso

When riscv64 support was originally added to the Debian Linux
kernel package, the mainline kernel lacked a vdso_install target
for riscv64.  This has in the meantime been added with upstream
commit f157d411a9eb170d2ee6b766da7a381962017cc9 ("riscv: add
missing vdso_install target"), so we can now enable the
corresponding option in the kernel package.
---
 debian/config/riscv64/defines | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/config/riscv64/defines b/debian/config/riscv64/defines
index e83b750ea74a..1d5a58b7313a 100644
--- a/debian/config/riscv64/defines
+++ b/debian/config/riscv64/defines
@@ -5,6 +5,7 @@ featuresets:
 
 [build]
 image-file: arch/riscv/boot/Image
+vdso: true
 
 [image]
 install-stem: vmlinux
-- 
2.20.1


Reply to: