Making an OS (x86) Chapter 7 - Cross Compiler, Bootloader, Kernel

  Рет қаралды 66,516

Daedalus Community

Daedalus Community

Күн бұрын

Пікірлер: 226
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
You're going to find the new episode in written form (available for free) here: www.patreon.com/posts/55409989 I'm planning on making videos on some other topics as soon as I'll have some time, I hope you enjoyed this little introduction to OS Dev! For more content on this subject check out the OSDev Wiki: wiki.osdev.org/Expanded_Main_Page If you feel like you want to support the channel, you can check out my Patreon page, where I post the scripts of my videos before publishing them, and I share new video ideas I have: www.patreon.com/DaedalusCommunity Also, you can join our Discord server, where you can interact with me and other far more interesting people, share your personal projects, ask for help if you need some, and, of course, send memes: discord.gg/mnqnsw3a
@fisiek_
@fisiek_ 2 жыл бұрын
Can you update that discord invite?
@JeersNX
@JeersNX Жыл бұрын
I did this... : org 0x7c00 bits 16 mov ah, 0x0e main: mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x0a int 0x10 mov al, 'N' int 0x10 mov al, 'i' int 0x10 mov al, 't' int 0x10 mov al, 'r' int 0x10 mov al, 'i' int 0x10 mov al, 'x' int 0x10 mov al, 'O' int 0x10 mov al, 'S' int 0x10 mov al, '>' int 0x10 mov al, ' ' int 0x10 jmp input input: mov ax, 0x41 int 0x16 mov ah, 0x0e int 0x10 cmp al, 's' je shutdown cmp al, '?' je helpsec cmp al, 'd' je pwd cmp al, 'r' je errmake jmp main helpsec: mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x0a int 0x10 mov al, 'N' int 0x10 mov al, 'i' int 0x10 mov al, 't' int 0x10 mov al, 'r' int 0x10 mov al, 'i' int 0x10 mov al, 'x' int 0x10 mov al, 'O' int 0x10 mov al, 'S' int 0x10 mov al, 0x0a jmp main shutdown: mov ax, 0x1000 mov ax, ss mov sp, 0xf000 mov ax, 0x5307 mov bx, 0x0001 mov cx, 0x0003 int 0x15 pwd: mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 'C' int 0x10 mov al, 'O' int 0x10 mov al, 'N' int 0x10 mov al, ' ' int 0x10 mov al, ' ' int 0x10 mov al, ' ' int 0x10 mov al, ' ' int 0x10 mov al, ' ' int 0x10 mov al, 'S' int 0x10 mov al, 'Y' int 0x10 mov al, 'S' int 0x10 mov al, 0x0a int 0x10 jmp main errmake: mov al, 0x0a int 0x10 mov al, 0x08 int 0x10 mov al, 0x08 int 0x10 mov al, 'F' int 0x10 mov al, 'e' int 0x10 mov al, 'h' int 0x10 mov al, 'l' int 0x10 mov al, 'e' int 0x10 mov al, 'r' int 0x10 mov al, 0x0a int 0x10 mov al, '1' int 0x10 mov al, 0x0a int 0x10 jmp main times 510-($-$$) db 0 dw 0xAA55 (It is only the bootsector)
@LSHV
@LSHV 11 ай бұрын
can i voiceover that script (maybe i have a good mic)??
@ahmedsaadsabit1749
@ahmedsaadsabit1749 3 жыл бұрын
I been hooked to the series for a while, but I have a suggestion tho, the first 3 videos were simply the best because you were explaining what the code meant, after all, at the end of the day it's writing the correct code and knowing what we're doing. As we proceed, the explanation of the "code" you gave went little low and I'm finding it a little hard to follow, and write a code myself and compile it. I request you to show us a code in the next episode and give a brief tour of it, it becomes so helpful then. But anyway, thanks, it's an amazing series and I have loved it. Btw, when you're writing that code and explaining the nitty gritty, that's the best one.
@rhysbaker2595
@rhysbaker2595 11 ай бұрын
This entire series has been absolutely amazing! The editing is phenomenal. You go into just enough detail to explain the basics without jargon that scares people off. The fact you don't go into too much detail means the viewer can still figure the rest out for themself and you can keep the pace fast but not too fast. Everything about this series has been absolutely perfect. PLEASE keep this going! I cannot wait to see more from it!
@sharpnerw1093
@sharpnerw1093 7 ай бұрын
Whoa! These series were absolutely amazing! Before watching this I did not know a thing (Well... almost)! But after you showed this terrific work and terrific series, I am able to program in C now! These series will help me in the future, since (I'll tell you a little secret :-) ) I'm not even graduated from the middle school. I love computer science and more likely to become a programmer, but I'd never know what happens under the hood if it would not be you! *Please*, continue this work! You are a fantastic teachers, and I wish that there would be more teachers like you! In short, everybody on earth should take a moment and watch at least part of the series every day. Thanks for the knowledge ✊
@DaedalusCommunity
@DaedalusCommunity 7 ай бұрын
Thank you for the very kind words. You have no idea how much I appreciated them.
@samannoyb
@samannoyb 2 ай бұрын
Yeah, me too. I am in high school right now and just got into OS development. You were real, real amazing in this series. I love those animations which you created with such dedication and precision, helping newbies like me to grasp complicated concepts easily. Kudos to you, you are the legend!
@ananttiwari1337
@ananttiwari1337 3 жыл бұрын
good to see episode on cross compiler, many other tutorials ignore them
@therandomsomeone.
@therandomsomeone. 3 жыл бұрын
technically EVERY other tutorial skips them, even the legendary "write your own operating system" tutorial skipped cross compiling. at least osdev wiki and he cares about cross compiling gcc for an i386 target
@lunitowunito
@lunitowunito 5 ай бұрын
This series is absolutely amazing, it's more educational and well made than any other material I found on the internet. I really hope you keep this series going, your hard work and effort is greatly appreciated
@ahmedsaadsabit1749
@ahmedsaadsabit1749 3 жыл бұрын
This series is super epic, thanks for your hardwork! Can't wait to write the Kernel in real.
@SkashTheKitsune
@SkashTheKitsune 3 жыл бұрын
hope your studies goes well for you in the future, this has been a good series, always wanted to know what the handshake between BIOS and OS was like and you opened my eyes to it, thanks.
@Nacalal
@Nacalal 3 жыл бұрын
Only thing I'd add, tying the build process together with make so you're not running through several commands to get everything sorted out. Excellent series so far, finally got me to actually pick up asm.
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
Little secret: I can't write makefiles yet :( I should learn if I find the time
@Nacalal
@Nacalal 3 жыл бұрын
@@DaedalusCommunity Well, if you already know x86 asm and C it should be pretty easy to learn. I'd definitely recommend picking it up, I use it for just about everything I build that requires more than one command/file.
@artbyrobot1
@artbyrobot1 Жыл бұрын
@@DaedalusCommunity please don't why complicate things even more for those following
@blitzmensch
@blitzmensch Жыл бұрын
@@artbyrobot1Makefiles or CMake are extremely useful tools. You won’t have to wait for long to compile the os, since what was not modified won’t be compiled again. Also you can learn Make in about 20-30 minutes
@artbyrobot1
@artbyrobot1 Жыл бұрын
@@blitzmensch to "learn" it is not measured in minutes since now you have to always think in it and look up things trying to recall things and remember it and spend countless time researching things you can't figure out with it and bugs with it so the opportunity cost of taking it on is much greater than 30 minutes. Also compiling a homemade operating system should not take long at all in c++ in a IDE
@artbyrobot1
@artbyrobot1 Жыл бұрын
great job on this series. It really helped me out alot clearing up some things for me and nice examples and simple code to follow.
@filipvabrousek6900
@filipvabrousek6900 4 ай бұрын
This series is so good! Thanks so much!
@sandwitch4883
@sandwitch4883 3 жыл бұрын
only OS development tutorial that is easy to follow, HUGE THANKS please release episodes sooner.
@Nunya58294
@Nunya58294 Жыл бұрын
OS development isn't meant to be a "tutorial".
@гудлајф
@гудлајф Жыл бұрын
Lovely playlist. Thank you for making this!
@builinhti1234
@builinhti1234 3 жыл бұрын
can't wait to see next eps. thanks for your video !!!
@leg1187
@leg1187 2 жыл бұрын
Deadalus I just wanna say thank you so much! I have made my very own OS! EchOS. I've always wanted to make an OS but I thought it was too complicated.. I just completed this series and I have to say its a lot easier than I though it was. I had so much fun with this! Love ya :)
@Nunya58294
@Nunya58294 Жыл бұрын
OS development isn't meant to be a "tutorial".
@leg1187
@leg1187 Жыл бұрын
@@Nunya58294 Course not. Rather a learning experience. This series just gives you a way too start off.
@x8c8r
@x8c8r 3 жыл бұрын
Keep up the great work. This series is amazing!
@emperorpalpatine6080
@emperorpalpatine6080 3 жыл бұрын
By the way guys , I would advise against putting your kernel loading address at 0x1000 . For a very small kernel of 28KB or so, it may be alright , but if you want to put vital functions , like paging , and IDT , and heap management , and so on , you will have an issue . Your assembly function in the bootloader , that loads data from the disk using int 13h is gonna be able to read 54 sectors until you won't be able to boot up your kernel anymore. and 54 x 512 bytes is 27648, 0x6C00 in hex . And since your kernel is at 0x1000 , you are going to end up writing stuff at 0x7C00, which is the address of the boot sector.
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
That is correct, but that kind of error can be easily avoided with a memory map and some careful handling
@blitzmensch
@blitzmensch Жыл бұрын
the entire design shown here has major flaws. You will have to completely rewrite the bootloader for fs support. Also until you read a kernel file from disk, you are still in the bootloader. All which is shown here is a mere bootloader. So adding the heap, memory management, system calls and so on is completely useless
@blitzmensch
@blitzmensch Жыл бұрын
also you can fix this problem in 2 ways. First, write a second stage bootloader located at less than 0x1000. With that you load the third stage at 0x1000 and you can overwrite the mbr. Also just read about int 0x13 ah = 0x42
@blitzmensch
@blitzmensch Жыл бұрын
@@DaedalusCommunitycan you send a valid discord invite?
@eien7228
@eien7228 2 жыл бұрын
wish theres ep 8 tho i like how u explain things and ill start searching unfamiliar words in the internet as i watch ur video
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
Episode 8 is here, in written form (it can be accessed for free): www.patreon.com/posts/55409989
@Noumaan_Ahamed
@Noumaan_Ahamed Жыл бұрын
What about episode 9??
@bigmancozmo
@bigmancozmo 2 жыл бұрын
FUN FACT this video was uploaded on my grandpa's birthday
@Rade34
@Rade34 Жыл бұрын
This was gold 🥇🪙
@agoogleuser3853
@agoogleuser3853 3 жыл бұрын
I like the GNU Is not unix animation at 1:41
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
Glad you noticed!
@LogicEu
@LogicEu 3 жыл бұрын
Your videos are on another level, thank you
@enderger5308
@enderger5308 3 жыл бұрын
Tip: the Zig compiler can cross-compile C (and a few others, including the Zig language) fairly painlessly.
@codexed-i
@codexed-i 2 жыл бұрын
so what this means?
@blitzmensch
@blitzmensch Жыл бұрын
@@codexed-i means that there are alternatives as compilers other than gcc which let you do the work without needing to compile a cross compiler. One prime example is Clang. I will tell you a trick. If you are developing on and for x86, you can use the GCC version installed on your machine (even MinGW) to compile the code by giving the -m32 flag. This works most of the times and you won’t have to install a cross compiler. Or just use Clang, which is at the same level as GCC, but thanks to LLVM Bytecode it is a CrossCompiler by default
@edouardmalot51
@edouardmalot51 2 жыл бұрын
Realtly really nicee serie of videos
@mastcharub7177
@mastcharub7177 2 жыл бұрын
continua così! i tuoi video sono stupendi! è grazie a te che mi sono appassionato a tutto ciò che centra con gli OS e con l'Hardware dei computer
@blitzmensch
@blitzmensch Жыл бұрын
perchè stai commentando in italiano?
@mastcharub7177
@mastcharub7177 Жыл бұрын
@@blitzmensch perchè sono italiano e perchè lui è italiano
@MrDimonsky
@MrDimonsky 3 жыл бұрын
On both emulator and a real bootable USB stick, the intention to read "a lot" from the disk finishes with the error. So you need to program in the boot.asm the number of the disk sectors you want to read, and this data must present in the img. I make a %define loader_size xx and %define kernel_size yy, and use "times (loader_size -($-$$)) db 0" (and similar in kernel) to have fixed size of both. loader_size and kernel_size are used in the asm code to read a pecific size of data from HDD/USB/IMG to the memory. The dd combines all boot.bin loader.bin and kernel.bin into one img file, and you always know how big every part is. Will try cat command, to avoid writing a specific size of binary files in the command line, thanks.
@blitzmensch
@blitzmensch Жыл бұрын
on most bioses it does not give any error. It may do on emulators because emulators emulate a 20kb disk drive for a 20kb image, but on real hardware only the first 20kbs will be populated, while the rest is random garbage data but still readable.
@2EZShadow
@2EZShadow 11 ай бұрын
I actually followed this whole tutorial on Android😂
@tanchienhao
@tanchienhao 3 жыл бұрын
awesome channel and videos!! keep going :) subscribed
@openmarkand
@openmarkand 3 жыл бұрын
It's much easier to use clang which is already a cross compiler, by using -target option and boum, get the job done!
@double7s41
@double7s41 2 жыл бұрын
What do you set the value for target to be?
@blitzmensch
@blitzmensch Жыл бұрын
@@double7s41it really depends on what platform you are targetting
@bigmancozmo
@bigmancozmo 2 жыл бұрын
hey i need help so like im running the script and every command except the "i386-elf-gcc" is installing
@kaangg12
@kaangg12 2 жыл бұрын
i need help about i386-elf-gcc, i writed everything true, I am in the correct dictory but Im getting i386-elf-gcc-5.2.0: error: spawn: No such file or directory error please help me about that.
@RandomNTS
@RandomNTS Жыл бұрын
same
@kaangg12
@kaangg12 Жыл бұрын
@@RandomNTS ow still same bug for 7 months? Thats kind of critical one then
@blitzmensch
@blitzmensch Жыл бұрын
problem is how the path variable works on linux. if you use the export function or add it to path, once you login again it will be removed. you need to add the export command in the bashrc file of your user.
@kaangg12
@kaangg12 Жыл бұрын
@@blitzmensch that helpes
@Rumplestiltzchen
@Rumplestiltzchen 3 жыл бұрын
for windows, I use mingw32 and add it to the path. then you can do mingw32 build and then your make file
@memosek5911
@memosek5911 2 жыл бұрын
Do you remember what you did for this? It really seems like the best option for me and would like to know how its done.
@snehashishkarmakar3376
@snehashishkarmakar3376 3 жыл бұрын
Cant wait😇
@thefrustrationempire4278
@thefrustrationempire4278 22 күн бұрын
Excuse me, but i am getting an error from qemu, saying no bootable disk. Do you know any way to fix this?
@DaedalusCommunity
@DaedalusCommunity 22 күн бұрын
Use this reference code to troubleshoot: github.com/mell-o-tron/OS-Reference
@bigmancozmo
@bigmancozmo 2 жыл бұрын
@Daedalus Community you forgot to change the Shell Script link to the new one, I saw you renamed the Debian one.
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
It was renamed by a contributor, I'm changing the link
@bigmancozmo
@bigmancozmo 2 жыл бұрын
@@DaedalusCommunity Oh, ok.
@amazon_prime2831
@amazon_prime2831 3 жыл бұрын
Where is the article about moving the cursor?
@rusdzo
@rusdzo Жыл бұрын
I guess for Debian/Ubuntu based Linuxes it is enough to install packages like gcc-multilib abd g++-multilib to be able to compile 32-bit executables of x64 machines. Use -m32 compiler key.
@codexed-i
@codexed-i 2 жыл бұрын
I finished the first one in the third episode bro.
@luandkg
@luandkg 3 жыл бұрын
Amazing 👏🏻👏🏻👏🏻👏🏻
@bigmancozmo
@bigmancozmo 2 жыл бұрын
im glad i went for the ubuntu app on windows instead of a VM. i've tried a VM before and it's super slow and janky to work with. with the app, it has access to all 16 GB of RAM I have. the VM would only boot with 1 GB of ram.
@joselumateo7567
@joselumateo7567 3 жыл бұрын
is it really necessary to use the cross-compiler? I thought that if you are working in a x86 machine,it would be fine to use just gcc,since the target architecture is the same that you are programming in.
@maheswaranparameswaran8532
@maheswaranparameswaran8532 3 жыл бұрын
My case was it compiled successfully to binaries... But during linking.. Something always went weird and binaries used to explode in size (>100mb) sizes... Untill I switched to a crosscompiler... Not sure what happened there... But it's an observation
@joselumateo7567
@joselumateo7567 3 жыл бұрын
@@maheswaranparameswaran8532 maybe you had to tweak some linking options?
@kosmasraptis8374
@kosmasraptis8374 3 жыл бұрын
Yes because the host compiler also compiles specifically for your host operating system and relies on it. However, your own operating system runs independently from the host and thus you need a compiler that can create bare metal binaries.
@samisdamn4062
@samisdamn4062 3 жыл бұрын
Is it possible to get an OS working in esp32 ?
@samisdamn4062
@samisdamn4062 3 жыл бұрын
@Barracuda _ in wikipedia it says cpu: Tensilica Xtensa LX6 microprocessor @ 160 or 240 MHz
@blitzmensch
@blitzmensch Жыл бұрын
@@samisdamn4062you need to learn assembly for that CPU, find a C (or any other language) compiler for it, and have some documentation to see how to boot process works. You also need interrupts, framebuffer access, disk access and so on
@emailapi4693
@emailapi4693 2 жыл бұрын
Electronics Boy is still waiting...
@geckwwo
@geckwwo 2 жыл бұрын
Thanks for tutorial! May I ask, why you are not making new vids?
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
I explained the reason at the end of this video, I wasn't feeling all that great about continuing. Still, you can find the final episode in written format in the description!
@geckwwo
@geckwwo 2 жыл бұрын
@@DaedalusCommunity oh, i havent watched video to the end at the time when i wrote the comment, sorry, hope you will be ok
@ranchu3203
@ranchu3203 3 жыл бұрын
Awesome video! I wonder, are you going to continue working in VGA text mode or will you switch to graphics mode like 13H?
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
I've tried that once, I'll eventually get back to that once I'm done with the kernel :)
@ranchu3203
@ranchu3203 3 жыл бұрын
@@DaedalusCommunity sounds awesome! Thanks for making these videos by the way. It's a huge help
@friedrichbrauer5912
@friedrichbrauer5912 2 жыл бұрын
i386-elf-gcc: command not found. after the bash code is done. why do i have to bash a bunch of commands to build smth i could download and install!? its for the same architecture
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
Did you add the directory to the path variable? Also, useful read: wiki.osdev.org/Why_do_I_need_a_Cross_Compiler%3F
@friedrichbrauer5912
@friedrichbrauer5912 2 жыл бұрын
@@DaedalusCommunity yes, i did, but nothing helps. Using Mint 20
@friedrichbrauer5912
@friedrichbrauer5912 2 жыл бұрын
i build the set with gcc 9.3.0 instead and binutils 2.34 because whatever i try to install and use gcc 10.2, it will try to compile with 9.2 and fail becaue it uses the 9.2
@two-spikes
@two-spikes 2 жыл бұрын
best tutor
@ezweber_the_great
@ezweber_the_great Жыл бұрын
Any plans to continue this?
@radoslavl921
@radoslavl921 2 жыл бұрын
When executing the ld, I get this warning: "warning: cannot find entry symbol _start; defaulting to 0000000000001000". I put "_start" in my assembly code and don't know what to do to fix it. Any suggestions to reasons I am getting this warning?
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
I have that warning as well, I think you'd have to set up a linker script to solve it, but I didn't bother, for now. Just left it there and ignored it
@blitzmensch
@blitzmensch Жыл бұрын
if you do really want to not use a linker script, use the -e entrypoint flag, where entrypoint is the name of the function, in your case _start. No quotes needed
@bigmancozmo
@bigmancozmo 2 жыл бұрын
Hey so I just started dualbooting Linux and Windows and can finally do this :)
@blitzmensch
@blitzmensch Жыл бұрын
you can use WSL and Xserver to do the exact same thing with no need to dual boot.
@randomguy-gb9ge
@randomguy-gb9ge 2 жыл бұрын
Can I use "printf" in kernel.c?
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
Nope, the standard libraries rely on system calls, which rely on the kernel, so in order to use them you should define system calls first. If you just want to print something, you can simply define your own print function.
@randomguy-gb9ge
@randomguy-gb9ge 2 жыл бұрын
@@DaedalusCommunity how do I do that?
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
@@randomguy-gb9ge if you followed the series up to this point, and you're able to write single characters, you should also be able to write a simple function that writes characters and increments a pointer, similar to the one we used in real mode
@randomguy-gb9ge
@randomguy-gb9ge 2 жыл бұрын
@@DaedalusCommunity but I can't
@blitzmensch
@blitzmensch Жыл бұрын
@@randomguy-gb9gevoid prints(const char* str) { while(*str) { putc(*str++); } } write your own putc function which also changes the variables containing the x and y cursor position. Printf is a bit more complex as it also needs an itoa and gcvt function to convert ints and floats. Also it needs to check if the char is a percent symbol, and if yes check the next one and do a specific action accordingly
@dead1ock284
@dead1ock284 2 жыл бұрын
If I want to add another cpp file which for example contains a print function that prints a string to the screen, what should I change/add in the cpp code, and what should I change/add in the run.os file?
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
You should make a .cpp file and a .h header file, include the header in your main, compile the new file without linking it and link it afterwards.
@dead1ock284
@dead1ock284 2 жыл бұрын
@@DaedalusCommunity Thanks for the help! keep the good content, can't wait to see what you are planning for future videos.
@debarchanbasu1962
@debarchanbasu1962 2 жыл бұрын
Hi! When are we going to get the next video? 😅
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
Check out the end of the video and the link in the description :) As for the next video in general, I'm working on an update video right now
@schokoladenpizza882
@schokoladenpizza882 Жыл бұрын
I followed the tutorial exactly but I can't include things in c/c++ for the next episode. I copied your files from github and it still doesn't work. I have basically the exact same files as you at the end of Chapter 7. The only thing I'm trying to do is printing "Test" to the VSC console My code in kernel.cpp: #include extern "C" void main(){ *(char*)0xb8000 = 'Q'; printf("Test"); return; } And the error message: kernel.cpp:1:9: fatal error: stdio.h: No such file or directory But everything else (e.g. printing the Q on screen) works just fine. None of the solutions I found on the internet worked.
@DaedalusCommunity
@DaedalusCommunity Жыл бұрын
Did you install the cross compiler correctly?
@schokoladenpizza882
@schokoladenpizza882 Жыл бұрын
@@DaedalusCommunity Yes. No error messages, etc. Worked just fine
@schokoladenpizza882
@schokoladenpizza882 Жыл бұрын
@@DaedalusCommunity I tried including files that are in the same directory as the kernel.cpp and which are definitely in the correct folder for the include... But even that didn't work. It seems like the include statement works overall not as intended
@schokoladenpizza882
@schokoladenpizza882 Жыл бұрын
Btw if it is important. I'm working on Linux Mint
@dragonstar373
@dragonstar373 7 ай бұрын
@@schokoladenpizza882 I've had the same problems, I've just resorted to going full libraryless. I think bc it is compiled as "freestanding," it keeps it from working. Regardless, I can't even get a working print statement (new to c++) so I take it its not going to be easy.
@therandomsomeone.
@therandomsomeone. 2 жыл бұрын
the compiler can't execute the cc1 subprocess because it's looking for a file named "execvp", which is a syscall and not a file
@blitzmensch
@blitzmensch Жыл бұрын
bad compiler installation. Completely clean the compiler installation and redo it
@therandomsomeone.
@therandomsomeone. Жыл бұрын
@@blitzmensch i think it has to do with the fact that i'm a poor windows user that has to use wsl
@maxwellcarrison7841
@maxwellcarrison7841 3 жыл бұрын
when I try to run the .sh file from the code you posted in github with WSL in my command prompt, all it does is output the lines with code in them and says 'command not found'. any way to fix this?
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
What command does generate the problem?
@maxwellcarrison7841
@maxwellcarrison7841 3 жыл бұрын
@@DaedalusCommunity the command is Bash run.sh
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
@@maxwellcarrison7841 if you're on debian you might want to try "sh run.sh"
@maxwellcarrison7841
@maxwellcarrison7841 3 жыл бұрын
@@DaedalusCommunity I'm using windows 10 on my computer, and have downloaded WSL to try to make the command work
@TacticalAllRounder
@TacticalAllRounder 2 жыл бұрын
Hello! I use windows and i installed MinGW with GCC COMPILER, will this work ?
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
I'm not sure, I've never used that configuration. I'd recommend getting an Ubuntu vm though
@TacticalAllRounder
@TacticalAllRounder 8 ай бұрын
​@@DaedalusCommunityyo! This is me, a year later, again following this, still on windows. (Went on linux for a year but returned).
@Noumaan_Ahamed
@Noumaan_Ahamed Жыл бұрын
Hey, what about episodes after 8?
@DaedalusCommunity
@DaedalusCommunity Жыл бұрын
Hi, I guess after interrupts it's pretty much up to the viewer to decide what to do, it's much more familiar territory. Still, I would like to make more videos about scheduling and other OS theory stuff :)
@Noumaan_Ahamed
@Noumaan_Ahamed Жыл бұрын
@@DaedalusCommunity thank you so much.. Do you know where to go on next? Like I wanna include my own language in my os and so on... Also want to add a nice gui
@bigmancozmo
@bigmancozmo 3 жыл бұрын
pls help it's not adding the i386-elf-gcc command with the shell script
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
You need to add the directory to the PATH variable :)
@bigmancozmo
@bigmancozmo 3 жыл бұрын
@@DaedalusCommunity ok so like now i know what to do but what java version do i need so it supports apt (i'm on mac)
@bigmancozmo
@bigmancozmo 3 жыл бұрын
@@DaedalusCommunity nvm figures out instead of "apt" you use homebrew on mac
@bigmancozmo
@bigmancozmo 3 жыл бұрын
@@DaedalusCommunity like what command do you do on mac because apt isnt supported on mac
@bigmancozmo
@bigmancozmo 3 жыл бұрын
@@DaedalusCommunity wait what script do i use if i'm on an x86_64 system? I use a MacBook Air that's x86_64.
@spacer-lx5pq
@spacer-lx5pq 3 жыл бұрын
Nice vídeo! Could you make one about ubuntu based os'ses next?
@socktt5534
@socktt5534 3 жыл бұрын
The script should work on all debian distros, which includes all ubuntu distros
@ibrahimulucann
@ibrahimulucann 3 жыл бұрын
How can I compile my project with assembly?
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
Use nasm, watch the first episode if you're not sure how :)
@ibrahimulucann
@ibrahimulucann 3 жыл бұрын
thank you bro
@maverickreal09
@maverickreal09 2 жыл бұрын
Will this playlist be continued?
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
The last episode of the series can be found for free here: www.patreon.com/posts/55409989
@friedrichbrauer5912
@friedrichbrauer5912 2 жыл бұрын
error message: c++ compiler doesnt pass sanity check
@maverickreal09
@maverickreal09 3 жыл бұрын
When will next videos come out?
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
Probably not soon, but I've been writing down a couple of ideas for new videos. Whenever I'll have some free time I'll try and record something, but I'm preparing a lot of exams so I'm definitely not doing it in the near future :(
@maverickreal09
@maverickreal09 3 жыл бұрын
@@DaedalusCommunity wow thanks. I appreciate the effort. So i can watch the series without any fear of it being dropped unfinished?
@friedrichbrauer5912
@friedrichbrauer5912 2 жыл бұрын
add "sudo apt install curl" to his bash script. i didnt have curl installed by default (on ubuntu)
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
Ok, I will :)
@Infragion
@Infragion Жыл бұрын
how to write in kernel.cpp not 1 character (i want like more than 1)
@DaedalusCommunity
@DaedalusCommunity Жыл бұрын
Write a function that writes a string, incrementing the pointer by one :)
@blitzmensch
@blitzmensch Жыл бұрын
void prints(const char* str) { while(*str) { putc(*str++); } }
@propbreakerfpv
@propbreakerfpv 3 жыл бұрын
i get error /tmp/ccfLrXOT.s: Assembler messages: /tmp/ccfLrXOT.s:9: Error: invalid instruction suffix for `push' /tmp/ccfLrXOT.s:20: Error: invalid instruction suffix for `pop' when i try to compile kernel any thoughts?
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
Uhm, I've never seen that.. On what OS are you trying to compile it? Have you made sure the cross compiler works?
@propbreakerfpv
@propbreakerfpv 3 жыл бұрын
@@DaedalusCommunity i'm on ubuntu 20.04. i mean it seems to work except that error
@brucetungsten5714
@brucetungsten5714 Жыл бұрын
Thx!
@amelted4827
@amelted4827 3 жыл бұрын
To think he came from boolean rhapsody to this,,, not sure if this is better or worse
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
Is this the real life?
@kosmasraptis8374
@kosmasraptis8374 3 жыл бұрын
@@DaedalusCommunity Is this just binary?
@espero_dev
@espero_dev 2 жыл бұрын
But Melos is a Linux one not a exe/x86_64
@RafinMiner
@RafinMiner 7 ай бұрын
Hey where is more videos pls make rhem
@BlackneeedWasHere
@BlackneeedWasHere Жыл бұрын
To use C++ instead of i386-elf-gcc you just need i386-elf-g++
@blitzmensch
@blitzmensch Жыл бұрын
to compile C code with gcc, you sometimes need to specify -x c, otherwise gcc will assume you want to compile c++ code
@BlackneeedWasHere
@BlackneeedWasHere 5 ай бұрын
When running configure he did: -enable-language=c++ but when u use -enable-languages you can do this: -enable-languages c,c++
@sfsarfe
@sfsarfe 2 жыл бұрын
any more coming? these vids are super helpful for dumb dumbs like me
@suncrafterspielt9479
@suncrafterspielt9479 2 жыл бұрын
Are you going to continue the series?
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
The next (and last for now) episode can be found in the description, in written form
@suncrafterspielt9479
@suncrafterspielt9479 2 жыл бұрын
Ohh no :,c Do you have any other upcoming plans?
@RandomPerson-sh5dt
@RandomPerson-sh5dt Жыл бұрын
Pls episode 8
@DaedalusCommunity
@DaedalusCommunity Жыл бұрын
Have a look at the pinned comment :))))
@declan800
@declan800 Жыл бұрын
Hey this is my kernel.c (found this with crlt+f on the pdf of gnu's GCC doc): int main(void){ *(char*)0xb8000 = 'K'; return 0; }
@declan800
@declan800 Жыл бұрын
hint: ffreestanding in the C section.
@bebbesi
@bebbesi 9 ай бұрын
il bro è morto nell episodio 7 per la risposta che aveva scritto
@the_foxware
@the_foxware 3 жыл бұрын
Do you have a discord server?
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
Yes! discord.gg/DgDDV6xPQe
@steevem4990
@steevem4990 2 жыл бұрын
Make who nervous? XD
@two-spikes
@two-spikes 2 жыл бұрын
nice
@int16_t
@int16_t Жыл бұрын
Why the hell you uses .cpp with gcc?
@DaedalusCommunity
@DaedalusCommunity Жыл бұрын
Idk I had some problems installing a version of the cross compiler for C, but now it seems to work so we converted the whole kernel to C
@MrDimonsky
@MrDimonsky 3 жыл бұрын
The last video is really tooooo fast. Copy-paste this, copy-paste that, profit. UPD. On the other side, the whole series really gives you basics you need. If interested more, most of the things can to be learned from a lot of documents and by experimenting.
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
We've already covered each of those steps in their own videos.... Also, I'd like you to notice that this video is not monetized.
@MrDimonsky
@MrDimonsky 3 жыл бұрын
@@DaedalusCommunity Sure, no problem.
@raik1766
@raik1766 4 ай бұрын
changed things up a bit: // Have to do this because i can't use any libraries int stringLen(const char* str) { int length = 0; while (str[length] != '\0') { ++length; } return length; } void write_string(const char* str, int* pos) { for (int i=0;i> os.bin del kernel_entry.o del kernel.o del bootloader.bin del kernel.bin del zeroes.bin qemu-system-x86_64 -drive format=raw,file=os.bin download the compiler from github.com/lordmilko/i686-elf-tools/tree/7.1.0 and extract the zip into a folder called i686 (also put all of the asm files in a folder called asm)
@youcefwippert
@youcefwippert 3 жыл бұрын
would be interesting how different it is to write an os for arm
@xrafter
@xrafter 3 жыл бұрын
Its different . Different assembly language. Different cpu isa . Different way of communicating . And different difference.
@uncoolhackerman8997
@uncoolhackerman8997 3 жыл бұрын
@@xrafter Apple begs to differ. technically there are two big surs but they both run the exact same
@kindersurprise5164
@kindersurprise5164 8 ай бұрын
the section "installing the compiler" the guy -proceds to not explain how to install the compilers
@DaedalusCommunity
@DaedalusCommunity 8 ай бұрын
I mean, I gave you the script :) It's too lengthy and tedious of a process to describe in a video
@PomegranateDudeOSC
@PomegranateDudeOSC 4 ай бұрын
Braindead people made Calliou OS irl💀😭
@NOTHING-yu3ry
@NOTHING-yu3ry 2 жыл бұрын
Next please
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
Over here, it's for free: www.patreon.com/posts/55409989
@NOTHING-yu3ry
@NOTHING-yu3ry 2 жыл бұрын
@@DaedalusCommunity bro it's difficult
@NOTHING-yu3ry
@NOTHING-yu3ry 2 жыл бұрын
@@DaedalusCommunity when you at good condition then make a video
@harveykyle3690
@harveykyle3690 3 жыл бұрын
UwU
@the_foxware
@the_foxware 3 жыл бұрын
Are you italian?
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
I am! You're the first to spot it :)
@pangenera2566
@pangenera2566 3 жыл бұрын
@lowlevelcodingch
@lowlevelcodingch 7 ай бұрын
typedef char* string; void print(string str) { int k = 0xb8000; int len = 0; while (a[len] != '\0') { len++; } for (int i = 0; i < len; i++) { *(char*)k = str[i]; k += 2; } }
@dragonstar373
@dragonstar373 7 ай бұрын
What is a in the line " while (a[len] != '\0') {"
@lowlevelcodingch
@lowlevelcodingch 5 ай бұрын
@@dragonstar373 wrote this 1 month ago, idk what this is but i made a better function that uodates the cursor and uses it too
@lowlevelcodingch
@lowlevelcodingch 5 ай бұрын
@@dragonstar373 found out again what it meant, it actually shoudve been "str[len]"
@Sebwazhere
@Sebwazhere 10 ай бұрын
i386-elf-gcc -ffreestanding -m32 -g -c "kernel.cpp" -o "kernel.o" when I try to run this command, I get a bunch of assembler errors? Because I'm on windows I got the i386 elf stuff from a github repository called nativeos. The errors are: Error: junk at end of line, first unrecognized character is `m' Error: invalid instruction suffix for `push' Error: invalid instruction suffix for `pop' Error: junk at end of line, first unrecognized character is `m' Error: junk at end of line, first unrecognized character is `,' (4 times) Warning: unknown section attribute 'M' Warning: unknown section attribute 'S' Error: junk at end of line, first unrecognized character is `,'
@zook7807
@zook7807 3 жыл бұрын
i built the cross compiler but when i use this command i386 -ffreestanding -m32 -g -c "main.c" -o "kernel.o" it says command not found
@DaedalusCommunity
@DaedalusCommunity 3 жыл бұрын
You should use i386-elf-gcc
@zook7807
@zook7807 3 жыл бұрын
@@DaedalusCommunity yeah forgot to include that in the comment and i am using linux
@zook7807
@zook7807 3 жыл бұрын
@@DaedalusCommunity still getting the same error :(
@Masterix.
@Masterix. Жыл бұрын
@@zook7807 I know I'm one year late :D
@artbyrobot1
@artbyrobot1 Жыл бұрын
@@zook7807 you should give hte full path to the command like: "C:\Dev-Cpp\bin\g++.exe" -ffreestanding -m32 -c "F:\desktop\public projects\ArtbyrobotOS\larrysKernel.cpp" -o "F:\desktop\public projects\ArtbyrobotOS\larrysKernel.o"
@Nunya58294
@Nunya58294 Жыл бұрын
Then here comes the noobs that literally don't know how to program: "I have code and it no work! Plz hlp plz!"
@DaedalusCommunity
@DaedalusCommunity Жыл бұрын
Hasking for help is ok, everyone learns at their own pace and everyone can use a little help :)
@gaminghub6440
@gaminghub6440 Жыл бұрын
it gives me this errrrrrrrrrrrr::: 0:25:22.87 | C:\DEVPROJECTS\OS> nasm "boot.asm" -f bin -o "boot.bin" 0:25:22.91 | C:\DEVPROJECTS\OS> nasm "kernel_entry.asm" -f elf32 -o "kernel_entry.o" 0:25:22.94 | C:\DEVPROJECTS\OS> gcc -ffreestanding -m32 -g -c "kernel.cpp" -o "kernel.o" 0:25:23.10 | C:\DEVPROJECTS\OS> nasm "zeroes.asm" -f bin -o "zeroes.bin" 0:25:23.11 | C:\DEVPROJECTS\OS> ld -o "full_kernel.tmp" "kernel_entry.o" "kernel.o"
@jackmarley32
@jackmarley32 2 жыл бұрын
How can we create I iso or img image?
@DaedalusCommunity
@DaedalusCommunity 2 жыл бұрын
A pull request regarding that was made some time ago on the GitHub repo. Didn't merge it, but it's still there
@jackmarley32
@jackmarley32 2 жыл бұрын
​@@DaedalusCommunity ok
'Accidental' CrossCompiler - Computerphile
15:13
Computerphile
Рет қаралды 110 М.
the cleanest feature in C that you've probably never heard of
8:13
ROSÉ & Bruno Mars - APT. (Official Music Video)
02:54
ROSÉ
Рет қаралды 324 МЛН
这是自救的好办法 #路飞#海贼王
00:43
路飞与唐舞桐
Рет қаралды 126 МЛН
ЗНАЛИ? ТОЛЬКО ОАЭ 🤫
00:13
Сам себе сушист
Рет қаралды 4,2 МЛН
Gas powered electric guitar
17:58
Mattias Krantz
Рет қаралды 2,7 МЛН
How A Steam Bug Deleted Someone’s Entire PC
11:49
Kevin Fang
Рет қаралды 1 МЛН
The Making of Linux: The World's First Open-Source Operating System
11:33
ForrestKnight
Рет қаралды 1,3 МЛН
I Designed My Own 16-bit CPU
15:46
AstroSam
Рет қаралды 2,1 МЛН
Making Simple Bootloader using x86 Assembly
6:47
Nir Lichtman
Рет қаралды 34 М.
Making My Own Programming Language and Coding a Game in It
10:19
AstroSam
Рет қаралды 1,3 МЛН
Compilers, How They Work, And Writing Them From Scratch
23:53
Adam McDaniel (kiwi)
Рет қаралды 216 М.
I built my own 16-Bit CPU in Excel
15:45
Inkbox
Рет қаралды 1,5 МЛН
ROSÉ & Bruno Mars - APT. (Official Music Video)
02:54
ROSÉ
Рет қаралды 324 МЛН