All of lore.kernel.org
 help / color / mirror / Atom feed
* Status of 'unicore32' architecture in Linux kernel
@ 2014-08-31 23:51 Guenter Roeck
  2014-09-01  4:00 ` Chen Gang
  2014-09-02 14:03 ` 回复: " Xuetao Guan 
  0 siblings, 2 replies; 15+ messages in thread
From: Guenter Roeck @ 2014-08-31 23:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: Guan Xuetao, Chen Gang, Grant Likely

Status of 'unicore32' architecture in Linux kernel
--------------------------------------------------

The idea was to create a working kernel and initramfs for the ongoing Linux
kernel test project. This summary describes the result of this effort.

Overall, conclusion is that the architecture would need some work
(both in qemu and the kernel itself) to make it testable with qemu.

Guenter

---------------------
Toolchain used was from [1]. I did not attempt to build my own toolchain.

Configuration:

make ARCH=unicore32 defconfig && make ARCH=unicore32

This configuration currently fails to build in the upstream kernel.
A patch to fix the problem has been submitted and is pending upstream
integration [2]. With this patch merged, the 'defconfig' image can
be built.

----------------
qemu

Attempts to load the unicore32:defconfig image with qemu failed.

Research points to [3], which includes a working unicore32 linux kernel
in its linux repository [4], in branch unicore32-working. This branch
includes a working unicore32 qemu configuration. It also includes
a critical patch which is not available in the upstream kernel.

unicore32: Add ocd console and qemu-defconfig to support qemu simulator
	This patch adds a primitive OCD console to communicate with qemu.
	The same code is already used for early console support.

With this patch added, and with qemu_defconfig as provided by the same patch,
it is possible to build and load a unicore32 image in qemu using the following
qemu command line.

qemu-system-unicore32 -curses -M puv3 -m 512 -kernel arch/unicore32/boot/zImage

Caveats:
- The use of -nographic instead of -curses causes a qemu crash
- The qemu emulation only accepts a built-in initramfs.
- The only working image is arch/unicore32/boot/zImage.
  All other variants, arch/unicore32/boot/Image and vmlinux, cause a crash.
  The same (or a similar) crash is also seen if I don't provide a built-in
  kernel command line and try to load zImage.
- There is no networking. There is another patch in the github linux
  respository [4] which is not available upstream. The driver was submitted
  for integration back in 2011 [5] but it was never accepted or merged.

------------------------
[1] http://mprc.pku.edu.cn/~guanxuetao/linux/
[2] https://lkml.org/lkml/2014/8/31/86
[3] https://github.com/gxt
[4] git://github.com/gxt/linux.git
[5] https://lkml.org/lkml/2011/5/27/17

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Status of 'unicore32' architecture in Linux kernel
  2014-08-31 23:51 Status of 'unicore32' architecture in Linux kernel Guenter Roeck
@ 2014-09-01  4:00 ` Chen Gang
  2014-09-02 14:03 ` 回复: " Xuetao Guan 
  1 sibling, 0 replies; 15+ messages in thread
From: Chen Gang @ 2014-09-01  4:00 UTC (permalink / raw)
  To: Guenter Roeck, linux-kernel; +Cc: Guan Xuetao, Grant Likely


Firstly, what you have done encourage me, thanks.

On 9/1/14 7:51, Guenter Roeck wrote:
> Status of 'unicore32' architecture in Linux kernel
> --------------------------------------------------
> 
> The idea was to create a working kernel and initramfs for the ongoing Linux
> kernel test project. This summary describes the result of this effort.
> 
> Overall, conclusion is that the architecture would need some work
> (both in qemu and the kernel itself) to make it testable with qemu.
> 
> Guenter
> 
> ---------------------
> Toolchain used was from [1]. I did not attempt to build my own toolchain.
> 

I also use it, but for me, hope we can use an open source toolchain for
it, in the future. If possible, I will be glad to join for it (develop
open source unicore32 gcc cross compiler with other related members).

> Configuration:
> 
> make ARCH=unicore32 defconfig && make ARCH=unicore32
> 
> This configuration currently fails to build in the upstream kernel.
> A patch to fix the problem has been submitted and is pending upstream
> integration [2]. With this patch merged, the 'defconfig' image can
> be built.
> 

Thank you for what you have done.

> ----------------
> qemu
> 
> Attempts to load the unicore32:defconfig image with qemu failed.
> 
> Research points to [3], which includes a working unicore32 linux kernel
> in its linux repository [4], in branch unicore32-working. This branch
> includes a working unicore32 qemu configuration. It also includes
> a critical patch which is not available in the upstream kernel.
> 
> unicore32: Add ocd console and qemu-defconfig to support qemu simulator
> 	This patch adds a primitive OCD console to communicate with qemu.
> 	The same code is already used for early console support.
> 
> With this patch added, and with qemu_defconfig as provided by the same patch,
> it is possible to build and load a unicore32 image in qemu using the following
> qemu command line.
> 
> qemu-system-unicore32 -curses -M puv3 -m 512 -kernel arch/unicore32/boot/zImage
> 

For me, hope they also can be merged into upstream main line, next.

