Operating System Development-migrate the value of Linux library to my OS and my plan

Source: Internet
Author: User

There are many different libraries in Linux,
Moving them all to my OS is a very large task,
There must be a plan for a task first. A more scientific method should be used to determine the shift order, as shown below:

First shift the lowest-level database of the value,
But how can we determine that a database is the bottom layer? I have developed a small software to view the dependencies of various libraries,
Its principle is very simple, that is, to view records in the ELF file format in each database, there is a section in the elf record that records this library and what library for dependency. Scan/lib,/usr/lib,/usr/local/lib to generate the following "library"
Dependency Chart"

On the left side of the graph, you will see level 0, level 1, etc. It represents the layer. On the right side, you will see a lot of different libraries at the same layer, they depend on the lower-level libraries. The arrows refer to dependencies ).

This technology also has its disadvantages, that is, there is no dependency information recorded in the static library, because "static" is not used for dynamic linking. However, most libraries in Linux are dynamic libraries, and all generated dependency diagrams are also accurate. I used this small software to try to scan many different Linux programs. There are three or four simple layers, and I have seen 16 or 17 layers of complexity, with few or more than 20 layers.

If there are two databases at the same layer, how should we decide to first port the database? I personally think it is easy to get rid of it first. We can scan the number of symbrs In the ELF format in the Library (repeated ), you can know how many functions it uses in the library on which it depends. We can estimate how complicated it is to port the library.

LinuxThe world is a tree structure

Linux World is a tree structure, the bottom is always ld-linux.so and libc, can prove that the C language has started the world, surprisingly, the underlying importance of the C ++ language is much lower than I imagined. The minimum is standard.
The C ++ library is invisible at the bottom layer. Therefore, the underlying Linux operating system is C ++ incorrect.

Transplantation order

1)
Fix libc first,
This is unfeasible. newlib can be used as the association product of glibc. glibc is too huge.

2)
All libraries that only have a single dependency on libc,
This means that if a library is dependent only on libc,
First Port them,
They are libc, libc, zlib, libm, libpthread.
You can extract them to run busybox,
The proof is as follows:

/Root/download/busybox-1.20.2/_ install/bin> readelf-A busybox | grep-I needed 0x00000001 (needed) Shared Library: [libm. so.6] 0x00000001 (needed) Shared Library: [libc. so.6]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.