Archive for the ‘kernel’ Category
While compiling a FreeBSD kernel I encountered the following error message from GNU assembler
Error: suffix or operands invalid for 'mov'
I was not sure whether the error is because of my changes are not. But still I have to debug the problem and solve it, so I decided to find what is wrong with the mov instruction. But since gcc created a temporary file and invoked as to assemble it, I couldn’t find the temp file anymore.
Googled and find the following gcc options to find what gcc does.
gcc –v is verbose mode, which prints all the action/scripts gcc is doing.
gcc -### similar to –v but wont execute any commands.
gcc –save-temps saves all the temporary files generated by the gcc. Useful if you want to see the assembly output passed to gnu assembler.
gcc –E Just preprocess the c file.
gcc –S generate assembly file.
With gcc –v –save-temps, I got the temporary assembler file used by assembler. Since reading machine generated assembly file is difficult, I tried to find the C source code corresponding to the error. From nearest .file assembler directive I found the C file name and from the .loc directive I found the line number. And the following was the inline assembly in the C file.
__asm __volatile("<b>movl </b>%%ss,%0" : "=rm" (sel));
Was surprised what is wrong with this and why my assembler giving error. Googled again and found this link – http://kerneltrap.org/node/5785. It seems newer gnu assembler(>=2.16) wont support long read/write operations(mov) on segment registers(ds,ss…). So changed the above source to
movw %%ss, %o and it compiled perfectly. 🙂
Last week, I decided to boot Ace using CD image rather than floppy image because booting was slow when floppy image is used in bochs.
To create bootable cd with grub, stage2_eltorito should compiled from the grub source. The mkisofs is also needed to create the image. http://smithii.com/cdrtools contains windows cygwin port of the cdrtools which contains mkisofs.
mkdir -p $ACE_ROOT/img/iso/boot/grub cp $ACE_ROOT/img/boot/grub/stage2_eltorito $ACE_ROOT/img/iso/boot/grub cp $ACE_ROOT/img/boot/grub/menu.lst $ACE_ROOT/img/iso/boot/grub cp $ACE_ROOT/obj/kernel.sys $ACE_ROOT/img/iso/ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o $ACE_ROOT/img/bootcd.iso $ACE_ROOT/img/iso
This image can be written to a CD using any CD burning software.