安装
apt-get install qemu
下载http://kernel.org/ 这里也测试过4.5版本,但是无法启动
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.7.4.tar.bz2
tar xvf linux-3.7.4.tar.bz2
cd linux-3.7.4.tar.bz2
编译内核
ls arch/x86/configs/
make i386_defconfig
make menuconfig
# compile whith the kernel parameter
# General Setup –> Initial RAM filesystem and RAM disk support
# Device Drivers –> Block Devices –> RAM block device support
make -j 2
用hello world 测试
#include <stdio.h>
#include <unistd.h>
int main(void)
{
while(1){
printf("hello,world\n");
usleep(1000000);
}
return 0;
}
编译
gcc -static -o init init.c
apt-get install qemu
下载http://kernel.org/ 这里也测试过4.5版本,但是无法启动
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.7.4.tar.bz2
tar xvf linux-3.7.4.tar.bz2
cd linux-3.7.4.tar.bz2
编译内核
ls arch/x86/configs/
make i386_defconfig
make menuconfig
# compile whith the kernel parameter
# General Setup –> Initial RAM filesystem and RAM disk support
# Device Drivers –> Block Devices –> RAM block device support
make -j 2
用hello world 测试
#include <stdio.h>
#include <unistd.h>
int main(void)
{
while(1){
printf("hello,world\n");
usleep(1000000);
}
return 0;
}
编译
gcc -static -o init init.c