Skip to contentSkip to conversation

Add qemu-riscv64 target, refactorings, kernel updates, CI fix

PATCH New Jan Kiszka 1 participant 13 messages Oct 4, 2022 RISC-V

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

cover Add qemu-riscv64 target, refactorings, kernel updates, CI fix

CIP has decided to add RISC-V 64-bit as architecture to the support scope of kernel 5.10-cip. This implies adding a new reference target, qemu-riscv64, for which this series adds support to isar-cip-core.

As we know, only Debian bookworm may introduce riscv64 as official port, so we need to go with sid ports for now, using snapshot.debian.org with a fixed date as "stable" baseline. Please be patient during the first download, it can easily take more than half an hour, but Isar is caching the results for any later rebuild. And as I do not trust that even this works reliably, I'm refraining from adding the new target to CI for now.

And this works around current CI issues with deb.debian.org downloads when running in a AWS environment by allows to set DISTRO_APT_PREMIRRORS at gitlab project level.

Jan

Jan Kiszka (12):
ci: Allow to set per-project DISTRO_APT_PREMIRRORS
Kconfig: Introduce hidden ARCH configs
Kconfig: Hide kernel 4.4 for arm64 targets
start-qemu: Rework usage output
Bump kas header version to 12
kas: Drop defaults from bblayers_conf_header
linux-cip: Update to 4.19.259-cip82, 5.10.145-cip17 and

    5.10.145-cip17-rt7

Update Isar revision
deploy-cip-core: Use multi-threaded compression Add qemu-riscv64 target
customizations: Mask hvc0 console under qemu-riscv64
start-qemu: Add support for RISC-V

 .gitlab-ci.yml                                |  1 +
 Kconfig                                       | 45 +++++++++++++++++++
 .../distro/cip-core-sid-ports.conf            |  7 +--
 conf/distro/debian-sid-ports.list             |  2 +
 conf/distro/debian-sid.list                   |  2 +
 .../machine/qemu-riscv64.conf                 |  6 +--
 doc/README.secureboot.md                      |  2 +-
 kas-cip.yml                                   |  9 ++--
 kas/board/bbb.yml                             |  2 +-
 kas/board/hihope-rzg2m.yml                    |  2 +-
 kas/board/iwg20m.yml                          |  2 +-
 kas/board/qemu-amd64.yml                      |  2 +-
 kas/board/qemu-arm.yml                        |  2 +-
 kas/board/qemu-arm64.yml                      |  2 +-
 .../buster.yml => board/qemu-riscv64.yml}     |  7 +--
 kas/board/simatic-ipc227e.yml                 |  2 +-
 kas/opt/4.19.yml                              |  2 +-
 kas/opt/4.4.yml                               |  2 +-
 kas/opt/5.10.yml                              |  2 +-
 kas/opt/bullseye.yml                          |  2 +-
 kas/opt/buster.yml                            |  2 +-
 kas/opt/ebg-secure-boot-snakeoil.yml          |  2 +-
 kas/opt/ebg-swu.yml                           |  2 +-
 kas/opt/kernel-panic.yml                      |  2 +-
 kas/opt/kernelci.yml                          |  2 +-
 kas/opt/rt.yml                                |  2 +-
 kas/opt/security.yml                          |  2 +-
 kas/opt/{buster.yml => sid-ports.yml}         |  4 +-
 kas/opt/swupdate.yml                          |  2 +-
 kas/opt/targz-img.yml                         |  2 +-
 kas/opt/test.yml                              |  2 +-
 kas/opt/wic-targz-img.yml                     |  2 +-
 recipes-core/customizations/customizations.bb |  8 ++++
 ....bb => linux-cip-rt_5.10.145-cip17-rt7.bb} |  2 +-
 ...7-cip81.bb => linux-cip_4.19.259-cip82.bb} |  2 +-
 ...0-cip16.bb => linux-cip_5.10.145-cip17.bb} |  2 +-
 scripts/deploy-cip-core.sh                    |  2 +-
 start-qemu.sh                                 | 29 +++++++++---
 38 files changed, 125 insertions(+), 49 deletions(-)
 copy kas/opt/buster.yml => conf/distro/cip-core-sid-ports.conf (50%)
 create mode 100644 conf/distro/debian-sid-ports.list
 create mode 100644 conf/distro/debian-sid.list
 copy kas/opt/buster.yml => conf/machine/qemu-riscv64.conf (65%)
 copy kas/{opt/buster.yml => board/qemu-riscv64.yml} (55%)
 copy kas/opt/{buster.yml => sid-ports.yml} (79%)
 rename recipes-kernel/linux/{linux-cip-rt_5.10.140-cip16-rt6.bb => linux-cip-rt_5.10.145-cip17-rt7.bb} (72%)
 rename recipes-kernel/linux/{linux-cip_4.19.257-cip81.bb => linux-cip_4.19.259-cip82.bb} (72%)
 rename recipes-kernel/linux/{linux-cip_5.10.140-cip16.bb => linux-cip_5.10.145-cip17.bb} (72%)
