Skip to contentSkip to conversation

isar-cip-core: Fix lack of console option when starting qemu-amd64 with nographic

cip-dev New Akihiro Suzuki 2 participants 10 messages Mar 15, 2019 – Apr 3, 2019

lore
Share & tools
lore
#0 lore raw

I have added "console=ttyS0" to the kernel command line to be able to see a serial output when starting qemu-amd64 with nographic.

[PATCH] Add a console option to the kernel command line

I have already made a merge request in GitLab before sending this e-mail. If it's not in line with the workflow of isar-cip-core, please close it.
<https://gitlab.com/cip-project/cip-core/isar-cip-core/merge_requests/1>

Best regards,
Suzuki

#1 lore raw

PATCH 1/1 Add a console option to the kernel command line

This option is required when starting qemu-amd64 with nographic.

---
 start-qemu.sh | 1 +
 1 file changed, 1 insertion(+)
start-qemu.sh +1 -0
index b71ba32..52498fa 100755
@@ -79,6 +79,7 @@ INITRD_FILE=$(ls ${IMAGE_PREFIX}.initrd.img* | tail -1)
 
 if [ -z "${DISPLAY}" ]; then
 	QEMU_EXTRA_ARGS="${QEMU_EXTRA_ARGS} -nographic"
+	KERNEL_CMDLINE="${KERNEL_CMDLINE} console=ttyS0"
 fi
 
 shift 1
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/1 Add a console option to the kernel command line

Quoted 13 lines · Akihiro Suzuki

This option is required when starting qemu-amd64 with nographic.

---
  start-qemu.sh | 1 +
  1 file changed, 1 insertion(+)
start-qemu.sh +0 -0
index b71ba32..52498fa 100755

start-qemu.sh INITRD_FILE=$(ls ${IMAGE_PREFIX}.initrd.img* | tail -1) · line 85

Quoted 7 lines
start-qemu.sh +1 -0
@@ -79,6 +79,7 @@ INITRD_FILE=$(ls ${IMAGE_PREFIX}.initrd.img* | tail -1)
 
  if [ -z "${DISPLAY}" ]; then
  	QEMU_EXTRA_ARGS="${QEMU_EXTRA_ARGS} -nographic"
+	KERNEL_CMDLINE="${KERNEL_CMDLINE} console=ttyS0"
  fi
 
  shift 1

Valid point. But I think this should rather go to the original, per-target definition of KERNEL_CMDLINE. And we can make it unconditional, ie. provide a uart console independent of DISPLAY settings. That's how it is on ARM[64] already.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
#3 lore raw

PATCH 1/1 Add a console option to the kernel command line

Hi Jan,

I agree with your opinion.
We have to be able to use a uart console even if DISPLAY has a value.

But I couldn't understand the statement of "That's how it is on ARM[64] already". Could you explain it in more detail?
Do you mean that, on ARM[64], we don't have to add console option to KERNEL_CMDLINE on current start-qemu.sh?

Best regards,
Suzuki

Quoted 42 lines

-----Original Message-----
From: Jan Kiszka [mailto:jan.kiszka at siemens.com]
Sent: Friday, March 15, 2019 6:17 PM
To: suzuki akihiro(?? ?? ????????) <[email protected]>; cip-dev at lists.cip-project.org
Subject: Re: [cip-dev] [PATCH] Add a console option to the kernel command line

