Re: [9fans] Cross-compiling Plan 9

2014-07-14 Thread Yoann Padioleau
Yep, I did exactly the same. With kencc+a-few-patches+plan9port+few-symlinks
you can easily cross compile plan9.

See my kencc fork changes:
https://github.com/aryx/fork-kencc/commits/master
(and my fork 9 fork:
https://github.com/aryx/fork-plan9
)
On Jul 14, 2014, at 3:19 PM, David du Colombier 
<0in...@gmail.com> wrote:

Since I am building everything on Unix, and am using the Unix shell
(bash in my case), I had to rewrite much of the mkfile rules,
specifically ones that deal with loops, conditionals and substituting
outputs from commands. Because all those rules are simple, this was a
trivial task. I also needed to change sed programs embedded all over
the place to be understandable to my systems sed.

If you use plan9port's mk, you can define MKSHELL=rc in the
mkfiles, instead of translating them to bash.

In the same way, you can place $PLAN9/bin at the beginning of
your PATH to use plan9port's sed instead of the Unix one.

In my side, I also tried to compile the Plan 9 programs and
libraries on Unix using Charles' toolchain. It was working
pretty fine. The main issue I encountered was the lack of
support for long Runes in his version.

Thus, I simply copied the related code from Plan 9:

https://urldefense.proofpoint.com/v1/url?u=http://www.9legacy.org/9legacy/patch/kencc-rune.diff&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=%2FN9d7W2LRwZks3eyFNLr8Q%3D%3D%0A&m=aLQhZbTqEOAyTguyZu3l8YOQdmbEXDfuDYgNH8idwCE%3D%0A&s=a9410420e661f42c32ce304cfe6fe28914154e91a65bd7c1c9e5f0f341b0b146

--
David du Colombier




Re: [9fans] Cross-compiling Plan 9

2014-07-14 Thread David du Colombier
> Since I am building everything on Unix, and am using the Unix shell
> (bash in my case), I had to rewrite much of the mkfile rules,
> specifically ones that deal with loops, conditionals and substituting
> outputs from commands. Because all those rules are simple, this was a
> trivial task. I also needed to change sed programs embedded all over
> the place to be understandable to my systems sed.

If you use plan9port's mk, you can define MKSHELL=rc in the
mkfiles, instead of translating them to bash.

In the same way, you can place $PLAN9/bin at the beginning of
your PATH to use plan9port's sed instead of the Unix one.

In my side, I also tried to compile the Plan 9 programs and
libraries on Unix using Charles' toolchain. It was working
pretty fine. The main issue I encountered was the lack of
support for long Runes in his version.

Thus, I simply copied the related code from Plan 9:

http://www.9legacy.org/9legacy/patch/kencc-rune.diff

-- 
David du Colombier



Re: [9fans] Cross-compiling Plan 9

2014-07-13 Thread Aleksandar Kuktin
>On Tue, 8 Jul 2014 02:10:37 +0200
>Aleksandar Kuktin  wrote:
>
> >On Mon, 7 Jul 2014 17:41:35 +
> >Yoann Padioleau  wrote:
> >
> > Hi,
> > 
> > I was able to cross compile Plan9 from MacOS which is probably quite
> > similar to cross compiling from Linux.
> > 
> > The first thing was to compile the plan9 C compilers
> > on MacOS. I used https://code.google.com/p/ken-cc/ because this fork
> > of the Plan9 C compilers are easier to compile on non-plan9 OSes.
> > 
> > Then I installed plan9port which contained a few utilities that are
> > used when compiling the plan9 kernel (/bin/rc, /bin/mk).
> > 
> > [snip]
> 
> Ken-cc may be the missing piece of the puzzle for me, however it is a
> little too early to tell. Right now I'm working on compiling the
> kernel which SHOULD, theoretically, be easier then userspace since
> the kernel is far, far more hermetic than the userspace.
> 
> Anyhow, I'll be sure to post the method for doing it, should I
> eventually end up victorious.

Well, I managed to make the kernel and almost everything else I touched
compile. No idea yet on whether it will run. But libscribble is giving
me a really hard time. There is a bunch of #pragmas about incomplete
data structures that the compiler (8c from Kens suite) doesn't
understand and those are holding me back.

As for the rest, the biggest problem is a bug in Kens compiler from
code.google.com. There is a header, a.out.h, which contains a
definition/declaration (I always forget what is a definition and what is
a declaration) of a structure called Sym that is different in the two
header files. As a consequence, the compiler and assembler produce
object files whose symbol tables the archiver is unable to read. As a
consequence of that, the libraries are useless. The solution to this
was to delete the copy in src/libmach/a.out.h, and rebuild everything
with the other copy.