> Caveats:
> - The use of -nographic instead of -curses causes a qemu crash
> - The qemu emulation only accepts a built-in initramfs.
> - The only working image is arch/unicore32/boot/zImage.
>   All other variants, arch/unicore32/boot/Image and vmlinux, cause a crash.
>   The same (or a similar) crash is also seen if I don't provide a built-in
>   kernel command line and try to load zImage.
> - There is no networking. There is another patch in the github linux
>   respository [4] which is not available upstream. The driver was submitted
>   for integration back in 2011 [5] but it was never accepted or merged.
> 

For me, suggest also Cc to qemu-devel@nongnu.org, and gxt is the related
maintainer for qemu unicore32, too.

In the future (maybe several months later), I am glad to try to analyze
these caveats (but excuse me, at present, I have no enough time resource
on it).


> [1] http://mprc.pku.edu.cn/~guanxuetao/linux/
> [2] https://lkml.org/lkml/2014/8/31/86
> [3] https://github.com/gxt
> [4] git://github.com/gxt/linux.git
> [5] https://lkml.org/lkml/2011/5/27/17
> 

Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

^ permalink raw reply	[flat|nested] 15+ messages in thread

* 回复: Status of 'unicore32' architecture in Linux kernel
  2014-08-31 23:51 Status of 'unicore32' architecture in Linux kernel Guenter Roeck
  2014-09-01  4:00 ` Chen Gang
@ 2014-09-02 14:03 ` Xuetao Guan 
  2014-09-02 15:58   ` Guenter Roeck
  1 sibling, 1 reply; 15+ messages in thread
From: Xuetao Guan  @ 2014-09-02 14:03 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, Guan Xuetao, Chen Gang, Grant Likely

Sorry for late reply.

----- Guenter Roeck <linux@roeck-us.net> 写道:
> Status of 'unicore32' architecture in Linux kernel
> --------------------------------------------------
> 
> The idea was to create a working kernel and initramfs for the ongoing Linux
> kernel test project. This summary describes the result of this effort.
> 
> Overall, conclusion is that the architecture would need some work
> (both in qemu and the kernel itself) to make it testable with qemu.

Great. And there's a lot of work to do for unicore32.

> 
> Guenter
> 
> ---------------------
> Toolchain used was from [1]. I did not attempt to build my own toolchain.
> 
> Configuration:
> 
> make ARCH=unicore32 defconfig && make ARCH=unicore32
> 
> This configuration currently fails to build in the upstream kernel.
> A patch to fix the problem has been submitted and is pending upstream
> integration [2]. With this patch merged, the 'defconfig' image can
> be built.

Thanks. I'll apply it in my repo.

> 
> ----------------
> qemu
> 
> Attempts to load the unicore32:defconfig image with qemu failed.
> 
> Research points to [3], which includes a working unicore32 linux kernel
> in its linux repository [4], in branch unicore32-working. This branch
> includes a working unicore32 qemu configuration. It also includes
> a critical patch which is not available in the upstream kernel.

Yes. And these patches need to be reviewed and reconsidered.
I'll try to do that in this month.

> 
> unicore32: Add ocd console and qemu-defconfig to support qemu simulator
> 	This patch adds a primitive OCD console to communicate with qemu.
> 	The same code is already used for early console support.

Do you mean there's the same/similar code in QEMU.

> 
> With this patch added, and with qemu_defconfig as provided by the same patch,
> it is possible to build and load a unicore32 image in qemu using the following
> qemu command line.
> 
> qemu-system-unicore32 -curses -M puv3 -m 512 -kernel arch/unicore32/boot/zImage
> 
> Caveats:
> - The use of -nographic instead of -curses causes a qemu crash
Yes, since qemu curses code was modified to meet the simple OCD console requirement.

> - The qemu emulation only accepts a built-in initramfs.
Yes, github version only support built-in initramfs.
NFS+LFS could be also supported, and puv3-pci sim should be added at first.

> - The only working image is arch/unicore32/boot/zImage.
>   All other variants, arch/unicore32/boot/Image and vmlinux, cause a crash.
>   The same (or a similar) crash is also seen if I don't provide a built-in
>   kernel command line and try to load zImage.
Sorry for that. That should be fixed.

> - There is no networking. There is another patch in the github linux
>   respository [4] which is not available upstream. The driver was submitted
>   for integration back in 2011 [5] but it was never accepted or merged.
Yes, exactly.
Thanks Guenter.

> 
> ------------------------
> [1] http://mprc.pku.edu.cn/~guanxuetao/linux/
> [2] https://lkml.org/lkml/2014/8/31/86
> [3] https://github.com/gxt
> [4] git://github.com/gxt/linux.git
> [5] https://lkml.org/lkml/2011/5/27/17


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 回复: Status of 'unicore32' architecture in Linux kernel
  2014-09-02 14:03 ` 回复: " Xuetao Guan 
@ 2014-09-02 15:58   ` Guenter Roeck
  2014-09-03  0:09     ` 回复: " Xuetao Guan 
  0 siblings, 1 reply; 15+ messages in thread
From: Guenter Roeck @ 2014-09-02 15:58 UTC (permalink / raw)
  To: Xuetao Guan; +Cc: linux-kernel, Guan Xuetao, Chen Gang, Grant Likely

