Giter Site home page Giter Site logo

qemu-rpi-kernel's Introduction

qemu-rpi-kernel

Emuation using Qemu's native raspi2/3 machine

Follow instructions under native-emulation subfolder in order to use Qemu's native raspi2/3 machine to emulate raspberry pi.

Emulation using pre-compiled versatilepb kernels

Ready-made kernels that can be used to emulate a Raspberry Pi using QEMU.

They are compiled from the same kernel sources used for official Raspian images, with tweaks to make them suitable for use with QEMU, and are supposed to be used along with official Raspbian images.

Obtaining Raspbian

Before starting, you should download a Raspbian image from the Raspberry Pi website and extract the .zip archive to obtain an .img file.

Choosing a kernel image

This repository contains three types of kernel images:

  • kernel-qemu-4.*.*-buster are the most recent images, which are compatible with Raspbian Buster and Stretch. To use these images, you'll need a compiled device tree file (.dtb) which is also contained in this repository. Use versatile-pb-buster.dtb for Buster, or use versatile-pb.dtb for Stretch. Unless you are positive you need a different kernel, the most recent of these images is probably what you want.

  • kernel-qemu-4.*.*-stretch are images compatible with Raspbian Stretch and Jessie. To use these images, you'll need the versatile-pb.dtb file which is also contained in this repository.

  • kernel-qemu-4.4.*-jessie are images compatible with Raspbian Jessie and Wheezy.

  • kernel-qemu-3.10.25-wheezy is the original image from xecdesign.com, which is compatible with Raspbian Wheezy only.

Using kernel images with QEMU

The QEMU command line will look like

$ qemu-system-arm \
  -M versatilepb \
  -cpu arm1176 \
  -m 256 \
  -hda /.../2019-09-26-raspbian-buster-lite.img \
  -net user,hostfwd=tcp::5022-:22 \
  -dtb /.../versatile-pb-buster.dtb \
  -kernel /.../kernel-qemu-4.19.50-buster \
  -append 'root=/dev/sda2 panic=1' \
  -no-reboot

For the kernel 5.4.51 please use (Tested with Raspbian Buster Lite):

$ qemu-system-arm \
  -M versatilepb \
  -cpu arm1176 \
  -m 256 \
  -drive "file=/.../2020-05-27-raspios-buster-lite-armhf.img,if=none,index=0,media=disk,format=raw,id=disk0" \
  -device "virtio-blk-pci,drive=disk0,disable-modern=on,disable-legacy=off" \
  -net "user,hostfwd=tcp::5022-:22" \
  -dtb /.../versatile-pb-buster-5.4.51.dtb \
  -kernel /.../kernel-qemu-5.4.51-buster \
  -append 'root=/dev/vda2 panic=1' \
  -no-reboot

with the paths to the disk image, .dtb file and kernel image adjusted appropriately.

There is a Docker image available to automate this whole process:

docker run -it lukechilds/dockerpi

More information: https://github.com/lukechilds/dockerpi

Using kernel images with libvirt

Assuming your libvirt version is at least 5.0.0, you can use something like

$ virt-install \
  --name pi \
  --arch armv6l \
  --machine versatilepb \
  --cpu arm1176 \
  --vcpus 1 \
  --memory 256 \
  --import \
  --disk /.../2019-09-26-raspbian-buster-lite.img,format=raw,bus=virtio \
  --network user,model=virtio \
  --video vga \
  --graphics spice \
  --rng device=/dev/urandom,model=virtio \
  --boot 'dtb=/.../versatile-pb-buster.dtb,kernel=/.../kernel-qemu-4.19.50-buster,kernel_args=root=/dev/vda2 panic=1' \
  --events on_reboot=destroy

to create a new libvirt guest called pi. You'll be able to manage the guest with all the usual tools, such as virsh and virt-manager.

Building your own kernel image

See the contents of the tools/ directory, where the build scripts and instructions on how to use them are stored.

Origin of this repository

While searching the Internet for information on emulating a Raspberry Pi using QEMU in Jun 2015, most of the guides pointed to kernel images hosted on xecdesign.com; however, at the time the resource was no longer online, and that's still the case as of Feb 2019.

This repository was initially created as a way to make those kernel images available once again, and has since been expanded to provide improved and up-to-date images.

Further information

Additional documentation can be found on the wiki.

qemu-rpi-kernel's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qemu-rpi-kernel's Issues

Need more info