Since I am building everything on Unix, and am using the Unix shell
(bash in my case), I had to rewrite much of the mkfile rules,
specifically ones that deal with loops, conditionals and substituting
outputs from commands. Because all those rules are simple, this was a
trivial task. I also needed to change sed programs embedded all over
the place to be understandable to my systems sed.

Probably the biggest problem was rewriting several programs from the
aux/ directory (/sys/src/cmd/aux/). These are written to be run on Plan
9 and "porting" them to Unix had to be done by hand. Again, since they
are for the most part simple, it wasn't much of a chore. It just had to
be done.

And that wraps up this weeks events in my attempt to compile and run
Plan 9.

-- 
Svi moji e-mailovi su kriptografski potpisani. Proverite ih.
All of my e-mails are cryptographically signed. Verify them.
--
You don't need an AI for a robot uprising.
Humans will do just fine.


signature.asc
Description: PGP signature


Re: [9fans] Cross-compiling Plan 9

2014-07-09 Thread kokamoto
> do you mean size using the size command or size using ls -l?

Yes, however I know now two edittion of the 9pi sources,
one on my 386 mashin, and the other on my pi machine
are slightly different each other.   Sorry my noise.

Kenji




Re: [9fans] Cross-compiling Plan 9

2014-07-09 Thread Charles Forsyth
do you mean size using the size command or size using ls -l?



On 9 July 2014 01:10,  wrote:

> I got a little bit big size of it by compiling it on my 386
> Plan9 machine than doing on pi itself.
> Is this natural?
>
> Kenji
>
>
>


Re: [9fans] Cross-compiling Plan 9

2014-07-08 Thread kokamoto
I got a little bit big size of it by compiling it on my 386 
Plan9 machine than doing on pi itself.
Is this natural?

Kenji




Re: [9fans] Cross-compiling Plan 9

2014-07-07 Thread Aleksandar Kuktin
>On Mon, 7 Jul 2014 17:41:35 +
>Yoann Padioleau  wrote:
>
> Hi,
> 
> I was able to cross compile Plan9 from MacOS which is probably quite
> similar to cross compiling from Linux.
> 
> The first thing was to compile the plan9 C compilers
> on MacOS. I used https://code.google.com/p/ken-cc/ because this fork
> of the Plan9 C compilers are easier to compile on non-plan9 OSes.
> 
> Then I installed plan9port which contained a few utilities that are
> used when compiling the plan9 kernel (/bin/rc, /bin/mk).
> 
> Then I setup a few symlinks at the root e.g.
> 
> /lib -> /home/pad/plan9/root/lib
> /386 -> /home/pad/plan9/root/386
> /sys -> /home/pad/plan9/sys
> 
> Finally I have a env.sh that I source that contains important
> environment variables: export KENCC=/home/pad/kencc
> # need to modify plan9/src/cmd/mk/shell.c and put rcshell as default
> shell export PLAN9=/usr/local/plan9
> 
> export PATH=$PLAN9/bin:$KENCC/bin:$PATH
> 
> #for 8._cp to be found and called
> PATH=$PATH:.
> 
> export objtype=386
> #export objtype=arm
> export cputype=386
> 
> Then I did a few modifications to plan9 Labs and was able to compile
> and run everything under qemu.
> 
> My forks:
> https://github.com/aryx/fork-kencc
> https://github.com/aryx/fork-plan9

Thanks, Yoann.

Ken-cc may be the missing piece of the puzzle for me, however it is a
little too early to tell. Right now I'm working on compiling the kernel
which SHOULD, theoretically, be easier then userspace since the kernel
is far, far more hermetic than the userspace.

Anyhow, I'll be sure to post the method for doing it, should I
eventually end up victorious.

-- 
Svi moji e-mailovi su kriptografski potpisani. Proverite ih.
All of my e-mails are cryptographically signed. Verify them.
--
You don't need an AI for a robot uprising.
Humans will do just fine.


signature.asc
Description: PGP signature


Re: [9fans] Cross-compiling Plan 9

2014-07-07 Thread Charles Forsyth
On 7 July 2014 19:47, Yoann Padioleau  wrote:

> The main issues I had were related to Rune incompatibilities. See:


An annoying change to get not much (have a look at some of the crud they
stuff into that enlarged space),
but that will also be changed to match the current versions.


Re: [9fans] Cross-compiling Plan 9

2014-07-07 Thread Yoann Padioleau
Hi,

Thx a lot Charles for 
https://code.google.com/p/ken-cc/