start-qemu.sh INITRD_FILE=$(ls ${IMAGE_PREFIX}.initrd.img* | tail

Quoted 12 lines · Akihiro Suzuki

This option is required when starting qemu-amd64 with nographic.

---
  start-qemu.sh | 1 +
  1 file changed, 1 insertion(+)
start-qemu.sh +0 -0
index b71ba32..52498fa 100755
@@ -79,6 +79,7 @@ INITRD_FILE=$(ls ${IMAGE_PREFIX}.initrd.img* | tail

-1)

start-qemu.sh INITRD_FILE=$(ls ${IMAGE_PREFIX}.initrd.img* | tail -1)

Quoted 8 lines
start-qemu.sh +1 -0
  if [ -z "${DISPLAY}" ]; then
  	QEMU_EXTRA_ARGS="${QEMU_EXTRA_ARGS} -nographic"
+	KERNEL_CMDLINE="${KERNEL_CMDLINE} console=ttyS0"
  fi
 
  shift 1
 

Valid point. But I think this should rather go to the original, per-target definition of KERNEL_CMDLINE. And we can make it unconditional, ie. provide a
uart console independent of DISPLAY settings. That's how it is on ARM[64] already.

Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux

#4 lore raw

PATCH 1/1 Add a console option to the kernel command line

Quoted 9 lines · On 18.03.19 06:55, akihiro27.suzuki at toshiba.co.jp wrote:

Hi Jan,

I agree with your opinion.
We have to be able to use a uart console even if DISPLAY has a value.

But I couldn't understand the statement of "That's how it is on ARM[64] already". Could you explain it in more detail?
Do you mean that, on ARM[64], we don't have to add console option to KERNEL_CMDLINE on current start-qemu.sh?

On ARM, QEMU ensures that the guest uses the UART by injecting this as console into its device tree. This mechanism is not available on the x86 boot, therefore we need to set this on the command line.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
#5 lore raw

PATCH v2 1/1 start-qemu.sh: Set console when using qemu-amd64 with nographic

Hi Jan,

Sorry for my late reply.

I have created a new patch.
After applying the patch, "console=ttyS0" is added to KERNEL_CMDLINE only when you use qemu-system-x86_64 with "-nographic" option.

Best regards,
Suzuki

#6 lore raw

PATCH 1/1 start-qemu.sh: Set console when using qemu-amd64 with nographic

---
 start-qemu.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
start-qemu.sh +8 -1
index b71ba32..46b7961 100755
@@ -83,8 +83,15 @@ fi
 
 shift 1
 
+QEMU_EXTRA_ARGS="${QEMU_EXTRA_ARGS} $@"
+if [ -n "`echo ${QEMU_EXTRA_ARGS} | grep -- -nographic`" ]; then
+	if [ ${DISTRO_ARCH} = "amd64" ]; then
+		KERNEL_CMDLINE="${KERNEL_CMDLINE} console=ttyS0"
+	fi
+fi
+
 ${QEMU_PATH}${QEMU} \
 	-drive file=${IMAGE_FILE},discard=unmap,if=none,id=disk,format=raw \
 	-m 1G -serial mon:stdio -netdev user,id=net \
 	-kernel ${KERNEL_FILE} -append "${KERNEL_CMDLINE}" \
-	-initrd ${INITRD_FILE} ${QEMU_EXTRA_ARGS} "$@"
+	-initrd ${INITRD_FILE} ${QEMU_EXTRA_ARGS}
Signature · 1 line
2.17.1
#7 lore raw

PATCH 1/1 start-qemu.sh: Set console when using qemu-amd64 with nographic

Quoted 17 lines · Akihiro Suzuki
---
 start-qemu.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
start-qemu.sh +3 -0
index b71ba32..46b7961 100755
@@ -83,8 +83,15 @@ fi
 
 shift 1
 
+QEMU_EXTRA_ARGS="${QEMU_EXTRA_ARGS} $@"
+if [ -n "`echo ${QEMU_EXTRA_ARGS} | grep -- -nographic`" ]; then
+	if [ ${DISTRO_ARCH} = "amd64" ]; then

start-qemu.sh fi · line 97

Quoted 10 lines
start-qemu.sh +5 -1
+		KERNEL_CMDLINE="${KERNEL_CMDLINE} console=ttyS0"
+	fi
+fi
+
 ${QEMU_PATH}${QEMU} \
 	-drive file=${IMAGE_FILE},discard=unmap,if=none,id=disk,format=raw \
 	-m 1G -serial mon:stdio -netdev user,id=net \
 	-kernel ${KERNEL_FILE} -append "${KERNEL_CMDLINE}" \
-	-initrd ${INITRD_FILE} ${QEMU_EXTRA_ARGS} "$@"
+	-initrd ${INITRD_FILE} ${QEMU_EXTRA_ARGS}

This is not what I meant. I was rather thinking of

start-qemu.sh +1 -1
index b71ba32..62522db 100755
@@ -32,7 +32,7 @@ case "$1" in
 			-device ide-hd,drive=disk \
 			-device virtio-net-pci,netdev=net"
 		KERNEL_CMDLINE=" \
-			root=/dev/sda vga=0x305"
+			root=/dev/sda vga=0x305 console=ttyS0"
 		;;
 	arm64|aarch64)
 		DISTRO_ARCH=arm64

As mentioned before, there is no reason to confine this to -nographic mode.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
#8 lore raw

PATCH 1/1 start-qemu.sh: Set console when using qemu-amd64 with nographic

Hi Jan,

Quoted 45 lines
Quoted 17 lines
---
 start-qemu.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
start-qemu.sh +3 -0
index b71ba32..46b7961 100755
@@ -83,8 +83,15 @@ fi
 
 shift 1
 
+QEMU_EXTRA_ARGS="${QEMU_EXTRA_ARGS} $@"
+if [ -n "`echo ${QEMU_EXTRA_ARGS} | grep -- -nographic`" ]; then
+	if [ ${DISTRO_ARCH} = "amd64" ]; then

start-qemu.sh fi · line 97

Quoted 10 lines
start-qemu.sh +5 -1
+		KERNEL_CMDLINE="${KERNEL_CMDLINE} console=ttyS0"
+	fi
+fi
+
 ${QEMU_PATH}${QEMU} \
 	-drive file=${IMAGE_FILE},discard=unmap,if=none,id=disk,format=raw \
 	-m 1G -serial mon:stdio -netdev user,id=net \
 	-kernel ${KERNEL_FILE} -append "${KERNEL_CMDLINE}" \
-	-initrd ${INITRD_FILE} ${QEMU_EXTRA_ARGS} "$@"
+	-initrd ${INITRD_FILE} ${QEMU_EXTRA_ARGS}

This is not what I meant. I was rather thinking of