Thanks a lot for your efforts. I have now a fully working raspberry pi emulated in my Ubuntu using the kernel you provided.

I have some questions:
What is the version of kernel you have compiled?
If we want to do this ourselves, what are the steps? Can you please provide a guide or something?

Thanks again and keep it up!

Enable VirtFS By Default

VirtFS is a feature QEMU provides to allows the host to share a folder with the guest. However, the driver is not compiled on the prebuilt kernal by default. Since these kernals are meant to be used with qemu, I was wondering if you would be willing to add to the following config options to the .config part of script:

CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
CONFIG_9P_FS=y
CONFIG_9P_FS_POSIX_ACL=y
CONFIG_PCI=y
CONFIG_VIRTIO_PCI=y

*taken from qemu wiki

I can even do a pull request if you like.

can I compile a qemu-rpi-kernel for cortex-a7?

Thanks for uploading these qemu-rpi-kernels, I had successfully run a 2017-07-05-raspbian-jessie-lite.img with kernel-qemu-4.4.34-jessie on versatilepb using qemu-system-arm.

qemu-system-arm -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "console=ttyAMA0,115200 root=/dev/sda2 panic=1 rootfstype=ext4 rw" -kernel kernel-qemu-4.4.34-jessie -hda 2017-07-05-raspbian-jessie-lite.img

the above is the command I use

However, I found out that Raspberry Pi 2 use cortex-a7 cpu, not arm1176, the cpu I used in the above command.

Then I changed to use -cpu cortex-a7 but the result is
Error: unrecognized/unsupported processor variant (0x410fc075).

I am wondering if I have to recompile the kernel for cortex-a7, but I don't have any idea how to do that...
Could you please give me some suggestions?

Thanks anyway.

got kernel panic with using "-dtb versatile-pb.dtb"

The reason I use -dtb is that I want to add a self-defined platform device to the device tree.
But I found that I can't make dtb from build-kernel-qemu script (I have already add "make dtb" into build-kernel-qemu).

Also I have tried to use the original linux source code to create versatile-pb.dtb and added to the qemu command with "-dtb versatile-pb.dtb".
But I got "kernel panic... Unable to mount root fs on unknown-block(31,3)" as bellow.
image

Does anyone know how to make or use the device tree to this qemu-rpi-kernel?

Thanks for reading this issue.

Enable v9fs (p9) for sharing files between host and guest.

I followed https://wiki.qemu.org/Documentation/9psetup to share files between a host and qemu running the remulated raspian. Unfortunately the 9p file system is unknown and there are no modules available at all for this kernel.

It would be great, if this feature were compiled into the kernel. Though I am a bit puzzled, because in the build script I see, that is is actually enabled.

Either way, please compile the kernel with this feather or enlighten me on how to get it up and running correctly :)

Keep up the good work!

Kernel x Jessie

I'm trying to boot jessie version , tested with your 2 versions of kernel and from others repo as well, always get the error:

  • Kernel panic - not syncing : Attempted to kill init

Tested using image 2016-02-09-raspbian-jessie.img and this cmd :

  • qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -hda 2016-02-09-raspbian-jessie.img

I'm using newest OSX and when i double click the img, it mounts but i can see the file as you point here:

I think that the first thing would point what version of jessie it worked for you, so i can test using this same version, and if is possible doc in readme/wiki =)

Thanks!

Release

Hi, I wanted to thank you for those kernels. We end up using them quite a lot.

Do you think it would be possible to do a release of the latest kernel hosted here, so there may be an easy and uniform way to fetch it ?

Thanks

QEMU for raspberry Pi always reboot

I NEED HELP

**I have done everything wright....i think, but I am stuck in rebooting

here is the output and i did put panic value to 100 for delay**