The main issues I had were related to Rune incompatibilities. See:
https://github.com/aryx/fork-kencc/commit/67149c8a19d3dcccb303d9d8de4e679384ca1bf6
https://github.com/aryx/fork-kencc/commit/c0877323424a28e86352bbe172c5dad431441c53
https://github.com/aryx/fork-kencc/commit/160e42f7db33acc7b48e89d5999f5ec3a9c49993
...

On Jul 7, 2014, at 11:34 AM, Charles Forsyth 
mailto:charles.fors...@gmail.com>>
 wrote:


On 7 July 2014 18:41, Yoann Padioleau mailto:p...@fb.com>> wrote:

The first thing was to compile the plan9 C compilers
on MacOS. I used 
https://code.google.com/p/ken-cc/
 because this fork
of the Plan9 C compilers are easier to compile on non-plan9 OSes.

I'm (slowly, as usual) bringing those up to date, and will include arm64.



Re: [9fans] Cross-compiling Plan 9

2014-07-07 Thread Charles Forsyth
On 7 July 2014 18:41, Yoann Padioleau  wrote:

>
>  The first thing was to compile the plan9 C compilers
> on MacOS. I used https://code.google.com/p/ken-cc/ because this fork
> of the Plan9 C compilers are easier to compile on non-plan9 OSes.
>

I'm (slowly, as usual) bringing those up to date, and will include arm64.


Re: [9fans] Cross-compiling Plan 9

2014-07-07 Thread Charles Forsyth
On 7 July 2014 19:21, Skip Tavakkolian  wrote:

> i posit that bringing up plan9 on qemu and compiling /sys/src is faster
> than compiling on macos: kencc+p9p+cross compile plan9 and bring up plan9
> on qemu.  i would be happy to be proven wrong.


yes, i think it might.

on linux I use 9vx (not sure about MacOS).

also, when i originally did cross compilation from Solaris (which it was) I
wasn't allowed to change
the system by adding symbolic links but that makes it easier than having to
add parameters to mkfiles.


Re: [9fans] Cross-compiling Plan 9

2014-07-07 Thread Skip Tavakkolian
this is an interesting exercise; however, it is much harder than it needs
to be. perhaps you have other reasons for doing it the hard way.

i posit that bringing up plan9 on qemu and compiling /sys/src is faster
than compiling on macos: kencc+p9p+cross compile plan9 and bring up plan9
on qemu.  i would be happy to be proven wrong.



On Mon, Jul 7, 2014 at 10:41 AM, Yoann Padioleau  wrote:

>  Hi,
>
>  I was able to cross compile Plan9 from MacOS which is probably quite
> similar
> to cross compiling from Linux.
>
>  The first thing was to compile the plan9 C compilers
> on MacOS. I used https://code.google.com/p/ken-cc/ because this fork
> of the Plan9 C compilers are easier to compile on non-plan9 OSes.
>
>  Then I installed plan9port which contained a few utilities that are used
> when compiling the plan9 kernel (/bin/rc, /bin/mk).
>
>  Then I setup a few symlinks at the root e.g.
>
>  /lib -> /home/pad/plan9/root/lib
> /386 -> /home/pad/plan9/root/386
> /sys -> /home/pad/plan9/sys
>
>  Finally I have a env.sh that I source that contains important
> environment variables:
>  export KENCC=/home/pad/kencc
> # need to modify plan9/src/cmd/mk/shell.c and put rcshell as default shell
> export PLAN9=/usr/local/plan9
>
>  export PATH=$PLAN9/bin:$KENCC/bin:$PATH
>
>  #for 8._cp to be found and called
> PATH=$PATH:.
>
>  export objtype=386
> #export objtype=arm
> export cputype=386
>
>  Then I did a few modifications to plan9 Labs and was able to compile and
> run everything
> under qemu.
>
>  My forks:
> https://github.com/aryx/fork-kencc
> https://github.com/aryx/fork-plan9
>
>
>  On Jul 5, 2014, at 7:02 AM, Charles Forsyth 
>  wrote:
>
>
> On 5 July 2014 14:13, Aleksandar Kuktin  wrote:
>
>>
>> Are there any pointers or short instructions or a HOWTO or something
>> similar on the art of cross-compiling Plan 9 from Linux?
>>
>
> It would be easier to compile using 9vx under Linux, or a virtual plan 9
> machine in qemu under Linux.
> It is possible to cross-compile directly, but I've only built and used
> that environment twice myself
> (once for Solaris, once for Linux), and it isn't any longer in any
> distributable shape. It might reappear
> as a side effect of some work on the compiler suite. It's similar to the
> way Inferno's kernel is cross
> compiled using the Plan 9 compilers hosted by some other OS, but needs a
> few special twists to
> deal with the Plan 9 source tree.
>
>
>