On Tue, Sep 02, 2014 at 10:03:48PM +0800, Xuetao Guan  wrote:
> Sorry for late reply.
> 
> ----- Guenter Roeck <linux@roeck-us.net> 写道:
> > Status of 'unicore32' architecture in Linux kernel
> > --------------------------------------------------
> > 
> > The idea was to create a working kernel and initramfs for the ongoing Linux
> > kernel test project. This summary describes the result of this effort.
> > 
> > Overall, conclusion is that the architecture would need some work
> > (both in qemu and the kernel itself) to make it testable with qemu.
> 
> Great. And there's a lot of work to do for unicore32.
> 
> > 
> > Guenter
> > 
> > ---------------------
> > Toolchain used was from [1]. I did not attempt to build my own toolchain.
> > 
> > Configuration:
> > 
> > make ARCH=unicore32 defconfig && make ARCH=unicore32
> > 
> > This configuration currently fails to build in the upstream kernel.
> > A patch to fix the problem has been submitted and is pending upstream
> > integration [2]. With this patch merged, the 'defconfig' image can
> > be built.
> 
> Thanks. I'll apply it in my repo.
> 
Linus already accepted the patch upstream after I sent it to him directly,
so this problem has been solved by now.

> > 
> > ----------------
> > qemu
> > 
> > Attempts to load the unicore32:defconfig image with qemu failed.
> > 
> > Research points to [3], which includes a working unicore32 linux kernel
> > in its linux repository [4], in branch unicore32-working. This branch
> > includes a working unicore32 qemu configuration. It also includes
> > a critical patch which is not available in the upstream kernel.
> 
> Yes. And these patches need to be reviewed and reconsidered.
> I'll try to do that in this month.
> 
> > 
> > unicore32: Add ocd console and qemu-defconfig to support qemu simulator
> > 	This patch adds a primitive OCD console to communicate with qemu.
> > 	The same code is already used for early console support.
> 
> Do you mean there's the same/similar code in QEMU.
> 
No, I mean that the ocd functions in the linux kernel (such as ocd_putc) are
used by both earlyprintk and the ocd console code.

> > 
> > With this patch added, and with qemu_defconfig as provided by the same patch,
> > it is possible to build and load a unicore32 image in qemu using the following
> > qemu command line.
> > 
> > qemu-system-unicore32 -curses -M puv3 -m 512 -kernel arch/unicore32/boot/zImage
> > 
> > Caveats:
> > - The use of -nographic instead of -curses causes a qemu crash
> Yes, since qemu curses code was modified to meet the simple OCD console requirement.
> 
The lack of support for -nographic is a problem for scripted testing.
The issue is that we have to interpret console output for scripted testing,
and having to go through curses makes that a bit difficult.

Wonder if '-nographic' can be modeled as '-curses' with no available terminal
configuration. At least in theory that should work, but executing the above
command with TERM=dumb yields no output. Wonder how difficult it would be to
change that.

> > - The qemu emulation only accepts a built-in initramfs.
> Yes, github version only support built-in initramfs.
> NFS+LFS could be also supported, and puv3-pci sim should be added at first.
> 
> > - The only working image is arch/unicore32/boot/zImage.
> >   All other variants, arch/unicore32/boot/Image and vmlinux, cause a crash.
> >   The same (or a similar) crash is also seen if I don't provide a built-in
> >   kernel command line and try to load zImage.
> Sorry for that. That should be fixed.
> 
> > - There is no networking. There is another patch in the github linux
> >   respository [4] which is not available upstream. The driver was submitted
> >   for integration back in 2011 [5] but it was never accepted or merged.
> Yes, exactly.

Too bad. Not exactly necessary for our current scope of testing, but it would be
nice to be able to test networking.

> Thanks Guenter.
> 
You are welcome. Thanks for the feedback.

Guenter

^ permalink raw reply	[flat|nested] 15+ messages in thread

* 回复: Re: 回复: Status of 'unicore32' architecture in Linux kernel
  2014-09-02 15:58   ` Guenter Roeck
@ 2014-09-03  0:09     ` Xuetao Guan 
  2014-09-03  1:52       ` Guenter Roeck
  2014-09-03  3:58       ` Guenter Roeck
  0 siblings, 2 replies; 15+ messages in thread
From: Xuetao Guan  @ 2014-09-03  0:09 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, Guan Xuetao, Chen Gang, Grant Likely


[...]
> > 
> > > 
> > > unicore32: Add ocd console and qemu-defconfig to support qemu simulator
> > > 	This patch adds a primitive OCD console to communicate with qemu.
> > > 	The same code is already used for early console support.
> > 
> > Do you mean there's the same/similar code in QEMU.
> > 
> No, I mean that the ocd functions in the linux kernel (such as ocd_putc) are
> used by both earlyprintk and the ocd console code.
Yes. By the way, it's only for qemu and fpga debug.

> 
> > > 
> > > With this patch added, and with qemu_defconfig as provided by the same patch,
> > > it is possible to build and load a unicore32 image in qemu using the following
> > > qemu command line.
> > > 
> > > qemu-system-unicore32 -curses -M puv3 -m 512 -kernel arch/unicore32/boot/zImage
> > > 
> > > Caveats:
> > > - The use of -nographic instead of -curses causes a qemu crash
> > Yes, since qemu curses code was modified to meet the simple OCD console requirement.
> > 
> The lack of support for -nographic is a problem for scripted testing.
> The issue is that we have to interpret console output for scripted testing,
> and having to go through curses makes that a bit difficult.
> 
> Wonder if '-nographic' can be modeled as '-curses' with no available terminal
> configuration. At least in theory that should work, but executing the above
> command with TERM=dumb yields no output. Wonder how difficult it would be to
> change that.

