xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [Help] How to build mini-OS with libc support, like Newlib?
@ 2014-09-02  7:20 Lele MA
  2014-09-02  7:47 ` Samuel Thibault
  0 siblings, 1 reply; 6+ messages in thread
From: Lele MA @ 2014-09-02  7:20 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 529 bytes --]

Hi all,


I am going to write my own applications in miniOS, and find it can't call the function xs_open which is available only if HAVE_LIBC is defined.


According to the README in mini-os, it suggests seeing the stubdom/ directory. But I still can not find how to do it.


So, does anyone know how to build mini-os with much better libc support? 

If Newlib can be used to build mini-os, how to do it? Do I have to compile a cross-compiler first?



Any help will be appreciated. Thanks in advance!


--

Best Regards,
Lele MA

[-- Attachment #1.2: Type: text/html, Size: 770 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [Help] How to build mini-OS with libc support, like Newlib?
  2014-09-02  7:20 [Help] How to build mini-OS with libc support, like Newlib? Lele MA
@ 2014-09-02  7:47 ` Samuel Thibault
  2014-09-02  9:36   ` Lele Ma
  0 siblings, 1 reply; 6+ messages in thread
From: Samuel Thibault @ 2014-09-02  7:47 UTC (permalink / raw)
  To: Lele MA; +Cc: xen-devel

Lele MA, le Tue 02 Sep 2014 15:20:32 +0800, a écrit :
> If Newlib can be used to build mini-os, how to do it? Do I have to compile a
> cross-compiler first?

Yes. But this all already handled by the Makefile in stubdom/, and see
the end of README about the c-stubdom target which builds the c/
directory.

Samuel

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

* Re: [Help] How to build mini-OS with libc support, like Newlib?
  2014-09-02  7:47 ` Samuel Thibault
@ 2014-09-02  9:36   ` Lele Ma
  2014-09-02 10:55     ` Samuel Thibault
  0 siblings, 1 reply; 6+ messages in thread
From: Lele Ma @ 2014-09-02  9:36 UTC (permalink / raw)
  To: Samuel Thibault, xen-devel

On Tue, Sep 2, 2014 at 3:47 PM, Samuel Thibault
<samuel.thibault@ens-lyon.org> wrote:
>
> Lele MA, le Tue 02 Sep 2014 15:20:32 +0800, a écrit :
> > If Newlib can be used to build mini-os, how to do it? Do I have to compile a
> > cross-compiler first?
>
> Yes. But this all already handled by the Makefile in stubdom/, and see
> the end of README about the c-stubdom target which builds the c/
> directory.
>

Thank you so much! It is great to build newlib so conveniently. But
when I run 'make  c-stubdom' in stubdom/, it yields:

     make: *** No rule to make target `mini-os-x86_64-c', needed by
`c-stubdom'. Stop"

Do you have any idea about how this happen?

BTW, after building xen, there is a new directory named
"newlib-x86_64/' in stubdom/. I am a newbie to newlib and don't know
what's this exactly. Is it the newlib that a stubdomain can use as the
libc?

My xen version is 4.4.0 and dom-0 is Ubuntu-12.04. Thank you for your patience!

Best regards,
Lele MA

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [Help] How to build mini-OS with libc support, like Newlib?
  2014-09-02  9:36   ` Lele Ma
@ 2014-09-02 10:55     ` Samuel Thibault
  2014-09-05  8:40       ` Lele MA
  0 siblings, 1 reply; 6+ messages in thread
From: Samuel Thibault @ 2014-09-02 10:55 UTC (permalink / raw)
  To: Lele Ma; +Cc: xen-devel

Lele Ma, le Tue 02 Sep 2014 17:36:36 +0800, a écrit :
> On Tue, Sep 2, 2014 at 3:47 PM, Samuel Thibault
> <samuel.thibault@ens-lyon.org> wrote:
> >
> > Lele MA, le Tue 02 Sep 2014 15:20:32 +0800, a écrit :
> > > If Newlib can be used to build mini-os, how to do it? Do I have to compile a
> > > cross-compiler first?
> >
> > Yes. But this all already handled by the Makefile in stubdom/, and see
> > the end of README about the c-stubdom target which builds the c/
> > directory.
> >
> 
> Thank you so much! It is great to build newlib so conveniently. But
> when I run 'make  c-stubdom' in stubdom/, it yields:
> 
>      make: *** No rule to make target `mini-os-x86_64-c', needed by
> `c-stubdom'. Stop"
> 
> Do you have any idea about how this happen?

It's been years since I have had a look at that build system :)

Apparently the c target somehow gets disabled, but you can add it by
hand in 

TARGETS=$(STUBDOM_TARGETS) c

> BTW, after building xen, there is a new directory named
> "newlib-x86_64/' in stubdom/. I am a newbie to newlib and don't know
> what's this exactly. Is it the newlib that a stubdomain can use as the
> libc?

That's it, yes.

Samuel

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

* Re: [Help] How to build mini-OS with libc support, like Newlib?
  2014-09-02 10:55     ` Samuel Thibault