start-qemu.sh +1 -1
index b71ba32..62522db 100755
@@ -32,7 +32,7 @@ case "$1" in
 			-device ide-hd,drive=disk \
 			-device virtio-net-pci,netdev=net"
 		KERNEL_CMDLINE=" \
-			root=/dev/sda vga=0x305"
+			root=/dev/sda vga=0x305 console=ttyS0"
 		;;
 	arm64|aarch64)
 		DISTRO_ARCH=arm64
Quoted 2 lines

As mentioned before, there is no reason to confine this to -nographic mode.

I'm sorry, I misunderstood.
The changes you have shown are enough to solve the issue. Could you commit and push it for me instead?

Best regards,
Suzuki

Quoted 61 lines

-----Original Message-----
From: Jan Kiszka [mailto:jan.kiszka at siemens.com]
Sent: Wednesday, April 03, 2019 6:15 PM
To: suzuki akihiro(?? ?? ????????) <[email protected]>
Cc: cip-dev at lists.cip-project.org
Subject: Re: [PATCH] start-qemu.sh: Set console when using qemu-amd64 with nographic

Quoted 17 lines · Akihiro Suzuki
---
 start-qemu.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
start-qemu.sh +3 -0
index b71ba32..46b7961 100755
@@ -83,8 +83,15 @@ fi
 
 shift 1
 
+QEMU_EXTRA_ARGS="${QEMU_EXTRA_ARGS} $@"
+if [ -n "`echo ${QEMU_EXTRA_ARGS} | grep -- -nographic`" ]; then
+	if [ ${DISTRO_ARCH} = "amd64" ]; then

start-qemu.sh fi · line 97

Quoted 10 lines
start-qemu.sh +5 -1
+		KERNEL_CMDLINE="${KERNEL_CMDLINE} console=ttyS0"
+	fi
+fi
+
 ${QEMU_PATH}${QEMU} \
 	-drive file=${IMAGE_FILE},discard=unmap,if=none,id=disk,format=raw \
 	-m 1G -serial mon:stdio -netdev user,id=net \
 	-kernel ${KERNEL_FILE} -append "${KERNEL_CMDLINE}" \
-	-initrd ${INITRD_FILE} ${QEMU_EXTRA_ARGS} "$@"
+	-initrd ${INITRD_FILE} ${QEMU_EXTRA_ARGS}

This is not what I meant. I was rather thinking of

start-qemu.sh +1 -1
index b71ba32..62522db 100755
@@ -32,7 +32,7 @@ case "$1" in
 			-device ide-hd,drive=disk \
 			-device virtio-net-pci,netdev=net"
 		KERNEL_CMDLINE=" \
-			root=/dev/sda vga=0x305"
+			root=/dev/sda vga=0x305 console=ttyS0"
 		;;
 	arm64|aarch64)
 		DISTRO_ARCH=arm64

As mentioned before, there is no reason to confine this to -nographic mode.

Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux

#9 lore raw

PATCH 1/1 start-qemu.sh: Set console when using qemu-amd64 with nographic

Quoted 47 lines · On 03.04.19 11:54, akihiro27.suzuki at toshiba.co.jp wrote:

Hi Jan,

Quoted 45 lines
Quoted 17 lines
---
  start-qemu.sh | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
start-qemu.sh +3 -0
index b71ba32..46b7961 100755
@@ -83,8 +83,15 @@ fi
 
  shift 1
 
+QEMU_EXTRA_ARGS="${QEMU_EXTRA_ARGS} $@"
+if [ -n "`echo ${QEMU_EXTRA_ARGS} | grep -- -nographic`" ]; then
+	if [ ${DISTRO_ARCH} = "amd64" ]; then

start-qemu.sh fi · line 97

Quoted 10 lines
start-qemu.sh +5 -1
+		KERNEL_CMDLINE="${KERNEL_CMDLINE} console=ttyS0"
+	fi
+fi
+
  ${QEMU_PATH}${QEMU} \
  	-drive file=${IMAGE_FILE},discard=unmap,if=none,id=disk,format=raw \
  	-m 1G -serial mon:stdio -netdev user,id=net \
  	-kernel ${KERNEL_FILE} -append "${KERNEL_CMDLINE}" \
-	-initrd ${INITRD_FILE} ${QEMU_EXTRA_ARGS} "$@"
+	-initrd ${INITRD_FILE} ${QEMU_EXTRA_ARGS}

This is not what I meant. I was rather thinking of

start-qemu.sh +1 -1
index b71ba32..62522db 100755
@@ -32,7 +32,7 @@ case "$1" in
  			-device ide-hd,drive=disk \
  			-device virtio-net-pci,netdev=net"
  		KERNEL_CMDLINE=" \
-			root=/dev/sda vga=0x305"
+			root=/dev/sda vga=0x305 console=ttyS0"
  		;;
  	arm64|aarch64)
  		DISTRO_ARCH=arm64
Quoted 6 lines
Quoted 2 lines

As mentioned before, there is no reason to confine this to -nographic mode.

I'm sorry, I misunderstood.
The changes you have shown are enough to solve the issue. Could you commit and push it for me instead?

Sure, patch pushed into next branch.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux