# Light Linux System

## How to prevent my old code from broking as time goes by?

As you know, those software dependencies is not stable as the time goes by.

People will try to update it.

And sometimes the update can broke old codes.

The only way to prevent the broking happening is to build everything from scrach, by myself.

So that no one can update my tech tree except myself.

In general, first, I should try to build an amd64 cpu based computer.

Then start to build a linux system that has user\_interface.

But to simplify the process, since I don't have enough money, I shall start from building a new linux system.

## Requirements for the new linux system

1. Allow root permission. Which means if you have root permission, you can do any automation by making script without limitations. All can be done automatically with command line without confirm.
2. Responsive user interface design. We can't guarantee the resolution of our user device, so it is better to adopt every resolution when we design our software. No matter it is mobile view or desktop view.
3. Backend and Frontend seperated. Just think about ubuntu\_server. You can just use command line in console to do a lot of things without install a fancy user interface library. In this case, we can treat the new system backend software as a console application, and run it on any existed system, like linux shell, android termux, apple terminal and so on. And then, use a GUI application as the view window to display the new system. (Of cause, we also provide an iso system image to install both backend and frontend new system into user's computer once for all.)

## Implementation Details

1. Download a minimum version of ubuntu server. Based on docker hub version, it should be less than 100MB. Never upgrade it.
2. Download a python source code repository. Pre-compile it and put it into "/bin/fixed\_python". Never upgrade it. Pip is also needed. (You can also create a python virtual envirnoment like "/opt/.venv", and link the "/opt/.venv/bin/pip" and "/opt/.venv/bin/python3" to "/bin/fixed\_pip" and "/bin/fixed\_python")
3. Based on the python version you just compiled, you can start to write the new linux system. Make it as similar to the old linux system as possible, but only use Python to implement those functionality.
4. Send rendered screen image or sound to display\_client like a VNC client by using HTTP POST method. And the display\_client shall also send user input like keyboard or mouse or screen touch information back into the python backend service.
5. Integrate everything into the ubuntu server you downloaded before, let the new linux system auto running at the booting time, make it as an iso file, install it to virtualbox to test if the new system is working or not. If not working, fix it.
6. Compile the python backend service and front\_end client into applications, test if android system, old linux system, apple system can run the new linux system smoothly or not. If not, fix it.

## Implementation Details, Method 2

1. Download a minimum version of ubuntu server. Based on docker hub ubuntu version, it should less than 100MB. Never upgrade it.
2. Download pip. Never upgrade it.
3. Make a broswer by using pure python. This broswer should be a backend and frontend seperated project. Which means, the backend service handles pure logic, and when it needed to render some image to the screen or play sound, it need to send HTTP POST request to a view\_client. Make the broswer the only user\_interface on the screen when user start the system.&#x20;
4. The broswer should adopt different types of resolution for user device. For example, mobile, desktop.
5. Integrate everything into the ubuntu server you downloaded before, let the new linux system auto running at the booting time, make it as an iso file, install it to virtualbox to test if the new system is working or not. If not working, fix it.
6. Compile the python backend service and front\_end client into applications, test if android system, old linux system, apple system can run the new linux system smoothly or not. If not, fix it.

## Implementation Details, Method 3

1. Use Flutter to create a cross platform application. It should work in linux desktop, linux mobile(android).
2. This application will require Root Permission, so that it could install Python binary globally.
3. This application also has a built\_in webview framework inside. So that you could use this application to visite HTTP website. (There basically has two situation, one is normal website, which need to use flutter webview to do the rendering, another is python website, which need the python backend to do the rendering.)
4. For each website, if they leave a static file called 'http://domain.com/python\_service.zip', we'll ask user if they want to install a local service for that website. If they want, then we'll download it and extract it into a folder called '/python\_service/domain.com', then whenever user visit that website, we'll use 'yppm' to install that python service dependencies and run that service directly.
5. This application basically composed by 3 tabs:&#x20;
   1. launch page, where you can click website icon to open them.
   2. broswer page, where you can visit any website you want.
   3. terminal page, where you can excute any root command.

* [https://pub.dev/packages/root](https://pub.dev/packages/root)
* [https://pub.dev/packages/webview\_flutter](https://pub.dev/packages/webview\_flutter)
* [https://pub.dev/packages/desktop\_webview\_window](https://pub.dev/packages/desktop\_webview\_window)

## Implementation Details, Method 4

This method will use micro\_controller + Touchable LCD + Optional keyboard.

#### How to make a mobile or desktop envirnoment for linux?

First, we don't need those application in our platform to do anything but give us images when they think the user interface should get updated.

Then, what we need to do is send the keyboard, mouse, touchscreen, resolution to that application that is currently running at the front-end.

For each time, there would only have one single application is running at the front-end, I mean they can't send you graphic image data at the background. (You won't request graphic data in background for that application)

And for the desktop or launcher we have, there would always have 3 buttons at the bottom: recent\_apps, home, back.

And what we will do as a desktop envirnoment is to send the mixed graphic data directly to the FTF SPI LCD Screen.

In this case, we don't need any modern desktop envirnoment that is normally greater than 1GB, but a simple python script that is smaller than 500KB.

**Protocol**

**For launcher**

```
/add_or_update_app

request:
{
    "app_name": "",
    "app_icon_url": "",
    "app_url": ""
}
```

**For each app**

```
/get_graphic_image

request:
{
}

response:
{
    "has_image": true/false,
    "image": <base64_string>
}



/send_control_info

request:
{
    "keyboard": ascii_for_keyboard,
    "mouse": ...,
    "touch_screen": ...,,
    "resolution": 1080x1920,
}
```

**More Info**

I'm not making a desktop launcher, it is mobile only. And all design is resposive since I'll send resolution info to apps in realtime. (By the way, if user want to open two window in desktop, they could just do it, what is the difficulty? Render two window, one is left, another is right, they are all images.)

The multiple\_window is not a problem, for those applications, they will always running in the backgroud, if user want to switch back to an app, they just have to use bottom 'recent app' to get recent app list, then click it to do a quick switch.

The camera, microphone, speaker is useable for every application. The camera, microphone is read only, each time will only return one, data or none. The speaker will receive quite a lot of data, we will do a mix and play. (They all can get disabled in global level)

**More infomation about the User Interface Library implementation**

```
Let's talk about the user interface library we are going to make:

1. It is a pure image based library. or RGBA 2-dimensional array based library. The final output and middle representation is pure number and arrays. We can add sub_picture to the top of another picture in a specified position. Anything photoshop_like image editor could do, we could do. Anything a 3D game engine could do, we could do.

2. For the input part, we treat touch_screen as mouse pointer, so that for the desktop and mobile, we use one single user interactive system. For example, when user touch a position at touch screen, we first move the mouse to that position, then automatically click that position. In the end, we will only handle mouse and keyboard and any other USB devices.

3. The user interface is a responsive one. It changes interface width or layout based on resolution change. Normally UI component height won't get changed. So that for any application that uses this graphic library, they could get adopted to different resolution of screens.

#UI #Library #yingshaoxo
```

**About "how to output image to LCD in normal Linux"**

They write graphic data to `/dev/fb0` (fb means framebuffer).

Some android device also uses drm(direct rendering manager). But it is a lie, it is not a direct way. The development is driving by GPU factory. If you use it, in the end you may found you have to pay to render images per month.

## Implementation Details, Must have features

In terminal level, it should only have "bash, passwd, ssh, wget(with ssl support), chmod, mv, cp, rm, mkdir, vim, pwd, ls", and anything else will depend on third party binary files in /bin folder.

## Author

yingshaoxo
