vinc / moros

MOROS: Obscure Rust Operating System 🦉
http://moros.cc
MIT License
923 stars 33 forks source link

How to use `install` in MOROS #246

Closed mikumikudice closed 3 years ago

mikumikudice commented 3 years ago

Hello, I got really afraid after reading

"""

Be careful not to overwrite the hard drive of your OS when using dd inside your OS, and install or disk format inside MOROS

"""

How should I use install to properly install MOROS in my ~/moros running the image with qemu directory and, by the way, what does dd mean?

vinc commented 3 years ago

Hi @mateusmds, this scary disclaimer in bold is to prevent any mistakes when running MOROS directly on a real computer, so as long as you are running the image in QEMU nothing bad can happen!

dd is a command to run on a terminal of the host to copy the image to a usb key for example, and for someone not familiar with it it's possible to write to something else like the hard drive. It's not required directly for QEMU.

And install is the command inside MOROS to populate the file system, it's very useful inside QEMU to get the full system installed, but it's dangerous when running the OS on a computer from a USB key while keeping your original OS on the hard drive as it could be overwritten.

This is what a typical install on QEMU would look like at the moment:

[0.000000] MOROS v0.6.0
[0.250962] MEM [0x00000000000000-0x00000000001000] FrameZero
[0.252961] MEM [0x00000000001000-0x00000000005000] PageTable
[0.253961] MEM [0x00000000005000-0x00000000016000] Bootloader
[0.253961] MEM [0x00000000016000-0x00000000017000] BootInfo
[0.253961] MEM [0x00000000017000-0x00000000022000] Kernel
[0.254961] MEM [0x00000000022000-0x0000000009F000] KernelStack
[0.255961] MEM [0x0000000009F000-0x000000000A0000] Reserved
[0.255961] MEM [0x000000000F0000-0x00000000100000] Reserved
[0.255961] MEM [0x00000000100000-0x00000000283000] KernelStack
[0.255961] MEM [0x00000000283000-0x00000000400000] Usable
[0.256961] MEM [0x00000000400000-0x00000000537000] Kernel
[0.256961] MEM [0x00000000537000-0x00000000545000] PageTable
[0.257961] MEM [0x00000000545000-0x00000001FE0000] Usable
[0.257961] MEM [0x00000001FE0000-0x00000002000000] Reserved
[0.259960] MEM [0x000000FFFC0000-0x00000100000000] Reserved
[0.259960] MEM 32704 KB
[0.532919] CPU AuthenticAMD
[0.532919] CPU QEMU TCG CPU version 2.5+
[0.533919] PCI 0000:00:00 [8086:1237]
[0.533919] PCI 0000:01:00 [8086:7000]
[0.534919] PCI 0000:01:01 [8086:7010]
[0.534919] PCI 0000:01:03 [8086:7113]
[0.535918] PCI 0000:02:00 [1234:1111]
[0.535918] PCI 0000:03:00 [1022:2000]
[0.540918] NET PCNET MAC 52-54-00-12-34-56
[0.551916] ATA 0:0 QEMU HARDDISK QM00001 (32 MB)
MFS is not mounted to '/'
Running console in diskless mode

> install
Welcome to MOROS v0.6.0 installation program!

Proceed? [y/N] y

Listing disks ...
Path            Name (Size)
/dev/ata/0/0    QEMU HARDDISK QM00001 (32 MB)

Formatting disk ...
Enter path of disk to format: /dev/ata/0/0
Disk successfully formatted
MFS is now mounted to '/'

Populating filesystem...
Created '/bin'
Created '/dev'
Created '/ini'
Created '/lib'
Created '/net'
Created '/src'
Created '/tmp'
Created '/usr'
Created '/var'
Copied '/bin/hello'
Copied '/bin/sleep'
Created '/dev/clk'
Created '/dev/console'
Created '/dev/random'
Copied '/ini/boot.sh'
Copied '/ini/banner.txt'
Copied '/ini/version.txt'
Copied '/ini/palette.csv'
Created '/ini/fonts'
Copied '/ini/fonts/lat15-terminus-8x16.psf'
Copied '/ini/fonts/zap-light-8x16.psf'
Copied '/ini/fonts/zap-vga-8x16.psf'
Copied '/tmp/alice.txt'
Copied '/tmp/fibonacci.lisp'
Created '/tmp/beep'
Copied '/tmp/beep/tetris.sh'
Copied '/tmp/beep/starwars.sh'
Copied '/tmp/beep/mario.sh'

Creating user...
Username: admin
Password:
Confirm:

Installation successful!

Exit console or reboot to apply changes
mikumikudice commented 3 years ago

Oh, phew! So I'll try it today. One last questions before closing it: do I have to install MOROS every time I want to run it on qemu?

vinc commented 3 years ago

Nope! When you run make image ... a disk.img file is created, and its content will be reused every time you run make qemu ..., so you only need to run install inside MOROS once.

mikumikudice commented 3 years ago

Great. Thank you and good luck with this amazing project.