kernel size problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
BobSPonja
Posts: 1
Joined: Sat Dec 06, 2014 6:02 pm

kernel size problem

Post by BobSPonja »

if kernel.c contain
txtString("\nprompt%",3,0); chain function to display which works well- and

compilation:

Code: Select all

nasm -f elf prm32.asm
gcc -ffreestanding -c kernel.c -o kernel.o
gcc -ffreestanding -c anexo.c -o anexo.o
gcc -ffreestanding -c video_text.c -o video_text.o
gcc -ffreestanding -c draw_logo_init.c -o draw_logo_init.o
gcc -ffreestanding -c in_out.c -o in_out.o
ld -o kernel.bin -Ttext 0x1000 kernel.o prm32.o in_out.o video_text.o draw_logo_init.o anexo.o --oformat binary
nasm boot.asm -o boot.bin
dd if=/dev/zero of=image.bin bs=512 count=2880
dd if=boot.bin of=image.bin conv=notrunc
dd if=kernel.bin of=image.bin conv=notrunc seek=1
cat image.bin > os.img
qemu os.img
good compilation
good compilation
but if I add another txtString("\nprompt%",3,0); then crash
with more code in some source(s) crash
with more code in some source(s) crash
and does not write anything, I suspect that overwrites the kernel as with any set of instrutions eg, a for (lalalal) { Babab} instead txtString, i.e, if append more code to some sources file then crash.

txtCadena("\nprompt%",3,0);
int ff;
for(ff=0;ff<255;ff++)
{

}

is the same sio add more code to any of the other sources, code cycles ... so basic that they should not do so thunder or any other code ... So I can not go programmed and adding features

I suspect it's because of the size of the image, but since I was testing, thanks in advance, sorry for my English.
FallenAvatar
Member
Member
Posts: 283
Joined: Mon Jan 03, 2011 6:58 pm

Re: kernel size problem

Post by FallenAvatar »

BobSPonja wrote: nasm -f elf prm32.asm; gcc -ffreestanding -c kernel.c -o kernel.o;gcc -ffreestanding -c anexo.c -o anexo.o;gcc -ffreestanding -c video_text.c -o video_text.o;gcc -ffreestanding -c draw_logo_init.c -o draw_logo_init.o;gcc -ffreestanding -c in_out.c -o in_out.o; ld -o kernel.bin -Ttext 0x1000 kernel.o prm32.o in_out.o video_text.o draw_logo_init.o anexo.o --oformat binary;nasm boot.asm -o boot.bin;dd if=/dev/zero of=image.bin bs=512 count=2880;dd if=boot.bin of=image.bin conv=notrunc;dd if=kernel.bin of=image.bin conv=notrunc seek=1;cat image.bin > os.img

qemu os.img
Please use code tags in the future and have each command start on a new line.

1) Are you using a GCC Cross-Compiler?
2) Enable warnings when you compile, most warnings can become errors in OSDev.
3) You should be using a link file. See Strings do not work.

- Monk
User avatar
Espanish
Posts: 24
Joined: Fri Nov 21, 2014 6:30 am

Re: kernel size problem

Post by Espanish »

BobSPonja you should use a [Makefile] if you aren't already.
As for why the kernel misbehaves, I can't guess without seeing the source code of txtString().
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: kernel size problem

Post by sortie »

Your build instructions are awful. This is not a good way of compiling and booting a kernel. It's possible to do it, but if you get trouble and have to ask, you are not skilled enough to use this approach (and skilled people wouldn't do it this way). I suggest you discard your current code and follow http://wiki.osdev.org/Bare_Bones instead, as this is the recommended way and gives you a good starting point that won't mysteriously malfunction.

Additionally, you failed to give enough information and code to solve your problem. I guess your kernel got too big, or you used a language feature your broken build instructions didn't implement correctly. Please use the code tag and use newlines between commands.

Espanish: We don't know if the original poster is using a Makefile and just pasted the commands here. I very much prefer to see the actual, raw command compared to a Makefile. (Then I would have to figure out the Makefile and how it is used, it's another level of indirection).
Post Reply