Beginner Mistakes: Difference between revisions

m
gr comma
[unchecked revision][unchecked revision]
(convert first- and second- person pronouns)
m (gr comma)
 
(4 intermediate revisions by 3 users not shown)
Line 15:
 
=== A Hard Truth ===
'''''NoProgramming onenovices whoshould isn't already a seasoned developer with years of experience in several languages and environments shouldprobably evennot be considering OS Dev yet. AExperience decade of programming, including a few years ofin low-level coding in assembly language and/or a systems language, such as C, is pretty much the minimum necessary to even understand the topic well enough to work in it.'''''
 
What's more, this is growing ever more true by the year, as the number of different 'standards', computer and mobile device models, peripherals, and design concepts continues to expand.
Line 102:
=== Booting Problems ===
Especially in early stages and with a self-built bootloader, the reason for booting problems is frequently that too few sectors are fetched from disk. Either adjust the amount of sectors you fetch from disk, or have the boot loader/second stage loader parse the file system.
<!-- TODO: Hmm, this doesn't seem appropriate for this particular tutorial and is somewhat outdated as we always recommend using a cross-compiler. I'll just comment this out for now. --~~~~
=== Strings ===
When your Kernel is written in C, gcc puts strings and constants in a special section called ''read-only data''. This section needs to be explicitly added in your linker script, otherwise it can cause all sorts of weird problems (unable to print text to the screen, kernel suddenly becoming 1MB larger, GRUB giving a loading error saying ''kernel too large'', etc). The section is called ''.rodata'' in [[ELF]] and ''.rdata'' in COFF/PE (the output format for MinGW/Cygwin). Building a [[GCC Cross-Compiler]] will help you to safely assume ''.rodata'' everywhere.
 
You could also tweak your linker script to include ''either'' section:
 
<source lang="c">
// ...
.text 0x100000 {
*(.text)
*(.rodata*) /* <---- ELF Cross Compiler or ELF *NIX (eg. Linux) */
*(.rdata*) /* <---- COFF/PE MinGW or Cygwin on Windows */
}
// ...
</source>
-->
 
== Troubleshooting / Asking for Help ==
Before asking for help on the forums or IRC, you should be taking all the possible steps to diagnose the nature of the problem yourself. In the case of problems like triple faults or "random" exceptions, it's a common mistake to make assumptions about the cause of a problem. Make use of a debugger or print statements to locate the exact point when an exception occurs. Using and emulator and a debugger (such as GDB and Bochs/QEMU) will help you to locate problems which are difficult to trace. If you provide some theory about the problem and actions you have already taken to solve it, people will be able to help you much easier (even if your theory is not correct, it at least gives people an idea of your views on the problem and the strategies you might have already tried, as well as what you might have missed).