Lazarus

Programming => Operating Systems => Topic started by: Blestan on January 21, 2017, 09:17:34 pm

Title: Toro Kernel
Post by: Blestan on January 21, 2017, 09:17:34 pm
Hi folks!
i mentioned that in the past few months ne toro kernel is again in development. the creator of toro (Matias E. Vara)  is doing a great job to update the kernel !!!
the tcp stack is updated and working ...
i have the "briliant" idea to create a fpc cloud infrastruture for web apps based on toro/fpc.
the main concepts are:
1/ monoblock app running in vm based on toro ( the base idea of toro)
2/ simple single user non concurent but async flie system ( todo - help needed on that)
3/ communication with intranet DB (mysql, postgres etc) and cache servers (redis, memcache  ...) .. native (no dll or .so ) clients implementations of the protocols is to be done - help needed... or maybe a thin tcp/http warpper based on json for communication with the servers?
4/ serving web requests on the extranet with a very fast (bare metal) http server
5/ running apps in vm deployed by platform like openskack
6/ no code injection possible due to the monoblock concept of toro - app is compiled and part of the kernel - one vm is runing a single kernel with the app embeded
7/ no interpreded languages - no risk :)
8/ minimal overhead no additional drivers except for ethernet and disk

waiting for your comments and suggestions!

:))
Title: Re: Toro Kernel
Post by: z0rr0 on February 18, 2017, 03:31:42 pm
Hi everyone, I have just moved the toro repo to github: https://github.com/MatiasVara/torokernel. I am also trying to organize the TODO work by using project and issue sections. Fell free to go through!


Regards, Matias.

Title: Re: Toro Kernel
Post by: z0rr0 on June 17, 2017, 05:13:53 pm
Hi everyone, I would like to share my last work related with Toro. Toro is now able to run as KVM guest. This is still experimental but I think work is going well. To show this, I deployed ToroHello example in a VM which anyone can see by connecting a VNC client to 51.15.142.20:5900. This is still a very simple example however it shows how easily a freepascal application can be deployed in the cloud. This application is quite fast since there is no OS, only TORO.   

Regards, Matias.
Title: Re: Toro Kernel
Post by: Blestan on June 17, 2017, 06:11:17 pm
great new matias!!! on my side im advancing on the rest api backend ... soon we can test to compile the server under toro.. do you have an idea im is possible to deploy toro as a digital ocean droplet... cannot find any info about the vm they use... kvm docker or other... anyway toro is great ;)
Title: Re: Toro Kernel
Post by: SunyD on June 17, 2017, 09:21:26 pm
I would integrate PascalScript, then the user can create own applications.
I am using pascalscript in my applications it is very usefull. You don't need LCL for PascalScript.
I use it on Android too.
Title: Re: Toro Kernel
Post by: Blestan on June 17, 2017, 10:51:45 pm
why to integrate. an interprerer when you can deploy native???? not only speeed degradation but also a security problem...you will have a nodejs server...why???
Title: Re: Toro Kernel
Post by: taazz on June 17, 2017, 11:11:51 pm
why to integrate. an interprerer when you can deploy native???? not only speeed degradation but also a security problem...you will have a nodejs server...why???
as a programmable shell like bash but true programmable not a toy language.
Title: Re: Toro Kernel
Post by: z0rr0 on June 18, 2017, 01:07:59 pm
Toro has very particular architecture in which certain applications are improved but other gets no too much benefices. Toro is good when an application can be split in pipelines. In that case, you can run every pipeline in a different core and then dedicate all the resources needed by core. This reduces a lot the overhead due to shared resources. In addition, switch context are very light.   
Title: Re: Toro Kernel
Post by: jc99 on June 18, 2017, 04:17:44 pm
Hi everyone, I would like to share my last work related with Toro. Toro is now able to run as KVM guest. This is still experimental but I think work is going well. To show this, I deployed ToroHello example in a VM which anyone can see by connecting a VNC client to 51.15.142.20:5900. This is still a very simple example however it shows how easily a freepascal application can be deployed in the cloud. This application is quite fast since there is no OS, only TORO.   

