2015年3月27日 星期五

Build and boot a mini os kernel with VirtualBox

Environment: Ubuntu 14.04

1.
Download gcc and binutils source code from GNU (gnu mirror sites)
Also, apt-get install libgmp3-dev libmpfr-dev libmpc-dev texinfo

2.
create directory $HOME/opt and $HOME/opt/cross

export PREFIX="$HOME/opt/cross"
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"

3.
mkdir build-binutils
cd build-binutils
../binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
make MAKEINFO=true
make install MAKEINFO=true

4.
mkdir build-gcc
cd build-gcc
../gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc

Now, we have a i686-elf-as and i686-elf-gcc as cross compiler.

5.
Make a boot.s as multiboot header and make function call to kernel_main at kernel.c


6.
Make a kernel.c to print a "Hello World!" string to the screen

7.
Make a linker.ld to combine boot.o and kernel.o to myos.bin

8.
Make bootable iso image
First, make a grub.cfg file

menuentry "myos" {
multiboot /boot/myos.bin
}

Second, make a directory structure as below
<isodir>/boot/
<isodir>/boot/myos.bin
<isodir>/boot/grub/
<isodir>/boot/grub/grub.cfg

Finally, we use grub-mkrescue to make a myos.iso as below
 grub-mkrescue -o myos.iso isodir

References:
http://wiki.osdev.org/GCC_Cross-Compiler
http://wiki.osdev.org/Bare_Bones

iPhone 虛擬定位及GPS模擬工具

  iMyLoc   是一個專為 iOS 裝置設計的虛擬定位工具,無需越獄(Jailbreak)即可實現全域級別的 GPS 定位修改。此工具透過電腦與 iOS 裝置進行本地通訊,提供安全且穩定的定位模擬服務。 下載最新版本 / Download Latest Release 軟體...