RPi 2B QEMU 模拟树莓派

/********************************************************************************
 *                            RPi 2B QEMU 模拟树莓派
 * 说明:
 *     网络上又找到一些资料,不过在我的电脑上运行会出一些问题,经验证,需要提前
 * 修改文件系统中的链接库和分区挂载表。
 * 
 *                                                2017-5-21 台湾 中和区 曾剑锋
 *******************************************************************************/

一、参考文档:
    1. Emulating Jessie image with 4.x.xx kernel
        https://github.com/dhruvvyas90/qemu-rpi-kernel/wiki/Emulating-Jessie-image-with-4.x.xx-kernel
    2. Change Screen Resolution?
        https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=136280
    3. CONFIG.TXT
        https://www.raspberrypi.org/documentation/configuration/config-txt/README.md
  
二、下载内核:
    https://github.com/dhruvvyas90/qemu-rpi-kernel

三、下载树莓派系统:
    1. https://downloads.raspberrypi.org/raspbian_lite_latest
    2. https://downloads.raspberrypi.org/raspbian_latest

四、操作流程:
    1. 文件系统修改:
        1. fdisk -l <树莓派系统镜像>
            zengjf@zengjf:~/rpi$ sudo fdisk -l 2017-03-02-raspbian-jessie-lite.img
            [sudo] password for zengjf: 
            Disk 2017-03-02-raspbian-jessie-lite.img: 1.3 GiB, 1393557504 bytes, 2721792 sectors
            Units: sectors of 1 * 512 = 512 bytes
            Sector size (logical/physical): 512 bytes / 512 bytes
            I/O size (minimum/optimal): 512 bytes / 512 bytes
            Disklabel type: dos
            Disk identifier: 0xb2455b06

            Device                               Boot  Start     End Sectors  Size Id Type
            2017-03-02-raspbian-jessie-lite.img1        8192  137215  129024   63M  c W95 FAT
            2017-03-02-raspbian-jessie-lite.img2      137216 2721791 2584576  1.2G 83 Linux

        2. 磁盘偏移计算:137216 * 512 = 70254592
        3. mount -v -o offset=70254592 -t ext4 your-image-file.img /mnt
        4. cd /mnt
        5. sudo vim ./etc/ld.so.preload
            注释掉所有的内容就可以了,一般里面只有一行,直接注释掉就OK了。
        6. sudo vim ./etc/fstab
            看到和/dev/mmcblk有关的都可以注释掉。
        7. cd ~
        8. sudo umount /mnt
    2. 参考运行命令:
        1. lite版参考执行命令
            qemu-system-arm -kernel kernel-qemu-4.4.26-jessie -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 rootfstype=ext4 rw" -hda 2017-03-02-raspbian-jessie-lite.img 
        2. desktop版参考执行命令
            qemu-system-arm -kernel kernel-qemu-4.4.26-jessie -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 rootfstype=ext4 rw" -hda 2017-04-10-raspbian-jessie.img

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值