Signature · 1 line
2.35.3
author
#1 lore raw

PATCH 1/12 ci: Allow to set per-project DISTRO_APT_PREMIRRORS

From: Jan Kiszka <[email protected]>

Can be helpful to work around deb.debian.org glitches, specifically when the distance of a runner to its next mirror is well known.

To allow passing this to bitbake, kas has to list this variable explicitly.

---
 .gitlab-ci.yml | 1 +
 kas-cip.yml    | 3 +++
 2 files changed, 4 insertions(+)
.gitlab-ci.yml +1 -0
index ce40b5d7..f7c8c889 100644
@@ -22,6 +22,7 @@ default:
     - export no_proxy=$NO_PROXY
     - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
     - export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
+    - export DISTRO_APT_PREMIRRORS=$DISTRO_APT_PREMIRRORS
 
 .build_base:
   stage: build
kas-cip.yml +3 -0
index d005b812..4956da5c 100644
@@ -41,3 +41,6 @@ local_conf_header:
     USERS += "root"
     # 'root'
     USER_root[password] = "oC3wEGl799tZU"
+
+env:
+  DISTRO_APT_PREMIRRORS: ""
Signature · 1 line
2.35.3
author
#2 lore raw

PATCH 2/12 Kconfig: Introduce hidden ARCH configs

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Those will allow to model architecture dependencies. No functional changes yet.

---
 Kconfig | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
Kconfig +30 -0
index d87e0a6d..561bd9a8 100644
@@ -1,3 +1,14 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2021-2022
+#
+# Authors:
+#  Jan Kiszka <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
 mainmenu "Isar core layer of the Civil Infrastructure Platform project"
 
 config KAS_INCLUDE_MAIN
@@ -8,30 +19,49 @@ config KAS_BUILD_SYSTEM
 	string
 	default "isar"
 
+config ARCH_AMD64
+	bool
+
+config ARCH_ARM64
+	bool
+
+config ARCH_ARM
+	bool
+
+config ARCH_RISCV64
+	bool
+
 choice
 	prompt "Target board"
 	default TARGET_QEMU_AMD64
 
 config TARGET_QEMU_AMD64
 	bool "QEMU AMD64 (x86-64)"
+	select ARCH_AMD64
 
 config TARGET_SIMATIC_IPC227E
 	bool "Siemens SIMATIC IPC227E"
+	select ARCH_AMD64
 
 config TARGET_QEMU_ARM64
 	bool "QEMU ARM64 (aarch64)"
+	select ARCH_ARM64
 
 config TARGET_HIHOPE_RZG2M
 	bool "HopeRun HiHope-RZ/G2M"
+	select ARCH_ARM64
 
 config TARGET_QEMU_ARM
 	bool "QEMU ARM (armhf)"