I see. I'll try to make -nographic work anyway.

> 
> > > - The qemu emulation only accepts a built-in initramfs.
> > Yes, github version only support built-in initramfs.
> > NFS+LFS could be also supported, and puv3-pci sim should be added at first.
> > 
> > > - The only working image is arch/unicore32/boot/zImage.
> > >   All other variants, arch/unicore32/boot/Image and vmlinux, cause a crash.
> > >   The same (or a similar) crash is also seen if I don't provide a built-in
> > >   kernel command line and try to load zImage.
> > Sorry for that. That should be fixed.
> > 
> > > - There is no networking. There is another patch in the github linux
> > >   respository [4] which is not available upstream. The driver was submitted
> > >   for integration back in 2011 [5] but it was never accepted or merged.
> > Yes, exactly.
> 
> Too bad. Not exactly necessary for our current scope of testing, but it would be
> nice to be able to test networking.
I'll review and submit networking code again. Or, maybe pci-nic function, to support qemu as well. 

> 
> > Thanks Guenter.
> > 
> You are welcome. Thanks for the feedback.
> 
> Guenter

Thanks.

Xuetao

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 回复: Re: 回复: Status of 'unicore32' architecture in Linux kernel
  2014-09-03  0:09     ` 回复: " Xuetao Guan 
@ 2014-09-03  1:52       ` Guenter Roeck
  2014-09-03  3:58       ` Guenter Roeck
  1 sibling, 0 replies; 15+ messages in thread
From: Guenter Roeck @ 2014-09-03  1:52 UTC (permalink / raw)
  To: Xuetao Guan; +Cc: linux-kernel, Guan Xuetao, Chen Gang, Grant Likely

On 09/02/2014 05:09 PM, Xuetao Guan  wrote:
>
> [...]
>>>
>>>>
>>>> unicore32: Add ocd console and qemu-defconfig to support qemu simulator
>>>> 	This patch adds a primitive OCD console to communicate with qemu.
>>>> 	The same code is already used for early console support.
>>>
>>> Do you mean there's the same/similar code in QEMU.
>>>
>> No, I mean that the ocd functions in the linux kernel (such as ocd_putc) are
>> used by both earlyprintk and the ocd console code.
> Yes. By the way, it's only for qemu and fpga debug.
>
>>
>>>>
>>>> With this patch added, and with qemu_defconfig as provided by the same patch,
>>>> it is possible to build and load a unicore32 image in qemu using the following
>>>> qemu command line.
>>>>
>>>> qemu-system-unicore32 -curses -M puv3 -m 512 -kernel arch/unicore32/boot/zImage
>>>>
>>>> Caveats:
>>>> - The use of -nographic instead of -curses causes a qemu crash
>>> Yes, since qemu curses code was modified to meet the simple OCD console requirement.
>>>
>> The lack of support for -nographic is a problem for scripted testing.
>> The issue is that we have to interpret console output for scripted testing,
>> and having to go through curses makes that a bit difficult.
>>
>> Wonder if '-nographic' can be modeled as '-curses' with no available terminal
>> configuration. At least in theory that should work, but executing the above
>> command with TERM=dumb yields no output. Wonder how difficult it would be to
>> change that.
>
> I see. I'll try to make -nographic work anyway.
>
Another possibility would be to support "-display none". Unfortunately that also
causes qemu to crash :-(.

Guenter


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 回复: Re: 回复: Status of 'unicore32' architecture in Linux kernel
  2014-09-03  0:09     ` 回复: " Xuetao Guan 
  2014-09-03  1:52       ` Guenter Roeck
@ 2014-09-03  3:58       ` Guenter Roeck
  2014-09-03  8:32         ` 回复: " Xuetao Guan 
  1 sibling, 1 reply; 15+ messages in thread
From: Guenter Roeck @ 2014-09-03  3:58 UTC (permalink / raw)
  To: Xuetao Guan; +Cc: linux-kernel, Guan Xuetao, Chen Gang, Grant Likely

On Wed, Sep 03, 2014 at 08:09:28AM +0800, Xuetao Guan  wrote:
> 
> [...]
> > > 
> > > > 
> > > > unicore32: Add ocd console and qemu-defconfig to support qemu simulator
> > > > 	This patch adds a primitive OCD console to communicate with qemu.
> > > > 	The same code is already used for early console support.
> > > 
> > > Do you mean there's the same/similar code in QEMU.
> > > 
> > No, I mean that the ocd functions in the linux kernel (such as ocd_putc) are
> > used by both earlyprintk and the ocd console code.
> Yes. By the way, it's only for qemu and fpga debug.
> 
> > 
> > > > 
> > > > With this patch added, and with qemu_defconfig as provided by the same patch,
> > > > it is possible to build and load a unicore32 image in qemu using the following
> > > > qemu command line.
> > > > 
> > > > qemu-system-unicore32 -curses -M puv3 -m 512 -kernel arch/unicore32/boot/zImage
> > > > 
> > > > Caveats:
> > > > - The use of -nographic instead of -curses causes a qemu crash
> > > Yes, since qemu curses code was modified to meet the simple OCD console requirement.
> > > 
> > The lack of support for -nographic is a problem for scripted testing.
> > The issue is that we have to interpret console output for scripted testing,
> > and having to go through curses makes that a bit difficult.
> > 
> > Wonder if '-nographic' can be modeled as '-curses' with no available terminal
> > configuration. At least in theory that should work, but executing the above
> > command with TERM=dumb yields no output. Wonder how difficult it would be to
> > change that.
> 
> I see. I'll try to make -nographic work anyway.
> 
Please try the following patch. That seems to do it.
I am sure it can be improved, but it is a start.

Thanks,
Guenter

---
>From a7c89177b3c00e4c16bea25a0b4b2f9dc511e07b Mon Sep 17 00:00:00 2001
From: Guenter Roeck <linux@roeck-us.net>
Date: Tue, 2 Sep 2014 20:55:02 -0700
Subject: [PATCH] qemu: unicore32: Add support for non-curses display

Add basic support for DT_NONE and DT_NOGRAPHIC display types.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 target-unicore32/helper.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c
index e5ebbf4..dda3772 100644
--- a/target-unicore32/helper.c
+++ b/target-unicore32/helper.c
@@ -13,6 +13,7 @@
 #include "exec/gdbstub.h"
 #include "exec/helper-proto.h"
 #include "qemu/host-utils.h"
+#include "sysemu/sysemu.h"
 #ifndef CONFIG_USER_ONLY
 #include "ui/console.h"
 #endif
@@ -223,7 +224,18 @@ static void putc_on_screen(unsigned char ch)
 
 void helper_cp1_putc(target_ulong x)
 {
-    putc_on_screen((unsigned char)x);   /* Output to screen */
+    switch(display_type) {
+    case DT_CURSES:
+	putc_on_screen((unsigned char)x);   /* Output to screen */
+	break;
+    case DT_NOGRAPHIC:
+    case DT_NONE:
+	putchar((int)x);
+	break;
+    default:
+	break;
+    }
+
     DPRINTF("%c", x);                   /* Output to stdout */
 }
 #endif
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* 回复: Re: 回复: Re: 回复: Status of 'unicore32' architecture in Linux kernel
  2014-09-03  3:58       ` Guenter Roeck
