- 浏览: 1444742 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (691)
- linux (207)
- shell (33)
- java (42)
- 其他 (22)
- javascript (33)
- cloud (16)
- python (33)
- c (48)
- sql (12)
- 工具 (6)
- 缓存 (16)
- ubuntu (7)
- perl (3)
- lua (2)
- 超级有用 (2)
- 服务器 (2)
- mac (22)
- nginx (34)
- php (2)
- 内核 (2)
- gdb (13)
- ICTCLAS (2)
- mac android (0)
- unix (1)
- android (1)
- vim (1)
- epoll (1)
- ios (21)
- mysql (3)
- systemtap (1)
- 算法 (2)
- 汇编 (2)
- arm (3)
- 我的数据结构 (8)
- websocket (12)
- hadoop (5)
- thrift (2)
- hbase (1)
- graphviz (1)
- redis (1)
- raspberry (2)
- qemu (31)
- opencv (4)
- socket (1)
- opengl (1)
- ibeacons (1)
- emacs (6)
- openstack (24)
- docker (1)
- webrtc (11)
- angularjs (2)
- neutron (23)
- jslinux (18)
- 网络 (13)
- tap (9)
- tensorflow (8)
- nlu (4)
- asm.js (5)
- sip (3)
- xl2tp (5)
- conda (1)
- emscripten (6)
- ffmpeg (10)
- srt (1)
- wasm (5)
- bert (3)
- kaldi (4)
- 知识图谱 (1)
最新评论
-
wahahachuang8:
我喜欢代码简洁易读,服务稳定的推送服务,前段时间研究了一下go ...
websocket的helloworld -
q114687576:
http://www.blue-zero.com/WebSoc ...
websocket的helloworld -
zhaoyanzimm:
感谢您的分享,给我提供了很大的帮助,在使用过程中发现了一个问题 ...
nginx的helloworld模块的helloworld -
haoningabc:
leebyte 写道太NB了,期待早日用上Killinux!么 ...
qemu+emacs+gdb调试内核 -
leebyte:
太NB了,期待早日用上Killinux!
qemu+emacs+gdb调试内核
两种方式x86_64 和32位的i386方式
-----------x86_64-----------------------------------------
参考http://mgalgs.github.io/2015/05/16/how-to-build-a-custom-linux-kernel-for-qemu-2015-edition.html
下载busybox和linux内核
把busybox编译好的文件生成 initramfs
需要一个启动文件
vim init
chmod +x init
find . -print0 | cpio --null -ov --format=newc | gzip -9 > $TOP/obj/initramfs-busybox-x86.cpio.gz
★★★★编译内核★★★★★★★★
linux Kernel
$ cd $TOP
运行
qemu-system-x86_64 -kernel obj/linux-x86-basic/arch/x86_64/boot/bzImage -initrd obj/initramfs-busybox-x86.cpio.gz -nographic -append "console=ttyS0" -enable-kvm
------------------------------------------------------------
i386★★★★★★★★★★如果是在64为系统上编译32位,有点特殊
------------------------------------------------------------
这步骤很重要,busybox不生成动态库
参考
http://blog.csdn.net/xsckernel/article/details/38045783
想编译32为的环境
将/usr/bin/gcc和/usr/bin/ld都改名为*.bin,就是改为: /usr/bin/gcc.bin和/usr/bin/ld.bin
然后写两个脚本:
还需要
测试是否切换到i386
继续以32位的方式编译busybox
$ make -j2
$ make install
生成initramfs:
--------------------------
★★★★★★编译32位的内核比较简单,只需要加ARCH=i386
--------------------------
make O=../obj/linux-i386-basic i386_defconfig
make O=../obj/linux-i386-basic kvmconfig
make O=../obj/linux-i386-basic ARCH=i386 -j16
qemu-system-i386 -kernel obj/linux-i386-basic/arch/x86/boot/bzImage -initrd obj/initramfs-busybox-i386.cpio.gz -nographic -append "console=ttyS0" -enable-kvm
-----------------------------------------------------------------------------
系统切换回64位环境
[root@jslinux mytest]# cat gcc64.sh
#!/bin/sh
mv -i /usr/bin/gcc /usr/bin/gcc.sh
mv -i /usr/bin/ld /usr/bin/ld.sh
mv -i /usr/bin/gcc.bin /usr/bin/gcc
mv -i /usr/bin/ld.bin /usr/bin/ld
系统切换回32位环境
[root@jslinux mytest]# cat gcc32.sh
#!/bin/sh
mv -i /usr/bin/gcc /usr/bin/gcc.bin
mv -i /usr/bin/ld /usr/bin/ld.bin
mv -i /usr/bin/gcc.sh /usr/bin/gcc
mv -i /usr/bin/ld.sh /usr/bin/ld
------------------------------------------------------------------------
-----------x86_64-----------------------------------------
参考http://mgalgs.github.io/2015/05/16/how-to-build-a-custom-linux-kernel-for-qemu-2015-edition.html
下载busybox和linux内核
TOP=/var/www/mytest wget http://distro.ibiblio.org/tinycorelinux/6.x/armv6/release/src/busybox/busybox-1.23.2.tar.bz2 wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.0.3.tar.xz cd $TOP/busybox-1.23.2 #这步骤很重要,busybox不生成动态库 mkdir -pv ../obj/busybox-x86 make O=../obj/busybox-x86 defconfig make O=../obj/busybox-x86 menuconfig -> Busybox Settings -> Build Options [ ] Build BusyBox as a static binary (no shared libs) Go to that location, select it, save, and exit. $ cd ../obj/busybox-x86 $ make -j2 $ make install
把busybox编译好的文件生成 initramfs
$ mkdir -p $TOP/initramfs/x86-busybox $ cd $TOP/initramfs/x86-busybox $ mkdir -pv {bin,sbin,etc,proc,sys,usr/{bin,sbin}} $ cp -av $TOP/obj/busybox-x86/_install/* .
需要一个启动文件
vim init
------------- #!/bin/sh mount -t proc none /proc mount -t sysfs none /sys echo -e "\nBoot took $(cut -d' ' -f1 /proc/uptime) seconds\n" exec /bin/sh --------------------
chmod +x init
find . -print0 | cpio --null -ov --format=newc | gzip -9 > $TOP/obj/initramfs-busybox-x86.cpio.gz
★★★★编译内核★★★★★★★★
linux Kernel
$ cd $TOP/linux-4.0.3 $ make O=../obj/linux-x86-basic x86_64_defconfig make O=../obj/linux-x86-basic kvmconfig #支持kvm make O=../obj/linux-x86-basic -j2
$ cd $TOP
运行
qemu-system-x86_64 -kernel obj/linux-x86-basic/arch/x86_64/boot/bzImage -initrd obj/initramfs-busybox-x86.cpio.gz -nographic -append "console=ttyS0" -enable-kvm
------------------------------------------------------------
i386★★★★★★★★★★如果是在64为系统上编译32位,有点特殊
------------------------------------------------------------
这步骤很重要,busybox不生成动态库
cd $TOP/busybox-1.23.2 mkdir -pv ../obj/busybox-i386 make O=../obj/busybox-i386 defconfig make O=../obj/busybox-i386 menuconfig -> Busybox Settings -> Build Options [ ] Build BusyBox as a static binary (no shared libs) Go to that location, select it, save, and exit. $ cd ../obj/busybox-i386
参考
http://blog.csdn.net/xsckernel/article/details/38045783
想编译32为的环境
将/usr/bin/gcc和/usr/bin/ld都改名为*.bin,就是改为: /usr/bin/gcc.bin和/usr/bin/ld.bin
然后写两个脚本:
/usr/bin/gcc: --------------------- #!/bin/sh gcc.bin -m32 $@ ------------------------ /usr/bin/ld: ------------------ #!/bin/sh ld.bin -m elf_i386 $@ ---------------------
还需要
yum install glibc.i686 glibc-devel.i686 glibc-static.i686 glibc-utils.x86_64 -y yum install libgcc.i686 -y
测试是否切换到i386
--------test.c-------- #include <stdio.h> #include <stdlib.h> int main() { printf("sizeof long is %d\n", sizeof(long)); return 0; } ----------------- gcc test.c file a.out a.out: ELF 32-bit LSB executable,
继续以32位的方式编译busybox
$ make -j2
$ make install
生成initramfs:
$ mkdir -p $TOP/initramfs/i386-busybox $ cd $TOP/initramfs/i386-busybox $ mkdir -pv {bin,sbin,etc,proc,sys,usr/{bin,sbin}} $ cp -av $TOP/obj/busybox-i386/_install/* . vim init ------------- #!/bin/sh mount -t proc none /proc mount -t sysfs none /sys echo -e "\nBoot took $(cut -d' ' -f1 /proc/uptime) seconds\n" exec /bin/sh -------------------- chmod +x init find . -print0 | cpio --null -ov --format=newc | gzip -9 > $TOP/obj/initramfs-busybox-i386.cpio.gz
--------------------------
★★★★★★编译32位的内核比较简单,只需要加ARCH=i386
--------------------------
make O=../obj/linux-i386-basic i386_defconfig
make O=../obj/linux-i386-basic kvmconfig
make O=../obj/linux-i386-basic ARCH=i386 -j16
qemu-system-i386 -kernel obj/linux-i386-basic/arch/x86/boot/bzImage -initrd obj/initramfs-busybox-i386.cpio.gz -nographic -append "console=ttyS0" -enable-kvm
-----------------------------------------------------------------------------
系统切换回64位环境
[root@jslinux mytest]# cat gcc64.sh
#!/bin/sh
mv -i /usr/bin/gcc /usr/bin/gcc.sh
mv -i /usr/bin/ld /usr/bin/ld.sh
mv -i /usr/bin/gcc.bin /usr/bin/gcc
mv -i /usr/bin/ld.bin /usr/bin/ld
系统切换回32位环境
[root@jslinux mytest]# cat gcc32.sh
#!/bin/sh
mv -i /usr/bin/gcc /usr/bin/gcc.bin
mv -i /usr/bin/ld /usr/bin/ld.bin
mv -i /usr/bin/gcc.sh /usr/bin/gcc
mv -i /usr/bin/ld.sh /usr/bin/ld
------------------------------------------------------------------------
发表评论
-
sdl笔记
2019-01-31 17:19 686sdl教程教程 https://github.com/Twin ... -
tinyemu
2019-01-24 17:59 1399参考https://bellard.org/jslinux/t ... -
建立tap设备的c的代码
2019-01-08 19:09 438tapper.c #include <stdio.h& ... -
jslinux总结帖
2019-01-04 21:33 1017注意个问题: chrome不要用两个tab页,否则ping不通 ... -
emscripten asm.js的helloworld
2018-03-01 20:15 1068mac下安装: brew install SDL2 SDL2_ ... -
nginx代理wss和https
2018-02-27 15:34 3859nginx启用ssl yum install openssl ... -
jslinux-deobfuscated-network
2017-02-13 22:37 614基础知识 查看网络包 tcpdump -i eth0 -e ... -
用buildroot为jslinux建立最小rootfs
2016-11-18 17:59 1207############################### ... -
jslinux带网络功能的内核
2016-11-15 15:35 750想重新编译jslinux-network 的内核,其实就是比f ... -
nginx rewrite替代apache rewrite
2016-10-18 20:30 786清理chrome的缓存 chrome://appcache-i ... -
qemu用tap方式启动vm的网络试验(ip route)
2016-09-14 11:29 2674ip route add 192.168.8.0/24 via ... -
qemu的不断网动态迁移的试验
2016-06-28 16:16 916需求: 目前有两台服务器 192.168.139.117 19 ... -
kvm的nested嵌套
2016-06-27 18:25 1277关键点是 modprobe kvm_intel nested= ... -
qemu的动态迁移的试验
2016-06-25 21:48 13801.安装qemu-2.5.1.tar 解决 ... -
libvirt建立快照和基本使用
2016-06-25 15:51 1545如果使用qemu的快照方式 在monitor中操作 (qe ... -
socket的方式使用qemu建立虚拟机
2016-06-24 17:54 1803qemu的-net参数 -net nic 必须有,基本配置mo ... -
tap的方式使用qemu建立虚拟机NAT网络
2016-06-23 18:03 9500基本概念: vm:虚拟机 ... -
qemu建立基本的虚拟机
2016-06-23 17:04 1914使用qemu建立虚拟机 1.需要内核文件 bzImage ... -
qemu用nat的方式使用tap建立虚拟机
2016-06-23 16:15 11普通桥接参考 http://haoningabc.iteye. ... -
tap的方式使用qemu建立虚拟机桥接网络
2016-06-22 20:53 7614需求:建立一个虚拟机,使网络和内网一样,当一台普通接入内网的服 ...
相关推荐
介绍了多种QEMU虚拟机的网卡虚拟化技术和具体实现方法,同时给出了相应的网络配置步骤
qemu文件,做模拟测试的朋友,赶紧下载,这个版本是不错的 的
qemu 模拟 A9 内核,里面包含源码与已经制作好的根文件系统、内核
包含busybox文件系统,编译好的内核bzImage,启动脚本(修改下路径),x86架构
qemu-5.0.0、u-boot 源码、linux-5.4.95内核、gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf交叉编译链、busybox-1.32.1 工具 文章 https://blog.csdn.net/leacock1991/article/details/113703897 使用资源
本文档总结了基于Linux内核源代码以及Busybox制作可以在Bochs和Qemu启动的精简Linux可启动内核镜像的方法,作为研究Linux内核和Bochs的实验环境。
要用的同志直接私戳我即可,不用下载
BusyBox 是一个集成了三百多个最常用Linux命令和工具的软件。BusyBox 包含了一些简单的工具,例如ls、cat和echo等等,还包含了一些更大、更复杂的工具,例grep、find、mount以及telnet。有些人将 BusyBox 称为 Linux...
1. qemux64 2. ovmf.fd 3. busybox-img, 4. fwts-live-22.03.00-x86_64.img, 5. qemu 启动脚本(双击即可运行)
本文由TinyLab.org原创。...通过该文章,你可以学习到如何配置kernel,如何交叉编译kernel,如何配置busybox并编译,如何制作initramfs,如何制作根文件系统,如何定制自己的uboot,如何通过 uboot向kernel传递参数等。
u-boot:vexpress-a15 u-boot镜像 xen-uImage:xen镜像 zImage:linux内核镜像 rootfs.img.gz:busybox文件系统镜像 vexpress-v2p-ca15_a7.dtb:设备树二进制文件
交叉编译Linux(可能是以x86_64为基础)。 在PowerPC上具有Firewire终端。 (这是另一个项目的一部分) 从构建的系统中编译和运行程序 少量的脚本可以构建和部分测试各种目标 网络支持(正在工作) 可选需要mac...
qemu 模拟 通过 busybox 制作 initramfs 镜像(rootfs)
顾名思义,busybear-linux是由busybox和dropbear组成的riscv-linux根映像。 根映像旨在演示riscv-qemu中的virtio-net和virtio-block,并具有一个dropbear ssh服务器,该服务器允许现成的ssh访问RISC-V虚拟机。 ...
x86-ext2文件系统镜像(busybox版),可用于qemu或者kvm,etc,.
KRITIS Linux 是用于动态重建系统的构建系统 丢弃虚拟机映像 见 和 仍在进行中 支持musl,glibc,dietlibc和busybox / toybox / dash / bash 句法 获得帮助,例如./minilinux.sh ...上面的命令将构建64位Linux v
要求用linux-4.0.4和 BusyBox 1.23.2 (用作shell+网络命令行工具),libc可以选择musl libc, uclibc等最终的系统可以用ifconfig等网络命令, 和简单的网络程序(完成100MB的tcp/ip传输),可以在qemu 模拟的x86-64 或 ...
cramfs格式的ramdisk,带有busybox,取自qemu发布包,自己做一个会很复杂而麻烦,可拿来使用
Alpine Term,又名Alpine Linux Terminal,是运行的虚拟机, 是基于Musl libc和Busybox的面向安全的轻量级Linux发行版。 该应用程序从 fork开始,旨在尽可能覆盖其功能,并提供真正的基于Linux的系统的体验。 ...
5、Linux内核编译与运行:Busybox准备、环境配置、编译最小文件系统、编译内核、运行QEMU 6、Linux内核模块编程:内核模块编程、卸载模块编程、参数模块编程 8、Linux内存管理:编写模块程序、编译、插入模块、查看...