+	select ARCH_ARM
 
 config TARGET_BBB
 	bool "BeagleBone Black"
+	select ARCH_ARM
 
 config TARGET_IWG20D
 	bool "iWave Systems RainboW-G20D-Qseven"
+	select ARCH_ARM
 
 endchoice
 
Signature · 1 line
2.35.3
author
#3 lore raw

PATCH 3/12 Kconfig: Hide kernel 4.4 for arm64 targets

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

CIP kernel 4.4 does not officially support the arm64 architecture.

---
 Kconfig | 1 +
 1 file changed, 1 insertion(+)
Kconfig +1 -0
index 561bd9a8..45637de8 100644
@@ -83,6 +83,7 @@ choice
 
 config KERNEL_4_4
 	bool "Kernel 4.4.x-cip"
+	depends on !ARCH_ARM64
 
 config KERNEL_4_19
 	bool "Kernel 4.19.x-cip"
Signature · 1 line
2.35.3
author
#4 lore raw

PATCH 4/12 start-qemu: Rework usage output

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Avoid "echo -e", not supported with all shells.

Refactor the environment help to make it better readable. Add missing variables at this chance.

---
 start-qemu.sh | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
start-qemu.sh +7 -4
index bcc7a518..c8d4f47c 100755
@@ -13,10 +13,13 @@
 usage()
 {
 	echo "Usage: $0 ARCHITECTURE [QEMU_OPTIONS]"
-	echo -e "\nSet QEMU_PATH environment variable to use a locally " \
-		"built QEMU version"
-	echo -e "\nSet SWUPDATE_BOOT environment variable to boot swupdate image." \
-	echo -e "\nSet SECURE_BOOT environment variable to boot a secure boot environment."
+	echo
+	echo "Environment variables (default to settings in .config.yml):"
+	echo "  QEMU_PATH         use a locally built QEMU version"
+	echo "  SWUPDATE_BOOT     boot swupdate image"
+	echo "  SECURE_BOOT       start a secure boot environment"
+	echo "  DISTRO_RELEASE    select a specific Debian release"
+	echo "  TARGET_IMAGE      select a specific image type"
 	exit 1
 }
 
Signature · 1 line
2.35.3
author
#5 lore raw

PATCH 5/12 Bump kas header version to 12

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

We already adopted 11 with repo-relative includes.

---
 doc/README.secureboot.md             | 2 +-
 kas-cip.yml                          | 2 +-
 kas/board/bbb.yml                    | 2 +-
 kas/board/hihope-rzg2m.yml           | 2 +-
 kas/board/iwg20m.yml                 | 2 +-
 kas/board/qemu-amd64.yml             | 2 +-
 kas/board/qemu-arm.yml               | 2 +-
 kas/board/qemu-arm64.yml             | 2 +-
 kas/board/simatic-ipc227e.yml        | 2 +-
 kas/opt/4.19.yml                     | 2 +-
 kas/opt/4.4.yml                      | 2 +-
 kas/opt/5.10.yml                     | 2 +-
 kas/opt/bullseye.yml                 | 2 +-
 kas/opt/buster.yml                   | 2 +-
 kas/opt/ebg-secure-boot-snakeoil.yml | 2 +-
 kas/opt/ebg-swu.yml                  | 2 +-
 kas/opt/kernel-panic.yml             | 2 +-
 kas/opt/kernelci.yml                 | 2 +-
 kas/opt/rt.yml                       | 2 +-
 kas/opt/security.yml                 | 2 +-
 kas/opt/swupdate.yml                 | 2 +-
 kas/opt/targz-img.yml                | 2 +-
 kas/opt/test.yml                     | 2 +-
 kas/opt/wic-targz-img.yml            | 2 +-
 24 files changed, 24 insertions(+), 24 deletions(-)
