I'd like to create a Linux-based OS that works with raspberry pie, and I'd like to know the procedure to do so.
I have looked into various things, but I do not understand the following.I want to create a primitive CUI OS, so I would like to display characters such as Hello World on the screen.First of all, how do you implement and execute it?
I'd like to know how to create an operating system using the Linux kernel and Hello World on the screen, but I've even found out that I'm going to have a Linux kernel, so how do I write and build the code that works?
1. A linux kernel is configured, built and booted.
2. Steps to boot to OS
Build Linux Kernel (Question): I want to know how to work with make [source directory cannot contain spaces or colons.]
A: https://kozos.jp/kozos/
B: http://yuma.ohgami.jp/x86_64-Jisaku-OS/
How does it start: https://www.pmi-sfbac.org/linux-kernel/
linux:https://ja.wikipedia.org/wiki/Linux
Linux kernels:https://ja.wikipedia.org/wiki/Linux%E3%82%AB%E3%83%BC%E3%83%8D%E3%83%AB
Linux kernel downloads:https://www.kernel.org/
PC Boot: https://behind-memoirs.hatenablog.com/entry/2017/11/14/021856
It's not that easy to have an operating system, even with the primitive CUI.
The Linux From Scratch that answers other questions will help you create Linux-based operating systems
Raspberry Pi is small in size and limited in hardware, so the OS may be relatively compact.
However, the prerequisite knowledge of building an OS is not much different.Either way, you need some knowledge and skills.
The steps and achievements you can learn by practicing the LFS book are, so to speak, basic knowledge for application to Raspberry Pi
(By the way, the Linux operating system that will be created is the primitive version of the CUI, and the GUI version of LFS is separate.)
LFS Book Japanese version (lfsbookja): From Version 11.2,
ii. Audience
"Why do you struggle to build Linux manually when you can download and install Linux that you already have?"
The main reason for this project is to help you learn how your Linux system works. When you build an LFS system, you can see how many things work together and depend on each other. If you've had that experience, you can also learn how to transform your Linux system into the way you want it to.
An important advantage of LFS is that it allows you to better control your system without relying on other Linux systems. In the LFS system, you stand on the driver's cab and give instructions to all aspects of the system.
You can also learn how to create a very compact Linux system...
iv. Knowledge Required
The task of building an LFS system is far from simple. Some Unix systems management knowledge is required. You will be prompted to resolve the problem or execute the commands described correctly. At a minimum, you should know how to copy files and directories, see them, change the current directory, and so on. You also need to know how to use and install Linux software.
vi. Why Use Each Package
As we have already explained, the goal of LFS is to build a complete and practical foundation system. The package family in LFS is all you need to build each package. It creates a minimal underlying system. It will expand to a more complete system as users want. LFS does not mean minimal systems. Some packages are not strictly necessary, but others are important. The following list describes the reasons for adopting each package in this document.
There is no function as an operating system just by booting and displaying
The kernel does the following with the built-in features of the kernel configuration, but it is different from the OS itself.
First of all, as a knowledge, the PC boot process goes roughly like this
Replace initramfs from the above process and display "Hello World"
Ubuntu contains /boot/
and initrd.img
below the kernel.
(may not be /boot
for non-Ubuntu distributions)
$ls-ltr/boot/{vm*, init*}
-rw ----------- 1 root root 11548672 November 24 22:15/boot/vmlinuz-5.15.0-57-generic
lrwxrwxrwx1 root root 25 November 30 20:58/boot/vmlinuz->vmlinuz-5.15.0-57-generic
lrwxrwxrwx1 root root 28 November 30 20:58/boot/initrd.img->initrd.img-5.15.0-57-generic
-rw-r--r--1 root root 63433212 December 14 12:38/boot/initrd.img-5.15.0-57-generic
Also, Ubuntu provides the following commands, so you may want to check the contents of the existing initrd.img
lsinitramfs
(list), unmkinitramfs
(deployment), mkinitramfs
(create)Create initramfs(initrd.img.gz
)
#include<stdio.h>
# include <time.h>
int main(void){
printf("------------\n";
printf("Hello, world\n";
sleep(60);
}
Prepare the working directory and compile it there.
Dynamic links should not be available at the time of initramfs execution, so use the static link
(Original Ubuntu mkinitramfs
seems to add extra processing) Create it in an orthodox way
By the way, init is generally the first process of UNIX operating systems
$cd tmp
$ gcc-o init-static hello.c
$ find.|cpio-o-H newc|gzip>../initrd.img.gz
Verification of Operation
$qemu-system-x86_64-m2G-enable-kvm-kernel vmlinuz-initrd initrd.img.gz
Different CPU architectures, different boot loaders.
PC BIOS equivalent boot loader differs from Pi4 and others
There is U-Boot as the boot loader equivalent to GRUB, but it should be okay not to use it
PC BIOS equivalent boot loader differs from Pi4 and others
U-Boot is the boot loader equivalent to GRUB, but it should not be necessary to use it
© 2024 OneMinuteCode. All rights reserved.