WARNING: Image format was not specified for '2016-11-25-raspbian-jessie-lite.img' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Initializing cgroup subsys cpuacct
Linux version 4.4.26+ (amit@penguin) (gcc version 6.2.1 20161119 (Debian 6.2.1-4) ) #2 Thu Dec 1 12:27:44 IST 2016
CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
CPU: VIPT aliasing data cache, unknown instruction cache
Machine: ARM-Versatile PB
Memory policy: Data cache writeback
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 64960
Kernel command line: root=/dev/sda2 panic=100 rootfstype=ext4 rw console=ttyAMA0,115200
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 253716K/262144K available (4266K kernel code, 56K rwdata, 1008K rodata, 180K init, 139K bss, 8428K reserved, 0K cma-reserved)
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xd0800000 - 0xff800000 ( 752 MB)
lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc052ecf0 (5276 kB)
.init : 0xc052f000 - 0xc055c000 ( 180 kB)
.data : 0xc055c000 - 0xc056a120 ( 57 kB)
.bss : 0xc059ae70 - 0xc05bdb78 ( 140 kB)
NR_IRQS:224
VIC @f1140000: id 0x00041190, vendor 0x41
FPGA IRQ chip 0 "SIC" @ f1003000, 13 irqs, parent IRQ: 63
clocksource: timer3: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
Console: colour dummy device 80x30
Calibrating delay loop... 400.58 BogoMIPS (lpj=2002944)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
Disabling cpuset control group subsystem
Initializing cgroup subsys memory
Initializing cgroup subsys devices
Initializing cgroup subsys freezer
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x8220 - 0x827c
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
Serial: AMBA PL011 UART driver
dev:f1: ttyAMA0 at MMIO 0x101f1000 (irq = 44, base_baud = 0) is a PL011 rev1
console [ttyAMA0] enabled
dev:f2: ttyAMA1 at MMIO 0x101f2000 (irq = 45, base_baud = 0) is a PL011 rev1
dev:f3: ttyAMA2 at MMIO 0x101f3000 (irq = 46, base_baud = 0) is a PL011 rev1
fpga:09: ttyAMA3 at MMIO 0x10009000 (irq = 70, base_baud = 0) is a PL011 rev1
PCI core found (slot 11)
PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [mem 0x50000000-0x5fffffff]
pci_bus 0000:00: root bus resource [mem 0x60000000-0x6fffffff pref]
pci_bus 0000:00: root bus resource [io 0x1000-0xffff]
pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
PCI: bus0: Fast back to back transfers disabled
pci 0000:00:0c.0: BAR 2: assigned [mem 0x50000000-0x50001fff]
pci 0000:00:0c.0: BAR 1: assigned [mem 0x50002000-0x500023ff]
pci 0000:00:0c.0: BAR 0: assigned [io 0x1000-0x10ff]
vgaarb: loaded
SCSI subsystem initialized
clocksource: Switched to clocksource timer3
NET: Registered protocol family 2
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NetWinder Floating Point Emulator V0.97 (double precision)
futex hash table entries: 256 (order: -1, 3072 bytes)
Installing knfsd (copyright (C) 1996 [email protected]).
jffs2: version 2.2. (NAND) ยฉ 2001-2006 Red Hat, Inc.
romfs: ROMFS MTD (C) 2007 Red Hat, Inc.
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
pl061_gpio dev:e4: PL061 GPIO chip @0x101e4000 registered
pl061_gpio dev:e5: PL061 GPIO chip @0x101e5000 registered
pl061_gpio dev:e6: PL061 GPIO chip @0x101e6000 registered
pl061_gpio dev:e7: PL061 GPIO chip @0x101e7000 registered
clcd-pl11x dev:20: PL110 rev0 at 0x10120000
clcd-pl11x dev:20: Versatile hardware, VGA display
Console: switching to colour frame buffer device 80x30
brd: module loaded
sym53c8xx 0000:00:0c.0: enabling device (0100 -> 0103)
sym0: <895a> rev 0x0 at pci 0000:00:0c.0 irq 93
sym0: No NVRAM, ID 7, Fast-40, LVD, parity checking
sym0: SCSI BUS has been reset.
scsi host0: sym-2.2.3
sym0: unknown interrupt(s) ignored, ISTAT=0x5 DSTAT=0x80 SIST=0x0
scsi 0:0:0:0: Direct-Access QEMU QEMU HARDDISK 2.5+ PQ: 0 ANSI: 5
scsi target0:0:0: tagged command queuing enabled, command queue depth 16.
scsi target0:0:0: Beginning Domain Validation
scsi target0:0:0: Domain Validation skipping write tests
scsi target0:0:0: Ending Domain Validation
scsi 0:0:2:0: CD-ROM QEMU QEMU CD-ROM 2.5+ PQ: 0 ANSI: 5
scsi target0:0:2: tagged command queuing enabled, command queue depth 16.
scsi target0:0:2: Beginning Domain Validation
scsi target0:0:2: Domain Validation skipping write tests
scsi target0:0:2: Ending Domain Validation
sr 0:0:2:0: [sr0] scsi3-mmc drive: 16x/50x cd/rw xa/form2 cdda tray
cdrom: Uniform CD-ROM driver Revision: 3.20
sd 0:0:0:0: [sda] 2715648 512-byte logical blocks: (1.39 GB/1.29 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
physmap platform flash device: 04000000 at 34000000
physmap-flash.0: Found 1 x32 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
sda: sda1 sda2
sd 0:0:0:0: [sda] Attached SCSI disk
smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre [email protected]
smc91x smc91x.0 eth0: SMC91C11xFD (rev 1) at d0a68000 IRQ 57
[nowait]
smc91x smc91x.0 eth0: Ethernet addr: 52:54:00:12:34:56
mousedev: PS/2 mouse device common for all mice
ledtrig-cpu: registered to indicate activity on CPUs
Netfilter messages via NETLINK v0.30.
nf_conntrack version 0.5.0 (3964 buckets, 15856 max)
ip_tables: (C) 2000-2006 Netfilter Core Team
NET: Registered protocol family 17
bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
Bridge firewalling registered
input: AT Raw Set 2 keyboard as /devices/fpga:06/serio0/input/input0
input: ImExPS/2 Generic Explorer Mouse as /devices/fpga:07/serio1/input/input2
EXT4-fs (sda2): recovery complete
EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 8:2.
devtmpfs: mounted
Freeing unused kernel memory: 180K (c052f000 - c055c000)
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004

CPU: 0 PID: 1 Comm: init Not tainted 4.4.26+ #2
Hardware name: ARM-Versatile PB
[] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[] (show_stack) from [] (panic+0x94/0x240)
[] (panic) from [] (do_exit+0x8d8/0x914)
[] (do_exit) from [] (do_group_exit+0x3c/0xa8)
[] (do_group_exit) from [] (get_signal+0x210/0x528)
[] (get_signal) from [] (do_signal+0xcc/0x438)
[] (do_signal) from [] (do_work_pending+0xb8/0xd0)
[] (do_work_pending) from [] (slow_work_pending+0xc/0x20)
Rebooting in 100 seconds..

Wiki description is unclear

Hi

Thanks for posting rPI kernel for quemu. I have problem runing it. I cloned this repo, and ran:

qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -hda kernel-qemu

Qemu is launching and I see some logs, but after a while it goes down. When I remove -no-reboot option it gets into rebooting loop.

Can you help me
Thanks

4.9.35 kernel

Please, add 4.9.35 kernel.

I am running the latest available:

uname -r
4.4.34+

But i am not able to load modules (ipv6 as example):

modprobe ipv6
modprobe: ERROR: ../libkmod/libkmod.c:557 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.34+/modules.dep.bin'

Quick inspection tells:

ls -1 /lib/modules/
4.9.35+
4.9.35-v7+

dpkg -S /lib/modules/4.9.35+
raspberrypi-kernel: /lib/modules/4.9.35+

apt-cache policy raspberrypi-kernel
raspberrypi-kernel:
  Installed: 1.20170703-1
  Candidate: 1.20170703-1
  Version table:
 *** 1.20170703-1 0
        500 http://archive.raspberrypi.org/debian/ jessie/main armhf Packages
        100 /var/lib/dpkg/status

thanks

Error when trying to run a raspberry pi kernel on a versatilepb QEMU machine

Hey,
A little new to this, so I might be doing something newbishly wrong:

When I run this:

/usr/bin/qemu-system-arm -kernel ./kernel-qemu-4.1.7-jessie -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append 'root=/dev/sda2 panic=1 rootfstype=ext4 rw' -hda ./2017-07-05-raspbian-jessie-lite.img -redir tcp:5022::22

I get this:

qemu-system-arm: Trying to execute code outside RAM or ROM at 0x10000000
This usually means one of the following happened:

(1) You told QEMU to execute a kernel for the wrong machine type, and it crashed on startup (eg trying to run a raspberry pi kernel on a versatilepb QEMU machine)
(2) You didn't give QEMU a kernel or BIOS filename at all, and QEMU executed a ROM full of no-op instructions until it fell off the end
(3) Your guest kernel has a bug and crashed by jumping off into nowhere

It actually says "eg trying to run a raspberry pi kernel on a versatilepb QEMU machine", what machine should I use?

(Command taken from: https://gist.github.com/hfreire/5846b7aa4ac9209699ba )

Outdated for 4.1.18

Hello, thanks for the great archeology work! :o)

I've followed the build script for current Linux 4.1.18 version and apparently, the script and patch are outdated:

git checkout 77798915750db46f10bb449e1625d6368ea42e25
fatal: reference is not a tree: 77798915750db46f10bb449e1625d6368ea42e25

The patch did not apply fully and some other tweak is needed for the MMC BCM2835 driver.

See https://github.com/robajz/qemu-rpi-kernel for changes that got me through it.

Kind regards, Rob

Kernel Panic Unable to mount root fs on unknown-block(31,3)

Using the latest qemu:
qemu-system-arm.exe -kernel C:\Users\a\Downloads\kernel-qemu-4.4.34-jessie -cpu arm1176 -m 256 -machine versatilepb -cdrom C:\Users\a\Downloads\picore-9.0.3.img

Gives error:
Kernel Panic Unable to mount root fs on unknown-block(31,3)
qemu-panic-vfs-31-3

I have tried different images/kernels with the same result.

qemu locks up

qemu seem to lock up mid way thought boot up when trying to boot 2017-04-10-raspbian-jessie

Overwriting .config

Is the sequence in build-kernel-qemu correct?

You append some custom parameters to .config but then you run:

make -j 4 -k ARCH=arm CROSS_COMPILE=${TOOLCHAIN}- menuconfig

which overwrites this file and removes most of those values. Should that order be reversed? Why are you appending those parameters if they're just being removed?

Also, I see you're using the arm-linux-gnueabihf toolchain, but the archived "compiling-a-kernel" article uses arm-linux-gnueabihf- making explicit note to "not forget the '-' at the end of this string". Does this matter?

Also, when I run:

make -j 4 -k ARCH=arm CROSS_COMPILE=${TOOLCHAIN}- bzImage

it prompts me a thousand times for N/m/y/? for various options. How do I disable this?

Do you plan to release a kernel for the new debian stretch ?

I tried to modify the script to accomodate the new kernel, however I didn't find the solution.

Raspbian version I am using:

wget http://director.downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-12-01/2017-11-29-raspbian-stretch-lite.zip

Commit of the raspbian linux kernel (accordingly to a forum post is the one released with the stable raspbian):

raspberrypi-kernel_1.20170811-1

The kernel has been patched accordingly to the previous patch (note the new file is compliant with the specified new kernel). You can download the patch file: new_kernel_patch.txt

The kernel is built successfully.

Using the script in your repo, the image is "formatted" [a few files are modifiled].

When executed, yields to the following command:

qemu-system-arm -kernel qemu-kernel-4.9.41-cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 rootfstype=ext4 rw" -hda formatted_2017-11-29-raspbian-stretch-lite.img

Qemu boots, and

WARNING: Image format was not specified for 'formatted_2017-11-29-raspbian-stretch-lite.img' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument
Uncompressing Linux... done, booting the kernel.

Error: unrecognized/unsupported processor variant (0x410fb767).WARNING: Image format was not specified for 'formatted_2017-11-29-raspbian-stretch-lite.img' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument
Uncompressing Linux... done, booting the kernel.

Error: unrecognized/unsupported processor variant (0x410fb767).

Any ideas?

linux-arm.patch mismatched with build-kernel-qemu

Trying to run build-kernel-qemu to manually build the kernel from the source fails with the following:

$ ./build-kernel-qemu 
Cloning into 'linux'...
remote: Counting objects: 5889381, done.
remote: Compressing objects: 100% (40/40), done.
Receiving objects: 100% (5889381/5889381), 1.64 GiB | 4.40 MiB/s, done.
remote: Total 5889381 (delta 19), reused 8 (delta 5), pack-reused 5889336
Resolving deltas: 100% (4901848/4901848), done.
Checking connectivity... done.
Checking out files: 100% (56775/56775), done.
patching file arch/arm/mach-versatile/Kconfig
Hunk #1 FAILED at 4.
Hunk #2 FAILED at 12.
2 out of 2 hunks FAILED -- saving rejects to file arch/arm/mach-versatile/Kconfig.rej
patching file arch/arm/mm/Kconfig
Hunk #1 FAILED at 71.
Hunk #2 FAILED at 89.
Hunk #3 FAILED at 127.
Hunk #5 FAILED at 359.
4 out of 5 hunks FAILED -- saving rejects to file arch/arm/mm/Kconfig.rej
patching file drivers/mmc/host/Kconfig
Hunk #1 FAILED at 6.
1 out of 1 hunk FAILED -- saving rejects to file drivers/mmc/host/Kconfig.rej

It appears that the linux-arm.patch file is out-of-sync with the build-kernel-qemu . Is there a newer patch file that didn't get committed with the build script? It would seem that since the script explicitly states which commit to checkout then the patch file it would be using should match the code it's trying to patch. Or am I missing something?

Updating the jessie image with Linux in VirtualBox

I had downloaded the jessie image on my windows system. I then wanted wanted to follow the instructions supplied to update the jessie image in my Linux system installed in VirtualBox on my Windows machine. I used the "shared directory" feature of VirtualBox to try to mount the image. This failed repeatedly. The solution was to copy the image-file from the shared directory to a directory within the Linux machine. I could then mount the image without any problem.

I hope this helps someone else

David Singleton

How to debug Illegal instruction errors beyond etc/ld.so.preload?

Hey,
So this is half a question really. Half trying to figure if I missed something?

I am from the Zynthian project, and I am trying to build an emulation solution for the image distro there.

The distro boots fine with my qemu_boot.sh script. But when I try and run a python script that imports tornado, I get an instruction error.

How would I debug this? Is there a way to track down what library is doing this?

Its a script that basically unzips an image and runs:

sed -i 's@/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so@\#/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so@' etc/ld.so.preload
sed -i 's@/usr/lib/arm-linux-gnueabihf/libarmmem.so@\#/usr/lib/arm-linux-gnueabihf/libarmmem.so@' etc/ld.so.preload

and

sed -e '/PARTUUID/ s/^#*/#/' -i etc/fstab

Then it downloads and runs the most current kernel-qemu-4.4.34-jessie kernel.

In the image. It works great for all my other projects.

What is meant by emulating rpi on qemu

This probably is a very dumb question, but nevertheless I do ask it here. What exactly is meant by emulating rpi-kernel on qemu. Is it any different from emulating ARM ISA using qemu. Does qemu emulation, by any chance, also emulate the Rasberry Pi's BCM2835 board i.e. does it emulate the peripheral devices, memory mapped I/O registers etc.

MagTek USB Card Scanner Driver

Hi!
I'm looking to get working RPI2 posbox with MagTek.

cat /etc/rpi-issue 
Raspberry Pi reference 2016-09-23
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 62406bad92ed23728f46711b3539c04c37dfb62c, stage2

lsmod
Module                  Size  Used by
bnep                   10340  2 
hci_uart               17943  1 
btbcm                   5929  1 hci_uart
bluetooth             326105  22 bnep,btbcm,hci_uart
brcmfmac              186339  0 
brcmutil                5661  1 brcmfmac
cfg80211              427855  1 brcmfmac
rfkill                 16037  4 cfg80211,bluetooth
snd_bcm2835            20447  0 
snd_pcm                75762  1 snd_bcm2835
snd_timer              19288  1 snd_pcm
snd                    51908  3 snd_bcm2835,snd_timer,snd_pcm
bcm2835_gpiomem         3040  0 
bcm2835_wdt             3225  0 
usblp                  10482  0 
uio_pdrv_genirq         3164  0 
uio                     8000  1 uio_pdrv_genirq
ipv6                  347530  44

lsusb
Bus 001 Device 005: ID 0801:0011 MagTeK

It won't work.
Any advice of how to trouble shoot?

reboot with Jessie

Looks like there's a kernel crash with the 2015-09-24 Jessie. the boot sequence reboots.

CONFIG_FHANDLE=y missing

With jessie, boot fails if you have additional mountpoints in /etc/fstab. This seems to be related to a number of kernel-config parameters which systemd needs but your kernel does not provide, especially CONFIG_FHANDLE.

Note this is not a qemu/raspbian specific issue, see http://forums.debian.net/viewtopic.php?f=10&t=118828 for a discussion and additional links (at the bottom of the page).

I'm happy to test a new kernel with (at least) CONFIG_FHANDLE=y, but I currently don't have the time to setup a cross-compile environment for my own kernel.

Bernhard

Kernel to run armv7 compiled programs

Hey,
I have a raspberrypi Image with lots of armv7 programs, but the kernel here is armv6.
Is there a way to run armv7 programs/ build a kernel for armv7?

Thanks,

Support for IPv6 ?

Hi there,

this is some awesome work here and I'm very glad to be able to emulate a RaspberryPi thanks to Qemu and these kernels ๐Ÿ‘ !

However I noticed that for my application, I need ipv6 enabled. Currently, loading the ipv6 module fails during boot an I get messages such as :

ipv6: version magic '4.4.34+ mod_unload modversions ARMv6 ' should be '4.4.34+ mod_unload ARMv6 p2v8 '

I'm a huge noob when it comes to kernels, but somehow this sounds related to the IPv6 flags not being set here ?

Would that be easy to include the flags in the next kernels, or do I definitely need to recompile it on my side ? ๐Ÿ˜•

Raspberry Pi Serial Console

Is it possible to get the Raspberry Pi serial console redirected to stdio?

I've tried adding -serial stdio to the qemu command line and console=ttyS0 and console=ttyAMA0 to the kernel command line but with no success - no error message or anything, just no output on stdio.

Unable to access GUI

Thank you very much for your efforts . I have a small issue while installing the QEMU PI , actually it gets launched be the following command and I get the welcome screen and all :

qemu-system-arm -kernel ~/qemu_vms/qemu-rpi-kernel/kernel-qemu-4.4.21-jessie -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 rootfstype=ext4 rw" -hda ~/qemu_vms/2017-04-10-raspbian-jessie.img -redir tcp:5022::22 -no-reboot`

but I cannot move the mouse inside
or the arrow buttons doesn't work either.
I highly appreciate your help on this. I am trying to learn ARM processor coding but this is a small bump that I am unable to bypass.

Can't boot kernel built using build-kernel-qemu

Using a raspbian-ua-netinst-v1.0.8.1.img, I can boot using both kernel-qemu-4.1.7-jessie and kernel-qemu-4.1.13-jessie which is awesome. Unfortunately, after install is finished, systemd has trouble with dev-sda1.device and dev-ttyAMA0.device; presumably due to 'CONFIG_FHANDLE is not set'. So I modified build-kernel-qemu to include 'CONFIG_FHANDLE=y' and rebuilt the kernel. Unfortunately, on boot I get:

Error: unrecognized/unsupported processor variant (0x410fb767).

I get the same error if I try to build without modifications.

Is this the script that was actually used to build kernel-qemu-4.1.7-jessie and qemu-4.1.13-jessie? If so, does anyone has a .config I can borrow to compare against?

Boot silently fails

Using an Ubuntu ARM, step 1 from the wiki doesn't seem to do anything. I'm running:

qemu-system-arm -kernel kernel-qemu-4.1.13-jessie \
            -cpu arm1176 \
            -m 256 \
            -M versatilepb \
            -no-reboot \
            -serial stdio \
            -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" \
            -hda 2015-04-06-ubuntu-trusty.img

A window pops up showing the Linux boot screen, and my localhost terminal shows:

pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument
Uncompressing Linux... done, booting the kernel.

but then the popup window closes and qemu seems to exit without any further errors. Is this correct?

Networking

If I follow this instructions on the wiki, I get working NAT-based networking.

As soon as I try to introduce a bridged network, I can't get anything to work. I'm adding eg:

-netdev tap,helper=/usr/lib/qemu/qemu-bridge-helper,id=hn0 -device e1000,netdev=hn0,id=nic1

This boots but there is no network device. I've tried virtio-net-pci with the same result. virtio-net-device and usb-net both give error messages about their respective busses not being present.

How can we explicitly configure networking?

How to start the X11 GUI? Stuck on "No session for pid <PID>."

I've managed to login on a shell after reading the wiki: https://github.com/dhruvvyas90/qemu-rpi-kernel/wiki/Emulating-Jessie-image-with-4.x.xx-kernel as in http://raspberrypi.stackexchange.com/questions/165/emulation-on-a-linux-pc/53991#53991 , thanks!

How to get the GUI working now?

I've tried: startx, and it does start and show the GUI, but everything is frozen and there is a popup saying: No session for pid <PID>.

Ubuntu 16.04 host, Raspbian Jessie 2016-05.

screenshot from 2016-08-25 19-34-06 rpi no session for pid

Newer stable kernel 4.9

Hi

Latest Raspbian Stretch came out, featuring kernel 4.9.41

Any plans to share that kernel build? ( I see in #30 that you were waiting for the official Raspbian release )

Many thanks for your work

build-kernel-qemu fails to build a running 4.4.11 kernel

Hi,

when I try to build a kernel for raspberrypi-kernel-20160620 qemu refuses to start the kernel with:

Error: unrecognized/unsupported processor variant (0x410fb767).

I think there are config options missing in the build script. Do you have the kernel config for the 4.4.12 kernel? thx!

Raspbian Stretch : illegal instruction

Hi,
I am trying to build a cross-compilation environment for raspberry pi with travis.
My work is based on Odoo's scripts that uses your kernels (from here).
When using Raspbian Jessie, it works just fine. (source and result).

But when using Raspbian Stretch, I have many errors : subprocess installed post-installation script was killed by signal (Illegal instruction). The logs.

Maybe you have a clue for this ?

wiki: error about disk image format

Regarding the wiki, I encountered this error when specifying the image with:

-hda posbox.img

WARNING: Image format was not specified for 'posbox.img' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions.

I had to use this instead as per the qemu manual:

-drive file=posbox.img,index=0,media=disk,format=raw

minor update to README requested

In the README below at the end you mention: "Go through wiki page for step by step guide..." Can you provide a link to the wiki page? I am not sure where it is as I ahve just found qemu-rpi-kernel. Thanks!

Unable to Boot R Pi Jessie in QEMU

I am trying to run Raspbian Jessie in Ubuntu 16.04 using QEMU Emulator.

The Configuration file has the following content.

#!/bin/bash
#Starts raspberry pi image in configuration mode
qemu-system-arm -kernel ./qemu-rpi-kernel/kernel-qemu-4.4.34-jessie /-cpu arm1176 /m 256 /M versatilepb /no-reboot /serial stdio /append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -hda rpiJessie.img

When the config file is made to run it shows the following

screenshot`from 2017-04-21 16-14-00

I have done what I could. But, still no solution.

How can I use -M raspi2 with this kernel?

I do not know if I should use the kernel7.img or the kernel image from this repo, but I tried many times with no success

.\bin\qemu-system-armw -M raspi2 -kernel kernel-qemu-4.4.34-jessie -hda rasp.qcow -append "rw earlyprintk dwc_otg.lpm_enable=0 root=/dev/sda2 init=/bin/sh" -dtb bcm2709-rpi-2-b.dtb -usbdevice mouse -usbdevice keyboard -serial stdio
.\bin\qemu-system-armw -M raspi2 -kernel kernel7.img -sd rasp.qcow -append "rw earlyprintk console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 nomodeset init=/bin/sh" -dtb bcm2709-rpi-2-b.dtb -usbdevice mouse -usbdevice keyboard -serial stdio

QEMU CIFS

Greetings,
I would like to start by thanking you for your efforts. I was able to get my rpi img to work however, I was not able to get cifs to work due to the fact that it was not compiled into the kernel. I tried to manually add the CIFS to the kernel with the ncurses menu. In the ncurses menu I did load the config file. I don't know if that was right. After the ncurses menu I am prompted with hundreds of questions. The resulting kernel does not work. I think the reason that it does not work is the fact that I have no idea what I am doing. Would you be able to write an instruction sheet on how to do this properly? Would it be possible to include CIFS in future? Also one small note, the build script was not working so I commented out the exit above the make section. I'm not sure if I was doing it correctly.

Unable to copy device tree in memory. Couldn't open dtb file versatile-pb.dtb

Hi,
Thank you for this repo!

However, on my Debian 9.5 machine with Qemu 3.1.0, the following does not work:

qemu-system-arm \
  -M versatilepb \
  -cpu arm1176 \
  -m 256 \
  -hda 2018-11-13-raspbian-stretch-lite.img \
  -net nic \
  -net user,hostfwd=tcp::5022-:22 \
  -dtb versatile-pb.dtb \
  -kernel kernel-qemu-4.14.79-stretch \
  -append 'root=/dev/sda2 panic=1' \
  -no-reboot

It fails with the following output:

WARNING: Image format was not specified for '2018-11-13-raspbian-stretch-lite.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
audio: Could not init `oss' audio driver
qemu-system-arm: Unable to copy device tree in memory
Couldn't open dtb file versatile-pb.dtb

If I leave out the -dtb parameter, then the output changes to:

WARNING: Image format was not specified for '2018-11-13-raspbian-stretch-lite.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
audio: Could not init `oss' audio driver
VNC server running on ::1:5900

But nothing happens there either.
What am I missing here?
Thanks again!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.