Regards, Matias.
If you like I Worked a little In ToroKernel I tried to put the KernelModuled in a Package, but I didn't without success (maybe you Could help)
But I managed to get My Writepascal-demo running.
Code: Pascal  [Select][+][-]
  1. // Toro Write Pascal Example.
  2. // Example using a minimal kernel to print "Pascal" in 3D
  3.  
  4. // Changes :
  5.  
  6. // 19/06/2017 First Version by Joe Care.
  7.  
  8. // Copyright (c) 2017 Joe Care
  9. // All Rights Reserved      
  10.  
  11. // This program is free software: you can redistribute it and/or modify
  12. // it under the terms of the GNU General Public License as published by
  13. // the Free Software Foundation, either version 3 of the License, or
  14. // (at your option) any later version.
  15.  
  16. // This program is distributed in the hope that it will be useful,
  17. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. // GNU General Public License for more details.
  20.  
  21. // You should have received a copy of the GNU General Public License
  22. // along with this program.  If not, see <http://www.gnu.org/licenses/>.
  23.  
  24.  
  25. program WritePacal;
  26.  
  27. {$IFDEF FPC}
  28.  {$mode delphi}
  29. {$ENDIF}
  30.  
  31. {$IMAGEBASE 4194304}
  32.  
  33. // Configuring the RUN for Lazarus
  34. {$IFDEF WIN64}
  35.           {%RunCommand qemu-system-x86_64.exe -m 512 -smp 2 -drive format=raw,file=ToroHello.img}
  36. {$ELSE}
  37. {%RunCommand qemu-system-x86_64 -m 512 -smp 2 -drive format=raw,file=ToroHello.img}
  38. {$ENDIF}
  39. {%RunFlags BUILD-}
  40.  
  41. // They are declared just the necessary units
  42. // The needed units depend on the hardware where you are running the application
  43. uses
  44.     Kernel in '..\rtl\Kernel.pas',
  45.     Process in '..\rtl\Process.pas',
  46.     Memory in '..\rtl\Memory.pas',
  47.     Debug in '..\rtl\Debug.pas',
  48.     Arch in '..\rtl\Arch.pas',
  49.     Filesystem in '..\rtl\Filesystem.pas',
  50.     Pci in '..\rtl\Drivers\Pci.pas',
  51.     Console in '..\rtl\Drivers\Console.pas';
  52.  
  53. const
  54.     i64: int64 = 1055120232691680095; (* This defines "Pascal" *)
  55.     cc: array[-3..3] of ShortString = (* Here are all string-constants *)
  56.         ('\ '#8' \  ',
  57.         #8'__    ',
  58.         #8'__/\  ',
  59.         '  '#8'    ',
  60.         #8'__/\  ',
  61.         '  '#8'    ',
  62.         #8'__/\  ');
  63.  
  64. var
  65.     x, y, c: integer;
  66.  
  67. begin
  68.     PrintStringLn(StringOfChar(cc[1][1], 78));
  69.     for y := 0 to 11 do
  70.       begin
  71.         PrintString(StringOfChar(cc[0][1], 13 - y));
  72.         for x := 0 to 16 do
  73.             for c := 1 to 5 + (x mod 3) and 2 do
  74.                 if c <= length(cc[(x - 5) mod 4]) then
  75.                     PutC(cc[(((i64 shr ((x and 15) * 4 + y div 3)) and (3 -
  76.                         (y div 9) shl 1)) - 4 + (2 - y mod 3) shl 2) mod 4][c]);
  77.         PrintStringln();
  78.       end;
  79.     while True do
  80.         SysThreadSwitch;
  81. end.
  82.  
Put all together in the patch, even a defaultToro.xml (default-Project settings)
Patch attached .
Title: Re: Toro Kernel
Post by: z0rr0 on June 18, 2017, 04:56:19 pm
Thanks jc99! I have to replace the methods used to access the console. In Toro the console is written by using WriteConsole() method. I will do it and deploy it soon. 
Title: Re: Toro Kernel
Post by: jc99 on June 18, 2017, 05:40:52 pm
There is a problem with WriteConsole.
My original code was:
Code: Pascal  [Select][+][-]
  1. WriteConsole(Copy(CC[],1,5+2),[0]);
that crashed of cause with the formating option Then i Tried:
Code: Pascal  [Select][+][-]
  1. WriteConsole('%s',[Copy(CC[],1,5+2)]);
that crashed because Copy() is no PtrUint
So i exported the PrintString Procedure and enabled PutC to handle the backspace-Character
First test looked promising, But then the next drawback:
When you write something like 'abc'+s (:ansistring) you get an error (Wrong parameter in Concat)
When you do copy(s {:ansistring = '123456'} ,1,7) The output went nuts (lot of stupid characters).
When you do copy('123456' ,1,7) get an error (Wrong parameter ) Shortstring to ansistring
.
.
That went on ...
Before final version I tied
Code: Pascal  [Select][+][-]
  1. PrintString(CC[][c]);
Error Char to ansistring wrong parameter.
the final version With PutC exportet worked at last.

Please rename the procedure (or overload it If you like) WriteConsole has no indication that it needs Format-Parameters a name like WriteConsoleFmt would indicate that, like the MessageFmt Function, Even in C printf means print formatted on the contrary to write that prints unformatted.
Title: Re: Toro Kernel
Post by: jc99 on June 18, 2017, 05:58:15 pm
Quote from: z0rr0
I have to replace the methods used to access the console.

No, You don't.
The trick to get the Write, Writeln, readln... working, is to handle/open the Input and Output- files. Demontration in the Wiki.

BTW: attachts an image (preview)
Title: Re: Toro Kernel
Post by: jc99 on June 18, 2017, 06:15:35 pm
A Mouse support/driver is missing, and i could contribute a graph unit that handles Vesa-Graphics (without the BGI-nonsens of cause)
Mouse is needed/would be good when porting FV
Title: Re: Toro Kernel
Post by: z0rr0 on June 18, 2017, 07:18:53 pm
Quote from: z0rr0
I have to replace the methods used to access the console.

No, You don't.
The trick to get the Write, Writeln, readln... working, is to handle/open the Input and Output- files. Demontration in the Wiki.

BTW: attachts an image (preview)


Sorry I misunderstood the previous messages. Thanks for the patch I will review it and implement it.
 
Title: Re: Toro Kernel
Post by: jc99 on June 19, 2017, 12:49:45 am
No problem, that happens
Apart from those drawbacks I really like it, and very much appreciate your Work (Wow! WTG!) 
Title: Re: Toro Kernel
Post by: jc99 on June 19, 2017, 01:20:20 pm
Sorry I misunderstood the previous messages. Thanks for the patch I will review it and implement it.
Try this one: It's the next version (reduced some possible incompatibilities longint(Pointer())-> PtrInt(Pointer()) ...
In my opinion better File-structure (because binaries, project-files, source-code, rtl-Code are each in separate folders.
and a Group-file + Project-Template-XML
 
 
Title: Re: Toro Kernel
Post by: z0rr0 on June 19, 2017, 04:39:24 pm
HI, thanks for the patch I will review it later. I think for future contributions it could be better to fork toro kernel project from https://github.com/MatiasVara/torokernel and them submit a pull request. This allows to run several tests before the code is merged thus easing the integration with master.
Title: Re: Toro Kernel
Post by: jma_sp on June 19, 2017, 05:51:55 pm
   Hola Zorro, me alegra ver que después de tantos años sigues con el proyecto. De aquel tiempo en que ya permitía crear directorios....luego el Telnet....multiprocesador.....y ahora un nuevo paso.

   Tenerlo funcionando bajo KVM es un paso importante puesto que cualquiera se lo puede instalar bajo un Linux en un pendrive.

   Si le ponen un entorno gráfico simple puede ser interesante :), siento no tener conocimientos más avanzados para ayudarte.


51.15.142.20:5900

¿Con que software VNC se puede conectar? ¿alguna encryptación?

Saludos.
Title: Re: Toro Kernel
Post by: z0rr0 on June 19, 2017, 07:31:14 pm
Hi, thanks you can use any VNC viewer without encryption.
Title: Re: Toro Kernel
Post by: jc99 on June 19, 2017, 07:47:56 pm
HI, thanks for the patch I will review it later. I think for future contributions it could be better to fork toro kernel project from https://github.com/MatiasVara/torokernel (https://github.com/MatiasVara/torokernel) and them submit a pull request. This allows to run several tests before the code is merged thus easing the integration with master.
I just did !
Title: Re: Toro Kernel
Post by: z0rr0 on June 28, 2017, 10:54:10 pm
Hi everyone, I could make the networking works on KVM so I implemented a simple http server in Toro. You can connect it by opening http://212.47.247.255/ in the browser. If you want to see the console, the vnc is at port 5900. Networking is still very experimental!!!

Cheers, Matias.
Title: Re: Toro Kernel
Post by: avra on June 29, 2017, 02:57:11 pm
I implemented a simple http server in Toro. You can connect it by opening http://212.47.247.255/ in the browser.
Nope, not working. Even ping times out.
Title: Re: Toro Kernel
Post by: z0rr0 on June 29, 2017, 03:48:39 pm
Hi, thanks for testing. It is working for me. Pings don't work.
Title: Re: Toro Kernel
Post by: Thaddy on June 29, 2017, 04:06:52 pm
port 80 times out, but port 5900 responds.. (w/o vnc) Nice!
Title: Re: Toro Kernel
Post by: jc99 on July 01, 2017, 07:40:43 am
If we want to use the other components (and not having to rename everything) i'd vote for "toro" or "baremetal" as a TargetOS in the Compiler-Target options.
So that there is no name-conflict when using the components. 

BTW: int 10h is not working does anyone know how to circumvent this ? Or how to set the font8x8 mode ?
Title: Re: Toro Kernel
Post by: z0rr0 on July 01, 2017, 01:41:28 pm
Hello,
If we want to use the other components (and not having to rename everything) i'd vote for "toro" or "baremetal" as a TargetOS in the Compiler-Target options.
So that there is no name-conflict when using the components. 

BTW: int 10h is not working does anyone know how to circumvent this ? Or how to set the font8x8 mode ?

None of the ints that you use in DOS will work in Toro. Don't forget that the application is running in long mode. So if you want to access to graphical mode you should write a complete driver for that. 

Regards,   
Title: Re: Toro Kernel
Post by: jc99 on July 01, 2017, 02:54:38 pm
All documentation i could find Say: set this set that and then int 10h ... Do you know a better solution ? Have you any documentation on VGA or video ?
Title: Re: Toro Kernel
Post by: z0rr0 on July 15, 2017, 10:08:12 pm
Hi everyone, I just wrote down the procedure to get a Toro guest running on the Scaleway cloud (also applicable to a different cloud). Here you have the link http://torokerneleng.blogspot.co.uk/2017/07/deploy-toro-application-in-cloud-in-4.html (http://torokerneleng.blogspot.co.uk/2017/07/deploy-toro-application-in-cloud-in-4.html) to the blog. I also provide a Toro image that you can download and try so it is not needed to compile anything. If procedure goes well you will have a Toro guest running that you can connect by VNC to port 5901 of the host and also answers http connections to the port 80 of the host.

Regards. 

Title: Re: Toro Kernel
Post by: z0rr0 on February 10, 2018, 07:02:43 pm
Hello everyone,

I just created a docker image to ease the compilation of Toro kernel in Linux. I posted the procedure here http://torokerneleng.blogspot.com.es/2018/02/docker-image-to-compile-toro-on-linux.html (http://torokerneleng.blogspot.com.es/2018/02/docker-image-to-compile-toro-on-linux.html) if someone wants to try.

Regards, Matias. 
TinyPortal © 2005-2018