@ 2014-09-03  8:32         ` Xuetao Guan 
  2014-09-05  5:52           ` Guenter Roeck
  0 siblings, 1 reply; 15+ messages in thread
From: Xuetao Guan  @ 2014-09-03  8:32 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, Guan Xuetao, Chen Gang, Grant Likely


----- Guenter Roeck <linux@roeck-us.net> 写道:
> On Wed, Sep 03, 2014 at 08:09:28AM +0800, Xuetao Guan  wrote:
> > 
> > [...]
> > > > 
> > > > > 
> > > > > unicore32: Add ocd console and qemu-defconfig to support qemu simulator
> > > > > 	This patch adds a primitive OCD console to communicate with qemu.
> > > > > 	The same code is already used for early console support.
> > > > 
> > > > Do you mean there's the same/similar code in QEMU.
> > > > 
> > > No, I mean that the ocd functions in the linux kernel (such as ocd_putc) are
> > > used by both earlyprintk and the ocd console code.
> > Yes. By the way, it's only for qemu and fpga debug.
> > 
> > > 
> > > > > 
> > > > > With this patch added, and with qemu_defconfig as provided by the same patch,
> > > > > it is possible to build and load a unicore32 image in qemu using the following
> > > > > qemu command line.
> > > > > 
> > > > > qemu-system-unicore32 -curses -M puv3 -m 512 -kernel arch/unicore32/boot/zImage
> > > > > 
> > > > > Caveats:
> > > > > - The use of -nographic instead of -curses causes a qemu crash
> > > > Yes, since qemu curses code was modified to meet the simple OCD console requirement.
> > > > 
> > > The lack of support for -nographic is a problem for scripted testing.
> > > The issue is that we have to interpret console output for scripted testing,
> > > and having to go through curses makes that a bit difficult.
> > > 
> > > Wonder if '-nographic' can be modeled as '-curses' with no available terminal
> > > configuration. At least in theory that should work, but executing the above
> > > command with TERM=dumb yields no output. Wonder how difficult it would be to
> > > change that.
> > 
> > I see. I'll try to make -nographic work anyway.
> > 
> Please try the following patch. That seems to do it.
> I am sure it can be improved, but it is a start.
> 
> Thanks,
> Guenter

Thanks. I'll test it.
BTW, Qemu codestyle is different, and tab should be replaced with blanks.

Xuetao

