update: specifiy kernel version & update readme
This commit is contained in:
@@ -6,34 +6,17 @@
|
||||
sudo apt install qemu-system-x86 grub-pc-bin e2fsprogs
|
||||
```
|
||||
|
||||
## Run
|
||||
## Build
|
||||
|
||||
```bash
|
||||
gcc -static -o init/init init/init.c
|
||||
git clone <REPOSITORY_URL>
|
||||
cd kernel-study
|
||||
|
||||
dd if=/dev/zero of=disk.img bs=1M count=512 status=none
|
||||
echo -e "n\np\n1\n2048\n\nw" | fdisk disk.img > /dev/null
|
||||
|
||||
dd if=disk.img of=part.img bs=512 skip=2048 status=none
|
||||
|
||||
mkfs.ext4 part.img
|
||||
debugfs -w -R "mkdir /boot" part.img
|
||||
debugfs -w -R "mkdir /boot/grub" part.img
|
||||
|
||||
debugfs -w -R "write init/init /init" part.img
|
||||
debugfs -w -R "write linux/arch/x86/boot/bzImage /boot/bzImage" part.img
|
||||
debugfs -w -R "write grub/grub.cfg /boot/grub/grub.cfg" part.img
|
||||
|
||||
dd if=part.img of=disk.img bs=512 seek=2048 conv=notrunc status=none
|
||||
|
||||
```
|
||||
|
||||
Or, alternatively
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive --remote --depth 1
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## disk.img structure
|
||||
### 1. 디스크 전체 구조도 (Overview)
|
||||
|
||||
@@ -119,7 +102,7 @@ Sec 0 Sec 1 Sec 2048 Sec 526336 Sec 7
|
||||
| **Free** | 788480 | 403,701,760 | 127 MB | (사용 안 함) |
|
||||
|
||||
|
||||
# `make run`
|
||||
## `make run`
|
||||
|
||||
```bash
|
||||
ifconfig eth0 10.0.2.15
|
||||
@@ -133,4 +116,35 @@ Host: 1.1.1.1
|
||||
:q
|
||||
|
||||
nc 1.1.1.1 80 < req.txt
|
||||
```
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Legacy
|
||||
### Run
|
||||
|
||||
```bash
|
||||
gcc -static -o init/init init/init.c
|
||||
|
||||
dd if=/dev/zero of=disk.img bs=1M count=512 status=none
|
||||
echo -e "n\np\n1\n2048\n\nw" | fdisk disk.img > /dev/null
|
||||
|
||||
dd if=disk.img of=part.img bs=512 skip=2048 status=none
|
||||
|
||||
mkfs.ext4 part.img
|
||||
debugfs -w -R "mkdir /boot" part.img
|
||||
debugfs -w -R "mkdir /boot/grub" part.img
|
||||
|
||||
debugfs -w -R "write init/init /init" part.img
|
||||
debugfs -w -R "write linux/arch/x86/boot/bzImage /boot/bzImage" part.img
|
||||
debugfs -w -R "write grub/grub.cfg /boot/grub/grub.cfg" part.img
|
||||
|
||||
dd if=part.img of=disk.img bs=512 seek=2048 conv=notrunc status=none
|
||||
|
||||
```
|
||||
|
||||
Or, alternatively
|
||||
|
||||
```bash
|
||||
make
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user