This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
my_makefile [2017/03/03 13:54] admin created |
my_makefile [2017/03/03 13:57] (current) admin |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| =====My makefile===== | =====My makefile===== | ||
| The makefile builds a complete project from scratch up to and including building a format ready for usage. | The makefile builds a complete project from scratch up to and including building a format ready for usage. | ||
| - | <code> | + | <file> |
| CC=i686-elf-gcc | CC=i686-elf-gcc | ||
| AS=i686-elf-as | AS=i686-elf-as | ||
| Line 32: | Line 32: | ||
| rm -f kernel.iso | rm -f kernel.iso | ||
| genisoimage -r -b isodir/boot/hd.img -c isodir/boot/boot.catalog -hard-disk-boot -o kernel.iso . | genisoimage -r -b isodir/boot/hd.img -c isodir/boot/boot.catalog -hard-disk-boot -o kernel.iso . | ||
| - | </code> | + | </file> |
| You will notice ''i686-elf-gcc'' and ''i686-elf-as'' referenced at the top of the file. These are the cross compiler and the cross assembler respectively.\\ | You will notice ''i686-elf-gcc'' and ''i686-elf-as'' referenced at the top of the file. These are the cross compiler and the cross assembler respectively.\\ | ||
| We do not need a cross assembler for NASM, as the output we generate is pure x86 code. The reason we use NASM and not our own cross assembler is because NASM have better output options for those kinds of files.\\ | We do not need a cross assembler for NASM, as the output we generate is pure x86 code. The reason we use NASM and not our own cross assembler is because NASM have better output options for those kinds of files.\\ | ||
| \\ | \\ | ||
| The generated ''hd.img'' is a byte-wise representation of our hard-drive containing all our code. I am using this file to create a bootable USB-drive.\\ | The generated ''hd.img'' is a byte-wise representation of our hard-drive containing all our code. I am using this file to create a bootable USB-drive.\\ | ||
| + | I would have created the USB directly from the makefile, but at the time of writing this the Linux bash under Windows 10 does not support removable media.\\ | ||
| \\ | \\ | ||
| Observe also the last line that invokes ''genisoimage''. This entry will create a bootable ISO image from ''hd.img'' that can be mounted as a disk in an emulator or even burned to a CD.\\ | Observe also the last line that invokes ''genisoimage''. This entry will create a bootable ISO image from ''hd.img'' that can be mounted as a disk in an emulator or even burned to a CD.\\ | ||