Re: [9fans] Cross-compiling Plan 9

2014-07-07 Thread Yoann Padioleau
Hi,

I was able to cross compile Plan9 from MacOS which is probably quite similar
to cross compiling from Linux.

The first thing was to compile the plan9 C compilers
on MacOS. I used https://code.google.com/p/ken-cc/ because this fork
of the Plan9 C compilers are easier to compile on non-plan9 OSes.

Then I installed plan9port which contained a few utilities that are used
when compiling the plan9 kernel (/bin/rc, /bin/mk).

Then I setup a few symlinks at the root e.g.

/lib -> /home/pad/plan9/root/lib
/386 -> /home/pad/plan9/root/386
/sys -> /home/pad/plan9/sys

Finally I have a env.sh that I source that contains important environment 
variables:
export KENCC=/home/pad/kencc
# need to modify plan9/src/cmd/mk/shell.c and put rcshell as default shell
export PLAN9=/usr/local/plan9

export PATH=$PLAN9/bin:$KENCC/bin:$PATH

#for 8._cp to be found and called
PATH=$PATH:.

export objtype=386
#export objtype=arm
export cputype=386

Then I did a few modifications to plan9 Labs and was able to compile and run 
everything
under qemu.

My forks:
https://github.com/aryx/fork-kencc
https://github.com/aryx/fork-plan9


On Jul 5, 2014, at 7:02 AM, Charles Forsyth 
mailto:charles.fors...@gmail.com>>
 wrote:


On 5 July 2014 14:13, Aleksandar Kuktin 
mailto:akuk...@gmail.com>> wrote:

Are there any pointers or short instructions or a HOWTO or something
similar on the art of cross-compiling Plan 9 from Linux?

It would be easier to compile using 9vx under Linux, or a virtual plan 9 
machine in qemu under Linux.
It is possible to cross-compile directly, but I've only built and used that 
environment twice myself
(once for Solaris, once for Linux), and it isn't any longer in any 
distributable shape. It might reappear
as a side effect of some work on the compiler suite. It's similar to the way 
Inferno's kernel is cross
compiled using the Plan 9 compilers hosted by some other OS, but needs a few 
special twists to
deal with the Plan 9 source tree.




Re: [9fans] Cross-compiling Plan 9

2014-07-05 Thread Charles Forsyth
On 5 July 2014 14:13, Aleksandar Kuktin  wrote:

>
> Are there any pointers or short instructions or a HOWTO or something
> similar on the art of cross-compiling Plan 9 from Linux?
>

It would be easier to compile using 9vx under Linux, or a virtual plan 9
machine in qemu under Linux.
It is possible to cross-compile directly, but I've only built and used that
environment twice myself
(once for Solaris, once for Linux), and it isn't any longer in any
distributable shape. It might reappear
as a side effect of some work on the compiler suite. It's similar to the
way Inferno's kernel is cross
compiled using the Plan 9 compilers hosted by some other OS, but needs a
few special twists to
deal with the Plan 9 source tree.


Re: [9fans] Cross-compiling Plan 9

2014-07-05 Thread Jacob Todd
No. Use an installer, then once tinge rebooted cd /sys/src; obtype=arm mk
installn. Replace arm with you architecture of choice.


[9fans] Cross-compiling Plan 9

2014-07-05 Thread Aleksandar Kuktin
Hello list!

Are there any pointers or short instructions or a HOWTO or something
similar on the art of cross-compiling Plan 9 from Linux?

I've recently decided to start using Plan 9 and, because I am a fucking
lunatic, I've decided to download the source code (from
plan9.bell-labs.com) and compile it to a complete system.

Also, since I have decided to piggy-back the booting of Plan 9 on
Linux, where exactly in the source am I supposed to look to figure out
how to boot Plan 9? My plan is to hack Linux and replace the part when
it starts init with a routine to load Plan 9 and pass control to it.

I do all of this because I am dead-set on porting Plan 9 to my
smartphone-turned-handheld computer. Because I'm not sure I won't brick
the device if I muck with the bootloader, I have to go this way since I
have proven that I am capable of changing the kernel without bricking
the device.

-- 
Svi moji e-mailovi su kriptografski potpisani. Proverite ih.
All of my e-mails are cryptographically signed. Verify them.
--
You don't need an AI for a robot uprising.
Humans will do just fine.


signature.asc
Description: PGP signature