> 
> ---
> From a7c89177b3c00e4c16bea25a0b4b2f9dc511e07b Mon Sep 17 00:00:00 2001
> From: Guenter Roeck <linux@roeck-us.net>
> Date: Tue, 2 Sep 2014 20:55:02 -0700
> Subject: [PATCH] qemu: unicore32: Add support for non-curses display
> 
> Add basic support for DT_NONE and DT_NOGRAPHIC display types.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  target-unicore32/helper.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c
> index e5ebbf4..dda3772 100644
> --- a/target-unicore32/helper.c
> +++ b/target-unicore32/helper.c
> @@ -13,6 +13,7 @@
>  #include "exec/gdbstub.h"
>  #include "exec/helper-proto.h"
>  #include "qemu/host-utils.h"
> +#include "sysemu/sysemu.h"
>  #ifndef CONFIG_USER_ONLY
>  #include "ui/console.h"
>  #endif
> @@ -223,7 +224,18 @@ static void putc_on_screen(unsigned char ch)
>  
>  void helper_cp1_putc(target_ulong x)
>  {
> -    putc_on_screen((unsigned char)x);   /* Output to screen */
> +    switch(display_type) {
> +    case DT_CURSES:
> +	putc_on_screen((unsigned char)x);   /* Output to screen */
> +	break;
> +    case DT_NOGRAPHIC:
> +    case DT_NONE:
> +	putchar((int)x);
> +	break;
> +    default:
> +	break;
> +    }
> +
>      DPRINTF("%c", x);                   /* Output to stdout */
>  }
>  #endif
> -- 
> 1.9.1
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 回复: Re: 回复: Re: 回复: Status of 'unicore32' architecture in Linux kernel
  2014-09-03  8:32         ` 回复: " Xuetao Guan 
@ 2014-09-05  5:52           ` Guenter Roeck
  2014-09-05  6:13             ` 回复: " Xuetao Guan 
  0 siblings, 1 reply; 15+ messages in thread
From: Guenter Roeck @ 2014-09-05  5:52 UTC (permalink / raw)
  To: Xuetao Guan; +Cc: linux-kernel, Guan Xuetao, Chen Gang, Grant Likely

On 09/03/2014 01:32 AM, Xuetao Guan  wrote:
>
[ ... ]

>> Please try the following patch. That seems to do it.
>> I am sure it can be improved, but it is a start.
>>
>> Thanks,
>> Guenter
>
> Thanks. I'll test it.
> BTW, Qemu codestyle is different, and tab should be replaced with blanks.
>

Here is where I am. User space code (busybox) was compiled
using the unicore toolchain available on the web.

...
serio: i8042 KBD port at 0x6eb00060,0x6eb00064 irq 22
mousedev: PS/2 mouse device common for all mice
Enable UniCore-F64 support.
Warning: unable to open an initial console.
Freeing unused kernel memory: 1156K (c0408000 - c0529000)

Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

The kernel tries to execute the init program, which fails with SIGSEGV.
I confirmed that the init program is loaded and starts to execute.

Any idea what might cause such a problem ?

Thanks,
Guenter


^ permalink raw reply	[flat|nested] 15+ messages in thread

* 回复: Re: 回复: Re: 回复: Re: 回复: Status of 'unicore32' architecture in Linux kernel
  2014-09-05  5:52           ` Guenter Roeck
@ 2014-09-05  6:13             ` Xuetao Guan 
  2014-09-06 17:25               ` Guenter Roeck
  0 siblings, 1 reply; 15+ messages in thread
From: Xuetao Guan  @ 2014-09-05  6:13 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, Guan Xuetao, Chen Gang, Grant Likely


----- Guenter Roeck <linux@roeck-us.net> 写道:
> On 09/03/2014 01:32 AM, Xuetao Guan  wrote:
> >
> [ ... ]
> 
> >> Please try the following patch. That seems to do it.
> >> I am sure it can be improved, but it is a start.
> >>
> >> Thanks,
> >> Guenter
> >
> > Thanks. I'll test it.
> > BTW, Qemu codestyle is different, and tab should be replaced with blanks.
> >
> 
> Here is where I am. User space code (busybox) was compiled
> using the unicore toolchain available on the web.
> 
> ...
> serio: i8042 KBD port at 0x6eb00060,0x6eb00064 irq 22
> mousedev: PS/2 mouse device common for all mice
> Enable UniCore-F64 support.
> Warning: unable to open an initial console.
> Freeing unused kernel memory: 1156K (c0408000 - c0529000)
> 
> Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
> 
> ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
> 
> The kernel tries to execute the init program, which fails with SIGSEGV.
> I confirmed that the init program is loaded and starts to execute.
> 
> Any idea what might cause such a problem ?
> 
> Thanks,
> Guenter
> 
'slink /init             /bin/busybox 777 0 0' should be inserted in initramfs config
Also, I recommend compile busybox statically for initramfs.

I need more information, including full kmsg and initramfs configs

My qemu commands as following. Maybe useful.

qemu-new:
        @test -d $(DIR_WORKING)/qemu-unicore32 ||               \
                mkdir -p $(DIR_WORKING)/qemu-unicore32
        @echo "Remove old qemu repo ..."
        @rm -fr $(DIR_WORKING)/qemu
        @cd $(DIR_WORKING); git clone $(QEMU_GITREPO)
        @cd $(DIR_WORKING)/qemu;                                \
                git br unicore32 origin/unicore32;              \
                git co unicore32

qemu-make:
        @echo "Configure qemu ..."
        @cd $(DIR_WORKING)/qemu; ./configure                    \
                --enable-trace-backend=stderr                   \
                --target-list=$(QEMU_TARGETS)                   \
                --enable-debug                                  \
                --disable-sdl                                   \
                --interp-prefix=$(DIR_GNU_UC)                   \
                --prefix=$(DIR_WORKING)/qemu-unicore32          \
                >> $(QEMU_BUILDLOG) 2>&1
        @echo "Make qemu and make install ..."
        @make -C $(DIR_WORKING)/qemu -j4 >> $(QEMU_BUILDLOG) 2>&1
        @make -C $(DIR_WORKING)/qemu install >> $(QEMU_BUILDLOG) 2>&1

