在移动设备上修改并启动linux内核

时间:2022-03-08 03:09:55

During my education I have been developing Android iOS apps and websites for almost 18 months. Now, as my final year project, I am working on Linux source code with the goal to boot it on a mobile device – like Android. I have it successfully as a Debian package following tutorials on the Internet. I am currently using Ubuntu.

在我的教育期间,我已经开发了近18个月的Android iOS应用程序和网站。现在,作为我的最后一年项目,我正在研究Linux源代码,目标是在移动设备上启动它 - 比如Android。我在互联网上的教程之后成功地将它作为Debian软件包。我目前正在使用Ubuntu。

I have a strategy but not sure if I am on the right track. It is as follows:

我有一个策略,但不确定我是否在正确的轨道上。它如下:

A:

  1. Download Linux source code. Remove extra drivers, compile and install it on currently running Ubuntu and use it.

    下载Linux源代码。删除额外的驱动程序,在当前运行的Ubuntu上编译并安装它并使用它。

  2. Customize the code further and boot it as my own distribution. For that I'm following LFS.

    进一步自定义代码并将其作为我自己的发行版启动。为此,我正在关注LFS。

  3. Specify a particular target mobile, modify the code for it, write drivers if I need any, not sure which one (that's why I'm here :) ), and boot the kernel on it.

    指定一个特定的目标移动设备,修改它的代码,如果我需要的话编写驱动程序,不确定哪一个(这就是为什么我在这里:)),并在其上启动内核。

I do not know whether my strategy is right or not. I'll really appreciate if someone can tell me:

我不知道我的策略是否正确。如果有人能告诉我,我真的很感激:

B:

  1. Am I on the right track? If not, what might be the right one?

    我是在正确的轨道上吗?如果没有,那可能是正确的?

  2. Do I need to specify a mobile and customize the kernel code for that one?

    我是否需要指定移动设备并为该设备自定义内核代码?

  3. Other than drivers, what else do I need to change in the kernel?

    除了驱动程序,还需要在内核中进行哪些更改?

  4. Last but not the least when I boot the kernel on a mobile device; am I going to have any interface or terminal there?

    当我在移动设备上启动内核时,最后但并非最不重要;我会在那里有任何接口或终端吗?

Sorry if my question doesn't make sense. I am a student and still trying to figure things out. I would be very thankful if someone could give me hints on what subjects to search for on the Internet.

对不起,如果我的问题没有意义。我是一名学生,仍在努力解决问题。如果有人能给我一些关于在互联网上搜索哪些主题的提示,我将非常感激。

Update: What I want is to confirm whether my strategy is correct or not. If not, then please just name the steps I should follow.

更新:我想要的是确认我的策略是否正确。如果没有,那么请说出我应该遵循的步骤。

1 个解决方案

#1


2  

It is not unusual that the drivers for the SoC and devices around it are closed source. As far as I know, the drivers for the Exynos SoC (the stuff Samsung uses in many of their devices) is (partly) closed source.

SoC的驱动程序及其周围的设备是封闭源,这并不罕见。据我所知,Exynos SoC的驱动程序(三星在其许多设备中使用的东西)是(部分)封闭源。

So generally speaking you have to write drivers for everything and everyone. Especially the actual radio connection is tricky as there are no devices which need proprietary firmware blobs (although the rest of the drivers may be open source).

所以一般来说,你必须为所有人和每个人编写驱动程序。特别是实际的无线电连接是棘手的,因为没有设备需要专有的固件blob(尽管其余的驱动程序可能是开源的)。

Another problem is the boot loader on many devices, which does not easily let you install custom kernels (hash sum stored in the boot loader, unwilling to boot if kernel hash does not match).

另一个问题是许多设备上的引导加载程序,它不容易让你安装自定义内核(存储在引导加载程序中的哈希值,如果内核哈希不匹配则不愿启动)。

So, assuming you are developing for a device that is already supported by android, I personally would start with the corresponding device tree for your device and start modifying that. You can a lot of device trees on CyanogenMod's github page.

因此,假设您正在为Android已经支持的设备进行开发,我个人会从您设备的相应设备树开始并开始修改它。你可以在CyanogenMod的github页面上看到很多设备树。

Benefits:

  • You can start off with a working state
  • 你可以从一个工作状态开始

  • If something breaks you know it was you
  • 如果有什么东西坏了你知道那是你

Alternatively, you can peek at other projects like Ubuntu Touch. They are able to utilize existing android kernels by using Hybris. If you want to have a distribution based on Debian/Ubuntu I would recommend trying Ubuntu Touch and modifying that.

或者,您可以查看其他项目,如Ubuntu Touch。他们可以通过使用Hybris来利用现有的android内核。如果你想要一个基于Debian / Ubuntu的发行版,我会建议尝试Ubuntu Touch并修改它。

#1


2  

It is not unusual that the drivers for the SoC and devices around it are closed source. As far as I know, the drivers for the Exynos SoC (the stuff Samsung uses in many of their devices) is (partly) closed source.

SoC的驱动程序及其周围的设备是封闭源,这并不罕见。据我所知,Exynos SoC的驱动程序(三星在其许多设备中使用的东西)是(部分)封闭源。

So generally speaking you have to write drivers for everything and everyone. Especially the actual radio connection is tricky as there are no devices which need proprietary firmware blobs (although the rest of the drivers may be open source).

所以一般来说,你必须为所有人和每个人编写驱动程序。特别是实际的无线电连接是棘手的,因为没有设备需要专有的固件blob(尽管其余的驱动程序可能是开源的)。

Another problem is the boot loader on many devices, which does not easily let you install custom kernels (hash sum stored in the boot loader, unwilling to boot if kernel hash does not match).

另一个问题是许多设备上的引导加载程序,它不容易让你安装自定义内核(存储在引导加载程序中的哈希值,如果内核哈希不匹配则不愿启动)。

So, assuming you are developing for a device that is already supported by android, I personally would start with the corresponding device tree for your device and start modifying that. You can a lot of device trees on CyanogenMod's github page.

因此,假设您正在为Android已经支持的设备进行开发,我个人会从您设备的相应设备树开始并开始修改它。你可以在CyanogenMod的github页面上看到很多设备树。

Benefits:

  • You can start off with a working state
  • 你可以从一个工作状态开始

  • If something breaks you know it was you
  • 如果有什么东西坏了你知道那是你

Alternatively, you can peek at other projects like Ubuntu Touch. They are able to utilize existing android kernels by using Hybris. If you want to have a distribution based on Debian/Ubuntu I would recommend trying Ubuntu Touch and modifying that.

或者,您可以查看其他项目,如Ubuntu Touch。他们可以通过使用Hybris来利用现有的android内核。如果你想要一个基于Debian / Ubuntu的发行版,我会建议尝试Ubuntu Touch并修改它。