@ 2014-09-05  8:40       ` Lele MA
  2014-09-06  9:54         ` Samuel Thibault
  0 siblings, 1 reply; 6+ messages in thread
From: Lele MA @ 2014-09-05  8:40 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 2210 bytes --]


在 2014-09-02 06:55:35,"Samuel Thibault" <samuel.thibault@ens-lyon.org> 写道:
>Lele Ma, le Tue 02 Sep 2014 17:36:36 +0800, a écrit :
>> On Tue, Sep 2, 2014 at 3:47 PM, Samuel Thibault
>> <samuel.thibault@ens-lyon.org> wrote:
>> >
>> > Lele MA, le Tue 02 Sep 2014 15:20:32 +0800, a écrit :
>> > > If Newlib can be used to build mini-os, how to do it? Do I have to compile a
>> > > cross-compiler first?
>> >
>> > Yes. But this all already handled by the Makefile in stubdom/, and see
>> > the end of README about the c-stubdom target which builds the c/
>> > directory.
>> >
>> 
>> Thank you so much! It is great to build newlib so conveniently. But
>> when I run 'make  c-stubdom' in stubdom/, it yields:
>> 
>>      make: *** No rule to make target `mini-os-x86_64-c', needed by
>> `c-stubdom'. Stop"
>> 
>> Do you have any idea about how this happen?
>
>It's been years since I have had a look at that build system :)
>
>Apparently the c target somehow gets disabled, but you can add it by
>hand in 
>
>TARGETS=$(STUBDOM_TARGETS) c

>


Samuel, Thank you so much, it helps! 


But I have to disable the CONFIG_TEST in /stubdom/c/minios.cfg, or it yields multiple definition:
      /media/wind/lab/xen/xen/xen-4.4.0/stubdom/mini-os-x86_64-c/test.o: In function `app_main':
      /media/wind/lab/xen/xen/xen-4.4.0/extras/mini-os/test.c:542: multiple definition of `app_main'
      /media/wind/lab/xen/xen/xen-4.4.0/stubdom/mini-os-x86_64-c/main.o:/media/wind/lab/xen/xen/xen-4.4.0/extras/mini-os/main.c:187: first defined here
Does the stubdomain allow only one app_main to run?
I have tried adding "__attribute__((weak))" before "int app_main()" in main.c, so that it will be replaced by the new definition in test.c. It builds well but the VM cannot be created with yielding erros. 


Another question confuses me a lot. The c-stub domain exit immediately after prints the "Hello world" defined in /stubdom/c/main.c. And the console functions defined in /extras/mini-os/console/console.c has no effect at all. So, how can I enable the console functions? 


The configurations and Makefiles overwhelm me. Any help would be appreciated.


Apologies if questions are too naive.


Best regards,
Lele MA

[-- Attachment #1.2: Type: text/html, Size: 4056 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [Help] How to build mini-OS with libc support, like Newlib?
  2014-09-05  8:40       ` Lele MA
@ 2014-09-06  9:54         ` Samuel Thibault
  0 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2014-09-06  9:54 UTC (permalink / raw)
  To: Lele MA; +Cc: xen-devel

Lele MA, le Fri 05 Sep 2014 16:40:11 +0800, a écrit :
> Does the stubdomain allow only one app_main to run?

Well, yes, sure, just like you can't have several main function in a C
program. This is apparently a spurious change, I have submitted a patch
removing it, thanks for the report.

> Another question confuses me a lot. The c-stub domain exit immediately after prints the "Hello world" defined in /stubdom/c/main.c.

Yes, that's just a hello world example.

> And the console functions defined in /extras/mini-os/console/console.c has no effect at all. So, how can I enable the console functions? 

Which function, precisely?

The C stubdom is supposed to provide you with a C environment, so you
should just use printf.

Samuel

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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-02  7:20 [Help] How to build mini-OS with libc support, like Newlib? Lele MA
2014-09-02  7:47 ` Samuel Thibault
2014-09-02  9:36   ` Lele Ma
2014-09-02 10:55     ` Samuel Thibault
2014-09-05  8:40       ` Lele MA
2014-09-06  9:54         ` Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).