qemu-run:
        @echo "Remove old log file"
        @rm -fr $(QEMU_TRACELOG)
        @echo "Running QEMU in this tty ..."
        @$(DIR_WORKING)/qemu-unicore32/bin/qemu-system-unicore32\
                -curses                                         \
                -M puv3                                         \
                -m 512                                          \
                -icount 0                                       \
                -kernel $(DIR_WORKING)/zImage                   \
                -net nic                                        \
                -net tap,ifname=tap_$(USER),script=no,downscript=no     \
                -append "root=/dev/nfs nfsroot=192.168.200.161:/export/guestroot/,tcp rw ip=192.168.122.4"    \
                2> $(QEMU_TRACELOG)


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 回复: Re: 回复: Re: 回复: Re: 回复: Status of 'unicore32' architecture in Linux kernel
  2014-09-05  6:13             ` 回复: " Xuetao Guan 
@ 2014-09-06 17:25               ` Guenter Roeck
  2014-09-08 12:57                 ` 回复: " Xuetao Guan 
  0 siblings, 1 reply; 15+ messages in thread
From: Guenter Roeck @ 2014-09-06 17:25 UTC (permalink / raw)
  To: Xuetao Guan; +Cc: linux-kernel, Guan Xuetao, Chen Gang, Grant Likely

On 09/04/2014 11:13 PM, Xuetao Guan  wrote:
>
> ----- Guenter Roeck <linux@roeck-us.net> 写道:
>> On 09/03/2014 01:32 AM, Xuetao Guan  wrote:
>>>
>> [ ... ]
>>
>>>> Please try the following patch. That seems to do it.
>>>> I am sure it can be improved, but it is a start.
>>>>
>>>> Thanks,
>>>> Guenter
>>>
>>> Thanks. I'll test it.
>>> BTW, Qemu codestyle is different, and tab should be replaced with blanks.
>>>
>>
>> Here is where I am. User space code (busybox) was compiled
>> using the unicore toolchain available on the web.
>>
>> ...
>> serio: i8042 KBD port at 0x6eb00060,0x6eb00064 irq 22
>> mousedev: PS/2 mouse device common for all mice
>> Enable UniCore-F64 support.
>> Warning: unable to open an initial console.
>> Freeing unused kernel memory: 1156K (c0408000 - c0529000)
>>
>> Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
>>
>> ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
>>
>> The kernel tries to execute the init program, which fails with SIGSEGV.
>> I confirmed that the init program is loaded and starts to execute.
>>
>> Any idea what might cause such a problem ?
>>
>> Thanks,
>> Guenter
>>
> 'slink /init             /bin/busybox 777 0 0' should be inserted in initramfs config
> Also, I recommend compile busybox statically for initramfs.
>
> I need more information, including full kmsg and initramfs configs
>

Hi,

I made everything I have available at http://server.roeck-us.net/qemu/unicore32/.
I tried multiple variants for creating the root file system, including the one
on https://github.com/gxt/UniCore32.git and the one using mkrootfs.sh in
the link above. No difference - I always see the same crash. Note that the
'init' program is loading, but crashes with above error (0x0000000b is SIGSEGV
unless I am missing something).

Note that I used the latest qemu for unicore from upstream sources; I was unable
to compile it from git@github.com:gxt/QEMU.git. Qemu configuration did not seem
to make a difference. The toolchain was extracted from uc4-1.0.5-hard.tgz.

Hope this helps,
Guenter


^ permalink raw reply	[flat|nested] 15+ messages in thread

* 回复: Re: 回复: Re: 回复: Re: 回复: Re: 回复: Status of 'unicore32' architecture in Linux kernel
  2014-09-06 17:25               ` Guenter Roeck
@ 2014-09-08 12:57                 ` Xuetao Guan 
  2014-09-08 13:35                   ` Guenter Roeck
  0 siblings, 1 reply; 15+ messages in thread
From: Xuetao Guan  @ 2014-09-08 12:57 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, Guan Xuetao, Chen Gang, Grant Likely


----- Guenter Roeck <linux@roeck-us.net> 写道:
> On 09/04/2014 11:13 PM, Xuetao Guan  wrote:
> Hi,
> 
> I made everything I have available at http://server.roeck-us.net/qemu/unicore32/.
> I tried multiple variants for creating the root file system, including the one
> on https://github.com/gxt/UniCore32.git and the one using mkrootfs.sh in
> the link above. No difference - I always see the same crash. Note that the
> 'init' program is loading, but crashes with above error (0x0000000b is SIGSEGV
> unless I am missing something).
> 
> Note that I used the latest qemu for unicore from upstream sources; I was unable
> to compile it from git@github.com:gxt/QEMU.git. Qemu configuration did not seem
> to make a difference. The toolchain was extracted from uc4-1.0.5-hard.tgz.
> 
> Hope this helps,
> Guenter
> 
I guess you used the newest kernel to run busybox.
However, as for unicore32, the newest kernel uses different ABI with uc4-1.0.5 toolchain.
I'm sorry to make it so confusing.
I'll update and submit another-ABI patches asap.