doc/README.secureboot.md +1 -1
index 319b4db0..b6ad9e06 100644
@@ -145,7 +145,7 @@ kas-container build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-secure-boot
 For user-generated keys, create a new option file in the repository. This option file could look like this:
 ```
 header:
-  version: 10
+  version: 12
   includes:
    - kas/opt/ebg-secure-boot-base.yml
 
kas-cip.yml +1 -1
index 4956da5c..6b9d5a23 100644
@@ -10,7 +10,7 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 distro: cip-core-bullseye
 target: cip-core-image
kas/board/bbb.yml +1 -1
index 13f0a7f6..c99d9bd4 100644
@@ -10,6 +10,6 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 machine: bbb
kas/board/hihope-rzg2m.yml +1 -1
index 9d11bb6b..7b80de7c 100644
@@ -10,6 +10,6 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 machine: hihope-rzg2m
kas/board/iwg20m.yml +1 -1
index 2e74ad13..c873b987 100644
@@ -10,6 +10,6 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 machine: iwg20m
kas/board/qemu-amd64.yml +1 -1
index 06e9e180..f9f57be9 100644
@@ -10,6 +10,6 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 machine: qemu-amd64
kas/board/qemu-arm.yml +1 -1
index 9bf97283..fe030286 100644
@@ -11,6 +11,6 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 machine: qemu-arm
kas/board/qemu-arm64.yml +1 -1
index 823964d8..55690b3f 100644
@@ -11,6 +11,6 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 machine: qemu-arm64
kas/board/simatic-ipc227e.yml +1 -1
index 70cf88e7..82b0ff79 100644
@@ -10,6 +10,6 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 machine: simatic-ipc227e
kas/opt/4.19.yml +1 -1
index 5ff16839..5e79223d 100644
@@ -10,7 +10,7 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 local_conf_header:
   kernel-version: |
kas/opt/4.4.yml +1 -1
index 65a47757..970351ac 100644
@@ -10,7 +10,7 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 local_conf_header:
   kernel-version: |
kas/opt/5.10.yml +1 -1
index 612b7f9e..2258575c 100644
@@ -10,7 +10,7 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 local_conf_header:
   kernel-version: |
kas/opt/bullseye.yml +1 -1
index 24a4c848..b08e0e41 100644
@@ -10,6 +10,6 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 distro: cip-core-bullseye
kas/opt/buster.yml +1 -1
index a7621633..9b0b530f 100644
@@ -10,6 +10,6 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 distro: cip-core-buster
kas/opt/ebg-secure-boot-snakeoil.yml +1 -1
index ff65e99f..f756ceea 100644
@@ -10,7 +10,7 @@
 #
 
 header:
-  version: 10
+  version: 12
   includes:
     - kas/opt/ebg-swu.yml
 
kas/opt/ebg-swu.yml +1 -1
index 8b3ffec4..b534c504 100644
@@ -10,7 +10,7 @@
 #
 
 header:
-  version: 10
+  version: 12
   includes:
    - kas/opt/swupdate.yml
 
kas/opt/kernel-panic.yml +1 -1
index 47df7b16..9aac8b24 100644
@@ -11,7 +11,7 @@
 # This kas file adds systemd service file to cause kernel panic during system boot.
 
 header:
-  version: 10
+  version: 12
 
 local_conf_header:
   kernel-panic: |
kas/opt/kernelci.yml +1 -1
index 9c67864f..b5fadcb9 100644
@@ -11,6 +11,6 @@
 # SPDX-License-Identifier: MIT
 #
 header:
-  version: 10
+  version: 12
 
 target: cip-core-image-kernelci
kas/opt/rt.yml +1 -1
index b8fe6bb6..4b2519f1 100644
@@ -10,7 +10,7 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 local_conf_header:
   preempt-rt: |
kas/opt/security.yml +1 -1
index 3cf88afa..4e74a9c4 100644
@@ -9,6 +9,6 @@
 # SPDX-License-Identifier: MIT
 #
 header:
-  version: 10
+  version: 12
 
 target: cip-core-image-security
kas/opt/swupdate.yml +1 -1
index 8ba03c9a..ea8bac3d 100644
@@ -12,7 +12,7 @@
 # from the first wic partition
 
 header:
-  version: 10
+  version: 12
 
 local_conf_header:
   image-option-swupdate: |
kas/opt/targz-img.yml +1 -1
index afe2e074..8283ef88 100644
@@ -10,7 +10,7 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 local_conf_header:
   image-type: |
kas/opt/test.yml +1 -1
index ee481966..411582bd 100644
@@ -9,7 +9,7 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 local_conf_header:
   testing: |
kas/opt/wic-targz-img.yml +1 -1
index aaee76d8..3d908de6 100644
@@ -10,7 +10,7 @@
 #
 
 header:
-  version: 10
+  version: 12
 
 # lava uses nfs to deploy the image. For this we need a tarball instead of
 # full image
Signature · 1 line
2.35.3
author
#6 lore raw

PATCH 6/12 kas: Drop defaults from bblayers_conf_header

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Already set by kas since revision 11.

---
 kas-cip.yml | 2 --
 1 file changed, 2 deletions(-)
kas-cip.yml +0 -2
index 6b9d5a23..6efdce98 100644
@@ -29,8 +29,6 @@ repos:
 bblayers_conf_header:
   standard: |
     LCONF_VERSION = "6"
-    BBPATH = "${TOPDIR}"
-    BBFILES ?= ""
 
 local_conf_header:
   standard: |
Signature · 1 line
2.35.3
author
#7 lore raw

PATCH 7/12 linux-cip: Update to 4.19.259-cip82, 5.10.145-cip17 and 5.10.145-cip17-rt7

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

---
 ...5.10.140-cip16-rt6.bb => linux-cip-rt_5.10.145-cip17-rt7.bb} | 2 +-
 ...{linux-cip_4.19.257-cip81.bb => linux-cip_4.19.259-cip82.bb} | 2 +-
 ...{linux-cip_5.10.140-cip16.bb => linux-cip_5.10.145-cip17.bb} | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
 rename recipes-kernel/linux/{linux-cip-rt_5.10.140-cip16-rt6.bb => linux-cip-rt_5.10.145-cip17-rt7.bb} (72%)
 rename recipes-kernel/linux/{linux-cip_4.19.257-cip81.bb => linux-cip_4.19.259-cip82.bb} (72%)
 rename recipes-kernel/linux/{linux-cip_5.10.140-cip16.bb => linux-cip_5.10.145-cip17.bb} (72%)
recipes-kernel/linux/linux-cip-rt_5.10.145-cip17-rt7.bb renamed from recipes-kernel/linux/linux-cip-rt_5.10.140-cip16-rt6.bb +1 -1
similarity index 72%
rename from recipes-kernel/linux/linux-cip-rt_5.10.140-cip16-rt6.bb
rename to recipes-kernel/linux/linux-cip-rt_5.10.145-cip17-rt7.bb
index fc895db1..0cb2a1dd 100644
@@ -13,4 +13,4 @@ require linux-cip-rt-common.inc
 
 KERNEL_DEFCONFIG_VERSION ?= "5.10.y-cip"
 
-SRC_URI[sha256sum] = "a59d2994a826c0a1a62e8631f482c6caa98faf87355d7b47868ce7ce17c2e9ce"
+SRC_URI[sha256sum] = "a5598f7f673b3ef819d6ed24f08d539eecb6febd11673a1d4752a1c05d4ee289"
recipes-kernel/linux/linux-cip_4.19.259-cip82.bb renamed from recipes-kernel/linux/linux-cip_4.19.257-cip81.bb +1 -1
similarity index 72%
rename from recipes-kernel/linux/linux-cip_4.19.257-cip81.bb
rename to recipes-kernel/linux/linux-cip_4.19.259-cip82.bb
index 10676722..d728e2bf 100644
@@ -13,4 +13,4 @@ require linux-cip-common.inc
 
 KERNEL_DEFCONFIG_VERSION ?= "4.19.y-cip"
 
-SRC_URI[sha256sum] = "9337fca3b8f981bd26884a3fd1035296ce5db8b458c776b73114e3e476423737"
+SRC_URI[sha256sum] = "b29e7d90959b29c67a0afa4432937fcc51138b519d33f24ff2ce976fbd958ffd"
recipes-kernel/linux/linux-cip_5.10.145-cip17.bb renamed from recipes-kernel/linux/linux-cip_5.10.140-cip16.bb +1 -1
similarity index 72%
rename from recipes-kernel/linux/linux-cip_5.10.140-cip16.bb
rename to recipes-kernel/linux/linux-cip_5.10.145-cip17.bb
index 9ed9ea6c..b4bf6b7b 100644
@@ -13,4 +13,4 @@ require linux-cip-common.inc
 
 KERNEL_DEFCONFIG_VERSION ?= "5.10.y-cip"
 
-SRC_URI[sha256sum] = "0bc556457854220e82e6e4f738ddccf92875817f28a0d0643d005fa9038935d0"
+SRC_URI[sha256sum] = "4594c147bdc493c7c286688542bbe65e550fb7bd58e0649ec587a2fe893ec0ee"
Signature · 1 line
2.35.3
author
#8 lore raw

PATCH 8/12 Update Isar revision

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Brings a couple of smaller fixes. None of them should have direct impact on this layer, but possibly on downstreams.

---
 kas-cip.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kas-cip.yml +1 -1
index 6efdce98..24062c50 100644
@@ -22,7 +22,7 @@ repos:
 
   isar:
     url: https://github.com/ilbers/isar.git
-    refspec: 8dfa97cf6e25a7adec2e02c50c5ef6329f31931b
+    refspec: 0daa55195f0f55465a367aec1ceeec5f26c161af
     layers:
       meta:
 
Signature · 1 line
2.35.3
author
#9 lore raw

PATCH 9/12 deploy-cip-core: Use multi-threaded compression

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Should accelerate this step a bit.

---
 scripts/deploy-cip-core.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/deploy-cip-core.sh +1 -1
index 1eb93d59..ab984686 100755
@@ -30,7 +30,7 @@ S3_TARGET=s3://download2.cip-project.org/cip-core/$REF/$TARGET/
 
 if [ -f $BASE_PATH.wic ] ; then
 	echo "Compressing $BASE_FILENAME.wic..."
-	xz -9 -k $BASE_PATH.wic
+	xz -9 -k -T0 $BASE_PATH.wic
 
 	echo "Uploading artifacts..."
 	aws s3 cp --no-progress --acl public-read $BASE_PATH.wic.xz ${S3_TARGET}
Signature · 1 line
2.35.3
author
#10 lore raw

PATCH 10/12 Add qemu-riscv64 target

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

RISC-V is not yet an official Debian port, so we need to pick sid-ports as source. And that means things can break randomly, as today. Therefore pick a version that builds and runs from snapshot.d.o.

Note that fetching from snapshot.d.o can be slow due to throttling or may even fail. Let's hope things will get stable with bookworm.

---
 Kconfig                             | 16 +++++++++++++++-
 conf/distro/cip-core-sid-ports.conf | 16 ++++++++++++++++
 conf/distro/debian-sid-ports.list   |  2 ++
 conf/distro/debian-sid.list         |  2 ++
 conf/machine/qemu-riscv64.conf      | 15 +++++++++++++++
 kas/board/qemu-riscv64.yml          | 12 ++++++++++++
 kas/opt/sid-ports.yml               | 15 +++++++++++++++
 7 files changed, 77 insertions(+), 1 deletion(-)
 create mode 100644 conf/distro/cip-core-sid-ports.conf
 create mode 100644 conf/distro/debian-sid-ports.list
 create mode 100644 conf/distro/debian-sid.list
 create mode 100644 conf/machine/qemu-riscv64.conf
 create mode 100644 kas/board/qemu-riscv64.yml
 create mode 100644 kas/opt/sid-ports.yml
Kconfig +15 -1
index 45637de8..cd24ce24 100644
@@ -63,6 +63,10 @@ config TARGET_IWG20D
 	bool "iWave Systems RainboW-G20D-Qseven"
 	select ARCH_ARM
 
+config TARGET_QEMU_RISCV64
+	bool "QEMU RISC-V 64-bit (riscv64)"
+	select ARCH_RISCV64
+
 endchoice
 
 config KAS_INCLUDE_BOARD
@@ -74,6 +78,7 @@ config KAS_INCLUDE_BOARD
 	default "kas/board/qemu-arm.yml" if TARGET_QEMU_ARM
 	default "kas/board/bbb.yml" if TARGET_BBB
 	default "kas/board/iwg20m.yml" if TARGET_IWG20D
+	default "kas/board/qemu-riscv64.yml" if TARGET_QEMU_RISCV64
 
 comment "Kernel options"
 
@@ -83,10 +88,11 @@ choice
 
 config KERNEL_4_4
 	bool "Kernel 4.4.x-cip"
-	depends on !ARCH_ARM64
+	depends on !ARCH_ARM64 && !ARCH_RISCV64
 
 config KERNEL_4_19
 	bool "Kernel 4.19.x-cip"
+	depends on !ARCH_RISCV64
 
 config KERNEL_5_10
 	bool "Kernel 5.10.x-cip"
@@ -101,6 +107,7 @@ config KAS_INCLUDE_KERNEL
 
 config KERNEL_RT
 	bool "Real-time CIP kernel"
+	depends on !ARCH_RISCV64
 
 config KAS_INCLUDE_KERNEL_RT
 	string
@@ -115,9 +122,15 @@ choice
 
 config DEBIAN_BUSTER
 	bool "buster (10)"
+	depends on !ARCH_RISCV64
 
 config DEBIAN_BULLSEYE
 	bool "bullseye (11)"
+	depends on !ARCH_RISCV64
+
+config DEBIAN_SID_PORTS
+	bool "sid (unstable) with unofficial ports"
+	depends on ARCH_RISCV64
 
 endchoice
 
@@ -125,6 +138,7 @@ config KAS_INCLUDE_DEBIAN
 	string
 	default "kas/opt/buster.yml" if DEBIAN_BUSTER
 	default "kas/opt/bullseye.yml" if DEBIAN_BULLSEYE
+	default "kas/opt/sid-ports.yml" if DEBIAN_SID_PORTS
 
 comment "Image features"
 
conf/distro/cip-core-sid-ports.conf new file +16 -0
new file mode 100644
index 00000000..0b369bb6
@@ -0,0 +1,16 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2022
+#
+# Authors:
+#  Jan Kiszka <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+require conf/distro/debian-sid-ports.conf
+require cip-core-common.inc
+
+PREFERRED_VERSION_linux-cip ?= "5.10.%"
+PREFERRED_VERSION_linux-cip-rt ?= "5.10.%"
conf/distro/debian-sid-ports.list new file +2 -0
new file mode 100644
index 00000000..bf0f7a27
@@ -0,0 +1,2 @@
+deb	[check-valid-until=no] https://snapshot.debian.org/archive/debian-ports/20220925T001806Z sid main
+deb-src	[check-valid-until=no] https://snapshot.debian.org/archive/debian/20220925T001806Z sid main
conf/distro/debian-sid.list new file +2 -0
new file mode 100644
index 00000000..46d34d76
@@ -0,0 +1,2 @@
+deb	[check-valid-until=no] https://snapshot.debian.org/archive/debian/20220925T001806Z sid main
+deb-src	[check-valid-until=no] https://snapshot.debian.org/archive/debian/20220925T001806Z sid main
conf/machine/qemu-riscv64.conf new file +15 -0
new file mode 100644
index 00000000..f1f3e871
@@ -0,0 +1,15 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2022
+#
+# Authors:
+#  Jan Kiszka <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+DISTRO_ARCH = "riscv64"
+
+IMAGE_FSTYPES ?= "ext4"
+KERNEL_DEFCONFIG ?= "defconfig"
kas/board/qemu-riscv64.yml new file +12 -0
new file mode 100644
index 00000000..0de158a8
@@ -0,0 +1,12 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2022
+#
+# SPDX-License-Identifier: MIT
+#
+
+header:
+  version: 12
+
+machine: qemu-riscv64
kas/opt/sid-ports.yml new file +15 -0
new file mode 100644
index 00000000..2e89f2b7
@@ -0,0 +1,15 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2022
+#
+# Authors:
+#  Jan Kiszka <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+header:
+  version: 12
+
+distro: cip-core-sid-ports
Signature · 1 line
2.35.3
author
#11 lore raw

PATCH 11/12 customizations: Mask hvc0 console under qemu-riscv64

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

RISC-V kernels tend to come with a virtual console via SBI. Under QEMU, this is redundant to the serial console that Linux support as well, giving two prompts on the UART. Disable the virtual on via systemd.

---
 recipes-core/customizations/customizations.bb | 8 ++++++++
 1 file changed, 8 insertions(+)
recipes-core/customizations/customizations.bb +8 -0
index 96e88ddb..c057d576 100644
@@ -12,3 +12,11 @@
 require common.inc
 
 DESCRIPTION = "CIP Core image demo & customizations"
+
+do_prepare_build_prepend_qemu-riscv64() {
+	if ! grep -q [email protected] ${WORKDIR}/postinst; then
+		# suppress SBI console - overlaps with serial console
+		echo >> ${WORKDIR}/postinst
+		echo "systemctl mask [email protected]" >> ${WORKDIR}/postinst
+	fi
+}
Signature · 1 line
2.35.3
author
#12 lore raw

PATCH 12/12 start-qemu: Add support for RISC-V

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Basically like ARM/ARM64. We just need to list the second console via virtio explicitly as the system will not pick it up automatically.

---
 start-qemu.sh | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
start-qemu.sh +17 -1
index c8d4f47c..68c0414a 100755
@@ -34,7 +34,9 @@ if [ -n "${QEMU_PATH}" ]; then
 fi
 
 if [ -z "${DISTRO_RELEASE}" ]; then
-	if grep -s -q "DEBIAN_BULLSEYE: true" .config.yaml; then
+	if grep -s -q "DEBIAN_SID_PORTS: true" .config.yaml; then
+		DISTRO_RELEASE="sid-ports"
+	elif grep -s -q "DEBIAN_BULLSEYE: true" .config.yaml; then
 		DISTRO_RELEASE="bullseye"
 	else
 		DISTRO_RELEASE="buster"
@@ -100,6 +102,20 @@ case "${arch}" in
 		KERNEL_CMDLINE=" \
 			root=/dev/vda rw"
 		;;
+	rv64|riscv64)
+		QEMU_ARCH=riscv64
+		QEMU=qemu-system-riscv64
+		QEMU_EXTRA_ARGS=" \
+			-cpu rv64 \
+			-smp 4 \
+			-machine virt \
+			-device virtio-serial-device \
+			-device virtconsole,chardev=con -chardev vc,id=con \
+			-device virtio-blk-device,drive=disk \
+			-device virtio-net-device,netdev=net"
+		KERNEL_CMDLINE=" \
+			console=hvc1 console=ttyS0 root=/dev/vda rw"
+		;;
 	""|--help)
 		usage
 		;;
Signature · 1 line
2.35.3