[linux] Linux Kernel one C program

Ritter, Gabriel ritterg at oregonstate.edu
Sun Sep 19 13:42:46 PDT 2021


 From my understanding, I do not think this would work as you are 
describing it and in general is highly nontrivial.

The Linux kernel is complicated, does not work like a regular 
application, is closely tied to hardware (not sure if quantumplayground 
has an emulator so would also need to supply that in the code), and the 
size is probably too large to be accepted by quantumplayground.

Bitcode is a universal format used by the LLVM framework, and Emscripten 
is based on LLVM, however cross language compilation support is not 
really possible with the Linux kernel yet for any language.

The best approach would probably be to code a "simple" application that 
mimics an simplified operating system. Maybe some implementations 
already exist. It may be useful to read some textbooks on operating 
systems and papers on minimal operating systems like microkernels, 
unikernels, and rump kernels

On 9/19/21 1:19 PM, Daniel Ortiz wrote:
>
> [This email originated from outside of OSU. Use caution with links and 
> attachments.]
>
> Here is how I can use it the Linux Kernel one C program. I use 
> Emscripten to convert it into JavaScript code, and then try to run it 
> in Quantum Playground and if it doesn't for size or language 
> compatibility issue(s) then it would need to be figured out later how 
> to do with that/those issue(s). It is a uncommon use case. Please let 
> me know if what you recommended earlier works for this if you want.
>
> Home page of Quantum Computing Playground: 
> http://www.quantumplayground.net/#/home 
> <http://www.quantumplayground.net/#/home>
>
> On Sun, Sep 19, 2021 at 3:05 PM Ritter, Gabriel 
> <ritterg at oregonstate.edu <mailto:ritterg at oregonstate.edu>> wrote:
>
>     I'm not completely sure what you mean or what you are trying to
>     do. Are
>     you trying to compile a standalone Linux kernel and maybe run it
>     with QEMU?
>
>     Otherwise the closest thing I can think of is using gllvm/wllvm to
>     compile it into single bitcode file which you can load into LLVM and
>     then modify and recompile to do whatever you want. This is technique
>     used in many research papers. There are similar ways to do this at
>     the
>     source code level with Clang (the bitcode file is at a lower level of
>     abstraction, some things are easier/harder to do there). Overall
>     these
>     compilation processes can be finicky and may require decent hardware,
>     and applying modifications may be nontrivial.
>
>     https://github.com/SRI-CSL/gllvm <https://github.com/SRI-CSL/gllvm>
>     https://clang-analyzer.llvm.org/scan-build
>     <https://clang-analyzer.llvm.org/scan-build>
>     https://github.com/ClangBuiltLinux/tc-build
>     <https://github.com/ClangBuiltLinux/tc-build>
>     https://github.com/ClangBuiltLinux/boot-utils
>     <https://github.com/ClangBuiltLinux/boot-utils>
>
>
>     On 9/19/21 11:48 AM, Daniel Ortiz wrote:
>     > Hello everyone,
>     > May someone tell me how to put the Linux Kernel into one C
>     program? It
>     > would take a lot of work to do, so unless you decide you are
>     going to
>     > do that work give me pointers on what to do.
>     > From, Daniel Ortiz
>     >
>     > _______________________________________________
>     > linux mailing list
>     > http://lug.oregonstate.edu/ <http://lug.oregonstate.edu/>
>     > http://lists.oregonstate.edu/mailman/listinfo/linux
>     <http://lists.oregonstate.edu/mailman/listinfo/linux>
>
>     _______________________________________________
>     linux mailing list
>     http://lug.oregonstate.edu/ <http://lug.oregonstate.edu/>
>     http://lists.oregonstate.edu/mailman/listinfo/linux
>     <http://lists.oregonstate.edu/mailman/listinfo/linux>
>



More information about the linux mailing list