Thanks,
Xutao




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 回复: Re: 回复: Re: 回复: Re: 回复: Re: 回复: Status of 'unicore32' architecture in Linux kernel
  2014-09-08 12:57                 ` 回复: " Xuetao Guan 
@ 2014-09-08 13:35                   ` Guenter Roeck
  2014-09-09  0:58                     ` 回复: " Xuetao Guan 
  0 siblings, 1 reply; 15+ messages in thread
From: Guenter Roeck @ 2014-09-08 13:35 UTC (permalink / raw)
  To: Xuetao Guan; +Cc: linux-kernel, Guan Xuetao, Chen Gang, Grant Likely

On 09/08/2014 05:57 AM, Xuetao Guan  wrote:
>
> ----- Guenter Roeck <linux@roeck-us.net> 写道:
>> On 09/04/2014 11:13 PM, Xuetao Guan  wrote:
>> Hi,
>>
>> I made everything I have available at http://server.roeck-us.net/qemu/unicore32/.
>> I tried multiple variants for creating the root file system, including the one
>> on https://github.com/gxt/UniCore32.git and the one using mkrootfs.sh in
>> the link above. No difference - I always see the same crash. Note that the
>> 'init' program is loading, but crashes with above error (0x0000000b is SIGSEGV
>> unless I am missing something).
>>
>> Note that I used the latest qemu for unicore from upstream sources; I was unable
>> to compile it from git@github.com:gxt/QEMU.git. Qemu configuration did not seem
>> to make a difference. The toolchain was extracted from uc4-1.0.5-hard.tgz.
>>
>> Hope this helps,
>> Guenter
>>
> I guess you used the newest kernel to run busybox.
> However, as for unicore32, the newest kernel uses different ABI with uc4-1.0.5 toolchain.
> I'm sorry to make it so confusing.
> I'll update and submit another-ABI patches asap.
>

Whatever is more recent. Guess you'll have to either update the toolchain
or the kernel. If the plan is to update the kernel, can you send me a patch
to do that so I can test it ?

Thanks,
Guenter


^ permalink raw reply	[flat|nested] 15+ messages in thread

* 回复: Re: 回复: Re: 回复: Re: 回复: Re: 回复: Re: 回复: Status of 'unicore32' architecture in Linux kernel
  2014-09-08 13:35                   ` Guenter Roeck
@ 2014-09-09  0:58                     ` Xuetao Guan 
  2014-09-09  2:06                       ` Guenter Roeck
  0 siblings, 1 reply; 15+ messages in thread
From: Xuetao Guan  @ 2014-09-09  0:58 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, Guan Xuetao, Chen Gang, Grant Likely


----- Guenter Roeck <linux@roeck-us.net> 写道:
> On 09/08/2014 05:57 AM, Xuetao Guan  wrote:
> 
> Whatever is more recent. Guess you'll have to either update the toolchain
> or the kernel. If the plan is to update the kernel, can you send me a patch
> to do that so I can test it ?
> 
> Thanks,
> Guenter
> 
I'll update unicore kernel at first, and cc patches to you.

Thanks.
Xuetao

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 回复: Re: 回复: Re: 回复: Re: 回复: Re: 回复: Re: 回复: Status of 'unicore32' architecture in Linux kernel
  2014-09-09  0:58                     ` 回复: " Xuetao Guan 
@ 2014-09-09  2:06                       ` Guenter Roeck
  0 siblings, 0 replies; 15+ messages in thread
From: Guenter Roeck @ 2014-09-09  2:06 UTC (permalink / raw)
  To: Xuetao Guan; +Cc: linux-kernel, Guan Xuetao, Chen Gang, Grant Likely

On 09/08/2014 05:58 PM, Xuetao Guan  wrote:
>
> ----- Guenter Roeck <linux@roeck-us.net> 写道:
>> On 09/08/2014 05:57 AM, Xuetao Guan  wrote:
>>
>> Whatever is more recent. Guess you'll have to either update the toolchain
>> or the kernel. If the plan is to update the kernel, can you send me a patch
>> to do that so I can test it ?
>>
>> Thanks,
>> Guenter
>>
> I'll update unicore kernel at first, and cc patches to you.
>
Ok.

Thanks,
Guenter



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-09-09  2:06 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-31 23:51 Status of 'unicore32' architecture in Linux kernel Guenter Roeck
2014-09-01  4:00 ` Chen Gang
2014-09-02 14:03 ` 回复: " Xuetao Guan 
2014-09-02 15:58   ` Guenter Roeck
2014-09-03  0:09     ` 回复: " Xuetao Guan 
2014-09-03  1:52       ` Guenter Roeck
2014-09-03  3:58       ` Guenter Roeck
2014-09-03  8:32         ` 回复: " Xuetao Guan 
2014-09-05  5:52           ` Guenter Roeck
2014-09-05  6:13             ` 回复: " Xuetao Guan 
2014-09-06 17:25               ` Guenter Roeck
2014-09-08 12:57                 ` 回复: " Xuetao Guan 
2014-09-08 13:35                   ` Guenter Roeck
2014-09-09  0:58                     ` 回复: " Xuetao Guan 
2014-09-09  2:06                       ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.