LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-06-2020, 11:13 PM   #1
skubik
Member
 
Registered: May 2003
Location: A dark corner in Canada
Distribution: Slackware64 15.0/current
Posts: 152

Rep: Reputation: 21
Qemu 5.0.0 alien build crashes trying to boot Raspbian-Buster as a RPi3


Hi all,
As the subject suggests, I am trying to use Alien's slackbuild script to build & install Qemu 5.0.0 on my slackware-sorta-current machine (I painstakingly updated only what I needed to build qemu instead of doing a complete update to -current because of reasons involving not risking breaking some existing things on this machine; I know this may be dumb and possibly part of my issue).

Qemu builds and installs fine.
My problem is trying to run it to emulate a Raspberry Pi 3 to run Raspbian (or rather RaspberryOS) Buster to do some setup on it before running it on an actual RPi3.

I've tried various instructions I've found online about how to accomplish this but most (all) fail at some point.
In my most 'successful' attempts it seems like it begins to boot but then qemu itself aborts with this error:

Code:
TODO /tmp/build/tmp-qemu/qemu-5.0.0/tcg/tci.c:597: tcg_qemu_tb_exec()                                                                                                                       
/tmp/build/tmp-qemu/qemu-5.0.0/tcg/tci.c:597: tcg fatal error
A quick search online doesn't result in anything spectacular; posts as old as 10 years pop up with very non-specific explanations about 'hacky' fixes or patches for old versions.

Has anyone else encountered this, or can direct me to what I should be trying?

Thanks!
 
Old 08-07-2020, 11:49 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,297

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
With Raspbian, you'll have a debian 32 bit soft float OS running on a 64bit A-53 Cortex Arm capable of running hard float operations.

Personally, I would give up. There is no easier OS to set up on a RazPi. Skip emulating. Just dd the image accross. Raspbian, btw is no longer, it's Raspberry Pi OS now. Just dd the image to an sd card, extend the second partition to full size, and boot it. It will bring you into Raspberrypi-config. Set things up there (network, password, video, package update), reboot, and you're done.
OTOH, dd'ing an image to 2 partitions is a nightmare.
 
Old 08-07-2020, 01:22 PM   #3
skubik
Member
 
Registered: May 2003
Location: A dark corner in Canada
Distribution: Slackware64 15.0/current
Posts: 152

Original Poster
Rep: Reputation: 21
So how then do these tutorials that I've been following seem to get it working?

Giving up on getting qemu to work significantly increases my workload by having to do it on physical hardware. I'm not looking for performance here; I just need to get in so I can do some updates and customization before deploying it to several (headless) Pi's.
 
Old 08-08-2020, 04:23 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,297

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
If the tutorials you're following seem to get it working, why not post the tutorial, along with your results, highlighting the point where things go off the rails?

To use qemu. You are faced with getting an unbootable binary image to boot, which is a powerful reason imho not to virtualize it.Booting a Pi is an awkward business. The images write 2 partitions (1 FAT, 1 ext4) and provide an fdisk type partition table overwriting any existing table. The boot process loads firmwares, sets up video and a ram/video ram split. You can't use grub or lilo. But knock yourself out.
 
Old 08-10-2020, 11:07 PM   #5
skubik
Member
 
Registered: May 2003
Location: A dark corner in Canada
Distribution: Slackware64 15.0/current
Posts: 152

Original Poster
Rep: Reputation: 21
Okay, so I decided to review what I've been doing, try a few different things, and come back with details as suggested.

The short story is I've come across a handful of tutorials and forum posts online to help guide me. I've tried them all verbatim and I've tried variations of them to try and get something that at least starts to work.
My apologies if it's against board rules to post links to other forums (stackexchange).
https://azeria-labs.com/emulate-raspberry-pi-with-qemu/
https://blog.agchapman.com/using-qem...-raspberry-pi/
https://github.com/dhruvvyas90/qemu-rpi-kernel
https://raspberrypi.stackexchange.co...u-kernel-panic
https://raspberrypi.stackexchange.co...ster-with-qemu
https://github.com/wimvanderbauwhede...y-Pi-3-on-QEMU

I've extracted the kernel and dtb files from the Raspbian-Buster image, as was described in a few of the above-mentioned posts.
I extracted kernel8.img and bcm2710-rpi-3-b.dtb; I could not find an initrd.img as suggested in the last link, nor did I extract cmdline.txt.

I also modified the fstab file to ensure that 'sda2' is used for root instead of the default. The only other entry is for proc. References to the /boot partition have been commented-out since we are providing the kernel and dtb files to Qemu.


The command I've pieced together that I've had the most success with is:
Code:
qemu-system-aarch64     
   -kernel ./kernel8.img 
   -dtb ./bcm2710-rpi-3-b.dtb     
   -M raspi3 
   -m 1024     
   -serial mon:stdio     
   -append "rw console=ttyAMA0 loglevel=8 root=/dev/sda2 fsck.repair=yes rootwait memtest=1"     
   -drive file=./RPi-Buster-Base.img,format=raw,id=sd     
   -no-reboot
   -nographic

Qemu actually starts booting, and produces the following output:
Code:
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 4.19.118-v8+ (dom@buildbot) (gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9)) #1311 SMP PREEMPT Mon Apr 27 14:32:38 BST 2020
[    0.000000] Machine model: Raspberry Pi 3 Model B
[    0.000000] efi: Getting EFI parameters from FDT:
[    0.000000] efi: UEFI not found.
[    0.000000] cma: Reserved 8 MiB at 0x000000003b800000
[    0.000000] On node 0 totalpages: 245760
[    0.000000]   DMA32 zone: 3840 pages used for memmap
[    0.000000]   DMA32 zone: 0 pages reserved
[    0.000000]   DMA32 zone: 245760 pages, LIFO batch:63
[    0.000000] random: get_random_bytes called from start_kernel+0xb8/0x47c with crng_init=0
[    0.000000] percpu: Embedded 24 pages/cpu s58840 r8192 d31272 u98304
[    0.000000] pcpu-alloc: s58840 r8192 d31272 u98304 alloc=24*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: enabling workaround for ARM erratum 843419
[    0.000000] CPU features: enabling workaround for ARM erratum 845719
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 241920
[    0.000000] Kernel command line: rw console=ttyAMA0 loglevel=8 root=/dev/sda2 fsck.repair=yes rootwait memtest=1
[    0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes)
[    0.000000] Memory: 941344K/983040K available (8700K kernel code, 1074K rwdata, 2760K rodata, 1024K init, 1126K bss, 33504K reserved, 8192K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] ftrace: allocating 30496 entries in 120 pages
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=4.
[    0.000000]  Tasks RCU enabled.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] arch_timer: cp15 timer(s) running at 62.50MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1cd42e208c, max_idle_ns: 881590405314 ns
[    0.000353] sched_clock: 56 bits at 62MHz, resolution 16ns, wraps every 4398046511096ns
[    0.040015] Console: colour dummy device 80x25
[    0.050535] Calibrating delay loop (skipped), value calculated using timer frequency.. 125.00 BogoMIPS (lpj=250000)
[    0.051326] pid_max: default: 32768 minimum: 301
[    0.074663] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes)
[    0.075273] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes)
[    0.315969] ASID allocator initialised with 32768 entries
[    0.330763] rcu: Hierarchical SRCU implementation.
[    0.412209] EFI services will not be available.
[    0.440459] smp: Bringing up secondary CPUs ...
[    0.506015] Detected VIPT I-cache on CPU1
[    0.507623] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.593310] Detected VIPT I-cache on CPU2
[    0.594357] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[    0.664792] Detected VIPT I-cache on CPU3
[    0.665720] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[    0.673127] smp: Brought up 1 node, 4 CPUs
[    0.675979] SMP: Total of 4 processors activated.
[    0.677409] CPU features: detected: 32-bit EL0 Support
[    0.734609] CPU: All CPU(s) started at EL2
[    0.751302] alternatives: patching kernel code
[    0.837348] devtmpfs: initialized
[    1.260552] Enabled cp15_barrier support
[    1.264654] Enabled setend support
[    1.284013] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    1.285067] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    1.316140] pinctrl core: initialized pinctrl subsystem
[    1.355398] DMI not present or invalid.
[    1.380786] NET: Registered protocol family 16
[    1.569590] cpuidle: using governor menu
[    1.585188] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    1.719970] DMA: preallocated 256 KiB pool for atomic allocations
[    1.725276] Serial: AMBA PL011 UART driver
[    1.879936] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[    2.025787] raspberrypi-firmware soc:firmware: Attached to firmware from 1970-01-05 00:12, variant unknown
[    2.029038] raspberrypi-firmware soc:firmware: Firmware hash is 080238f0ffffff80085f523cffffff8039837810
[    3.147647] bcm2835-dma 3f007000.dma: DMA legacy API manager at (____ptrval____), dmachans=0x1
[    3.275399] vgaarb: loaded
[    3.292103] SCSI subsystem initialized
[    3.301179] usbcore: registered new interface driver usbfs
[    3.303992] usbcore: registered new interface driver hub
[    3.306908] usbcore: registered new device driver usb
[    3.311022] pps_core: LinuxPPS API ver. 1 registered
[    3.311476] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    3.312816] PTP clock support registered
[    3.399070] clocksource: Switched to clocksource arch_sys_counter
[    6.465618] VFS: Disk quotas dquot_6.6.0
[    6.467882] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    6.472468] FS-Cache: Loaded
[    6.477460] CacheFiles: Loaded
[    6.967205] NET: Registered protocol family 2
[    7.003727] tcp_listen_portaddr_hash hash table entries: 512 (order: 1, 8192 bytes)
[    7.005755] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
[    7.009637] TCP bind hash table entries: 8192 (order: 5, 131072 bytes)
[    7.013629] TCP: Hash tables configured (established 8192 bind 8192)
[    7.019703] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    7.023885] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    7.037723] NET: Registered protocol family 1
[    7.073450] RPC: Registered named UNIX socket transport module.
[    7.073927] RPC: Registered udp transport module.
[    7.074329] RPC: Registered tcp transport module.
[    7.074724] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    7.075385] PCI: CLS 0 bytes, default 64
[    7.149693] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 5 counters available
[    7.155774] kvm [1]: 8-bit VMID
[    7.193024] kvm [1]: Hyp mode initialized successfully
[    7.323318] Initialise system trusted keyrings
[    7.332539] workingset: timestamp_bits=46 max_order=18 bucket_order=0
[    7.642626] FS-Cache: Netfs 'nfs' registered for caching
[    7.668759] NFS: Registering the id_resolver key type
[    7.669692] Key type id_resolver registered
[    7.670115] Key type id_legacy registered
[    7.670904] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    8.025873] Key type asymmetric registered
[    8.026609] Asymmetric key parser 'x509' registered
[    8.030274] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 248)
[    8.043336] io scheduler noop registered
[    8.043901] io scheduler deadline registered
[    8.050301] io scheduler cfq registered (default)
[    8.050800] io scheduler mq-deadline registered
[    8.051260] io scheduler kyber registered
[    8.157642] brcmvirt-gpio soc:virtgpio: Failed to set gpiovirtbuf, trying to get err:0
[    8.159631] ------------[ cut here ]------------
[    8.162128] WARNING: CPU: 2 PID: 1 at arch/arm64/mm/ioremap.c:58 __ioremap_caller+0xc4/0xf8
[    8.162517] Modules linked in:
[    8.163285] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.19.118-v8+ #1311
[    8.163575] Hardware name: Raspberry Pi 3 Model B (DT)
[    8.164155] pstate: 80000005 (Nzcv daif -PAN -UAO)
[    8.164560] pc : __ioremap_caller+0xc4/0xf8
[    8.164944] lr : __ioremap_caller+0xc4/0xf8
[    8.165238] sp : ffffff8008023ae0
[    8.165564] x29: ffffff8008023ae0 x28: ffffff8008cab944 
[    8.166070] x27: ffffff8008bc06ac x26: 00000000fb840000 
[    8.166534] x25: ffffff800803d000 x24: ffffff8008907010 
[    8.166996] x23: 0068000000000707 x22: ffffff800853fa74 
[    8.167455] x21: 0000000000000000 x20: 000000003b840000 
[    8.167911] x19: 0000000000001000 x18: ffffff8008cc8688 
[    8.168375] x17: 0000000000000000 x16: 0000000000000000 
[    8.168838] x15: ffffff8088dd664f x14: 0000000000000006 
[    8.169303] x13: ffffff8008dd665d x12: 74202c6675627472 
[    8.169772] x11: ffffff8008ce0000 x10: 0000000005f5e0ff 
[    8.170263] x9 : ffffff80080237c0 x8 : 0000000000000000 
[    8.170723] x7 : ffffff8008cc8688 x6 : ffffff8008cc8000 
[    8.171204] x5 : ffffff8008cc8e00 x4 : ffffff80081349d4 
[    8.171668] x3 : ffffff80080238d0 x2 : f81c012058f1d700 
[    8.172129] x1 : 0000000000000000 x0 : 0000000000000024 
[    8.172812] Call trace:
[    8.173246]  __ioremap_caller+0xc4/0xf8
[    8.173631]  __ioremap+0x3c/0x50
[    8.174037]  brcmvirt_gpio_probe+0x2e4/0x480
[    8.174431]  platform_drv_probe+0x54/0xb0
[    8.174803]  really_probe+0x208/0x2d8
[    8.175181]  driver_probe_device+0x60/0x108
[    8.175557]  __driver_attach+0x104/0x108
[    8.175921]  bus_for_each_dev+0x78/0xe0
[    8.176291]  driver_attach+0x30/0x40
[    8.176660]  bus_add_driver+0x1d0/0x238
[    8.177035]  driver_register+0x68/0x118
[    8.177429]  __platform_driver_register+0x54/0x60
[    8.177827]  brcmvirt_gpio_driver_init+0x20/0x28
[    8.178201]  do_one_initcall+0x54/0x250
[    8.178571]  kernel_init_freeable+0x2a4/0x3c0
[    8.178964]  kernel_init+0x18/0x110
[    8.179336]  ret_from_fork+0x10/0x18
[    8.179845] ---[ end trace 1fd3d7f142bacaef ]---
[    8.181775] brcmvirt-gpio soc:virtgpio: Failed to map physical address
[    8.182611] brcmvirt-gpio: probe of soc:virtgpio failed with error -2
[    8.203476] bcm2708_fb soc:fb: More displays reported from firmware than supported in driver (4294967168 vs 3)
[    8.204893] bcm2708_fb soc:fb: FB found 3 display(s)
[    8.348831] Console: switching to colour frame buffer device 100x30
[    8.447917] bcm2708_fb soc:fb: Registered framebuffer for display 0, size 800x480
[    8.469560] bcm2708_fb soc:fb: Registered framebuffer for display 1, size 800x480
[    8.479721] bcm2708_fb soc:fb: Registered framebuffer for display 2, size 800x480
[    8.627202] bcm2835-rng 3f104000.rng: hwrng registered
[    8.642957] vc-mem: phys_addr:0x00000000 mem_base=0x00000000 mem_size:0x00000000(0 MiB)
[    8.681152] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[    8.692475] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    9.134347] brd: module loaded
[    9.486379] loop: module loaded
[    9.501923] bcm2835-power bcm2835-power: ASB register ID returned 0x00000000
[    9.509959] Loading iSCSI transport class v2.0-870.
[    9.581005] libphy: Fixed MDIO Bus: probed
[    9.592602] usbcore: registered new interface driver r8152
[    9.594294] usbcore: registered new interface driver lan78xx
[    9.595944] usbcore: registered new interface driver smsc95xx
[    9.609425] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    9.619152] dwc_otg 3f980000.usb: base=(____ptrval____)
[    9.829513] Core Release: 0.000
[    9.830385] Setting default values for core params
[    9.833998] Finished setting default values for core params
[    9.834868] dwc_otg 3f980000.usb: Bad value for SNPSID: 0x00000000
[    9.837862] dwc_otg: probe of 3f980000.usb failed with error -22
[    9.842124] dwc_otg: FIQ enabled
[    9.842516] dwc_otg: NAK holdoff enabled
[    9.842903] dwc_otg: FIQ split-transaction FSM enabled
[    9.843389] Module dwc_common_port init
[    9.850724] usbcore: registered new interface driver uas
[    9.854280] usbcore: registered new interface driver usb-storage
[    9.863213] mousedev: PS/2 mouse device common for all mice
[    9.912804] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[    9.965631] sdhci: Secure Digital Host Controller Interface driver
[    9.966032] sdhci: Copyright(c) Pierre Ossman
[    9.985344] mmc-bcm2835 3f300000.mmcnr: could not get clk, deferring probe
[   10.014597] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe
[   10.021211] sdhci-pltfm: SDHCI platform and OF driver helper
[   10.085667] ledtrig-cpu: registered to indicate activity on CPUs
[   10.091166] hidraw: raw HID events driver (C) Jiri Kosina
[   10.095707] usbcore: registered new interface driver usbhid
[   10.096770] usbhid: USB HID core driver
[   10.126590] vchiq: vchiq_init_state: slot_zero = (____ptrval____), is_master = 0
[   10.158152] bcm2835_vchiq 3f00b840.mailbox: failed to set channelbase
[   10.158628] vchiq: could not load vchiq
[   10.174191] Initializing XFRM netlink socket
[   10.175456] NET: Registered protocol family 17
[   10.179518] Key type dns_resolver registered
[   10.211896] registered taskstats version 1
[   10.213047] Loading compiled-in X.509 certificates
[   10.352906] bcm2835-clk 3f101000.cprman: plla: couldn't lock PLL
[   10.637110] uart-pl011 3f201000.serial: cts_event_workaround enabled
[   10.640030] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 66, base_baud = 0) is a PL011 rev2
[   10.642813] ------------[ cut here ]------------
[   10.644633] WARNING: CPU: 0 PID: 36 at drivers/tty/serial/serial_core.c:467 uart_get_baud_rate+0xec/0x1a0
[   10.644928] Modules linked in:
[   10.645496] CPU: 0 PID: 36 Comm: kworker/0:1 Tainted: G        W         4.19.118-v8+ #1311
[   10.645814] Hardware name: Raspberry Pi 3 Model B (DT)
[   10.646566] Workqueue: events deferred_probe_work_func
[   10.647036] pstate: 80000005 (Nzcv daif -PAN -UAO)
[   10.647426] pc : uart_get_baud_rate+0xec/0x1a0
[   10.647808] lr : uart_get_baud_rate+0xec/0x1a0
[   10.648108] sp : ffffff8008fc3880
[   10.648416] x29: ffffff8008fc3880 x28: ffffffc0391a5280 
[   10.648892] x27: 0000000000000000 x26: 00000000ffffffff 
[   10.649367] x25: 0000000000009600 x24: 0000000000009600 
[   10.649836] x23: 0000000000000000 x22: 0000000000000001 
[   10.650306] x21: 0000000000000000 x20: ffffff8008fc3988 
[   10.650780] x19: 0000000000000002 x18: ffffff8008cc8688 
[   10.651270] x17: 0000000000000000 x16: 0000000000000000 
[   10.651744] x15: ffffff8088dd664f x14: 0000000000000006 
[   10.652221] x13: ffffff8008dd665d x12: 0000000000000cb0 
[   10.652696] x11: ffffff8008ce0000 x10: 0000000005f5e0ff 
[   10.653173] x9 : ffffff8008fc3560 x8 : 0000000000000000 
[   10.653643] x7 : ffffff8008cc8688 x6 : ffffff8008cc8000 
[   10.654121] x5 : ffffff8008cc8e00 x4 : ffffff80081349d4 
[   10.654598] x3 : ffffff8008fc3670 x2 : f81c012058f1d700 
[   10.655068] x1 : 0000000000000000 x0 : 0000000000000024 
[   10.655513] Call trace:
[   10.655902]  uart_get_baud_rate+0xec/0x1a0
[   10.656297]  pl011_set_termios+0x60/0x398
[   10.656678]  uart_set_options+0x104/0x180
[   10.657050]  pl011_console_setup+0x1f4/0x21c
[   10.657422]  register_console+0x2e4/0x3e0
[   10.657813]  uart_add_one_port+0x454/0x4f0
[   10.658207]  pl011_register_port+0x70/0xe8
[   10.658594]  pl011_probe+0x188/0x1b0
[   10.658979]  amba_probe+0xfc/0x188
[   10.659360]  really_probe+0x208/0x2d8
[   10.659744]  driver_probe_device+0x60/0x108
[   10.660134]  __device_attach_driver+0x98/0xe8
[   10.660509]  bus_for_each_drv+0x80/0xe0
[   10.660889]  __device_attach+0xe8/0x148
[   10.661279]  device_initial_probe+0x24/0x30
[   10.661656]  bus_probe_device+0xa0/0xa8
[   10.662040]  deferred_probe_work_func+0x74/0xa8
[   10.662448]  process_one_work+0x158/0x458
[   10.662845]  worker_thread+0x244/0x460
[   10.663219]  kthread+0x104/0x130
[   10.663598]  ret_from_fork+0x10/0x18
[   10.663916] ---[ end trace 1fd3d7f142bacaf1 ]---
[   10.839155] console [ttyAMA0] enabled
[   10.898874] bcm2835-aux-uart 3f215040.serial: unable to register 8250 port - -28
[   10.901327] bcm2835-aux-uart: probe of 3f215040.serial failed with error -28
[   10.915580] bcm2835_thermal 3f212000.thermal: Clock tsens running at 0 Hz is outside of the recommended range: 1.92 to 5MHz
[   10.919188] bcm2835_thermal 3f212000.thermal: Not able to read trip_temp: -33
[   10.921519] bcm2835_thermal: probe of 3f212000.thermal failed with error -33
[   10.947353] mmc-bcm2835 3f300000.mmcnr: mmc_debug:0 mmc_debug2:0
[   10.948955] mmc-bcm2835 3f300000.mmcnr: DMA channel allocated
[   11.050183] sdhost: log_buf @ (____ptrval____) (fb850000)
[   11.119723] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[   11.151946] of_cfs_init
[   11.158207] of_cfs_init: OK
[   11.191793] uart-pl011 3f201000.serial: no DMA platform data
[   11.193815] ------------[ cut here ]------------
[   11.196003] WARNING: CPU: 2 PID: 1 at drivers/tty/serial/serial_core.c:467 uart_get_baud_rate+0xec/0x1a0
[   11.197041] Modules linked in:
[   11.197786] CPU: 2 PID: 1 Comm: swapper/0 Tainted: G        W         4.19.118-v8+ #1311
[   11.198674] Hardware name: Raspberry Pi 3 Model B (DT)
[   11.199450] pstate: 80000005 (Nzcv daif -PAN -UAO)
[   11.200279] pc : uart_get_baud_rate+0xec/0x1a0
[   11.201030] lr : uart_get_baud_rate+0xec/0x1a0
[   11.201722] sp : ffffff80080238a0
[   11.202292] x29: ffffff80080238a0 x28: ffffffc039bd4000 
[   11.203157] x27: 0000000000000000 x26: 00000000ffffffff 
[   11.206462] x25: 0000000000009600 x24: 0000000000009600 
[   11.207323] x23: 0000000000000000 x22: 0000000000000001 
[   11.208491] x21: 0000000000000000 x20: ffffffc039bd4110 
[   11.209370] x19: 0000000000000002 x18: ffffff8008cc8688 
[   11.211309] x17: 0000000000000000 x16: 0000000000000000 
[   11.212027] mmc0: host does not support reading read-only switch, assuming write-enable
[   11.213014] x15: ffffff8088dd664f x14: 0000000000000006 
[   11.213936] x13: ffffff8008dd665d x12: 0000000000000010 
[   11.214815] x11: ffffff8008ce0000 x10: 0000000005f5e0ff 
[   11.215672] x9 : ffffff8008023580 x8 : 0000000000000000 
[   11.216524] x7 : ffffff8008cc8688 x6 : ffffff8008cc8000 
[   11.217381] x5 : ffffff8008cc8e00 x4 : ffffff80081349d4 
[   11.218236] x3 : ffffff8008023690 x2 : f81c012058f1d700 
[   11.219086] x1 : 0000000000000000 x0 : 0000000000000024 
[   11.219911] Call trace:
[   11.220516]  uart_get_baud_rate+0xec/0x1a0
[   11.221223]  pl011_set_termios+0x60/0x398
[   11.221918]  uart_change_speed.isra.3+0x5c/0x120
[   11.222654]  uart_startup.part.9+0x10c/0x268
[   11.223363]  uart_port_activate+0x64/0x98
[   11.224022]  tty_port_open+0x8c/0xf0
[   11.224671]  uart_open+0x2c/0x40
[   11.225300]  tty_open+0x100/0x430
[   11.225940]  chrdev_open+0xb8/0x1c0
[   11.226604]  do_dentry_open+0x200/0x370
[   11.227282]  vfs_open+0x38/0x48
[   11.227895]  path_openat+0x5ac/0xee0
[   11.228540]  do_filp_open+0x84/0x108
[   11.229204]  do_sys_open+0x168/0x230
[   11.229857]  kernel_init_freeable+0x2d0/0x3c0
[   11.230585]  kernel_init+0x18/0x110
[   11.231238]  ret_from_fork+0x10/0x18
[   11.231820] ---[ end trace 1fd3d7f142bacaf2 ]---
[   11.234601] mmc0: Problem switching card into high-speed mode!
[   11.240995] mmc0: new SDHC card at address 4567
[   11.254297] Waiting for root device /dev/sda2...
[   11.310685] mmcblk0: mmc0:4567 QEMU! 29.2 GiB
[   11.453629]  mmcblk0: p1 p2 p3 p4 < p5 p6 p7 >
[   21.196605] mmc1: Timeout waiting for hardware interrupt.
[   31.432814] mmc1: Timeout waiting for hardware interrupt.
...and that's where it sits until I kill the qemu process.

I should point out that the image file I'm providing Qemu is modified from the original downloaded from raspberrypi.org; I blow it up to 32GB, resize the 2nd partition and add a few other partitions.

I hope that helps clarify my problem a bit.
It seems like I'm on the right track but I'm missing something.

TBH I can't recreate the problem I encountered in my original post; I've tinkered with it a bunch since then.

I'd really appreciate any direction anyone might be able to provide to help me figure this out once and for all.

Thanks!
 
Old 08-11-2020, 03:11 PM   #6
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by skubik View Post
My problem is trying to run it to emulate a Raspberry Pi 3 to run Raspbian (or rather RaspberryOS) Buster to do some setup on it before running it on an actual RPi3.
Sorry, no experience with qemu, but wondering why are you not simply installing Slackware ARM on your Raspberry Pi 3 ?
 
Old 08-18-2020, 11:18 PM   #7
skubik
Member
 
Registered: May 2003
Location: A dark corner in Canada
Distribution: Slackware64 15.0/current
Posts: 152

Original Poster
Rep: Reputation: 21
Talking

So after much testing and searching, I've come up with a solution to this problem.
I'll document it here in the event that anyone else encounters this problem.

There are a few things that resulted in success:

- Building Qemu with the --disable-tcg-interpreter flag; Alien's slackbuild script uses the --enable-tcg-interpreter flag (approx line 341 of qemu.SlackBuild script) so this needs to be changed manually. Otherwise you will eventually encounter the 'tcg fatal error' mentioned in my original post.

- Changing /etc/fstab entries for /boot and / to /dev/mmcblk0p1 and /dev/mmcblk0p2, respectively. This is instead of using /dev/sda1 & /dev/sda2, respectively as mentioned in some of the tutorials I posted in a previous post. Also do not use PARTUUID entries.

- Changing root=/dev/mmcblk0p2 in the 'append' line for Qemu itself (see complete command below)

- Note that Raspbian/RaspberrryPiOS's cmdline.txt in /boot provides the initial kernel 'append' used when booting the OS for the first time. It explicitly calls a script (/usr/lib/raspi-config/init_resize.sh) using an init= argument that does some checks and resizes the root filesystem to the available size of the disk/SD card it is installed on. The script also removes itself from the /boot/cmdline.txt file after it has (successfully) run so that it doesn't try and resize the root partition again every time you power on your Pi.
I, however, made additional partitions on my image to my own custom specifications, and upon running init_resize.sh the script started complaining about unsupported partitions, so I tried booting without the script and it booted just fine.
I would probably omit this from Qemu's append line. If run under Qemu, and if successful, it will remove it's invocation from cmdline.txt. As a result, once you flash the image to an SD card and run it on an actual Pi, this script won't be run and won't resize it's root partition to the available size of your SD card.

- Also note that I had previously mounted the image locally and extracted both the kernel and dtb files from /boot and passed them to Qemu.

- Somewhere along my travels I found a post suggesting to comment-out everything in /usr/lib/ld.so.preload, but doing that is what ultimately lead to the 'tcg fatal error' from my original post. I left it un-commented and after rebuilding Qemu with the tcg interpreter disabled, everything ran fine.

My final Qemu command is:
Code:
qemu-system-aarch64 \
    -kernel ./kernel8.img \
    -dtb ./bcm2710-rpi-3-b.dtb \
    -M raspi3 -m 1024 \
    -serial mon:stdio \
    -append \"console=ttyAMA0 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait rw\" \
    -drive file=./raspbian-buster.img,format=raw,id=sd \
    -no-reboot
    -nographic
My /etc/fstab on the Raspbian image is:
Code:
/dev/mmcblk0p1                                  /boot                           vfat    defaults                0       2
/dev/mmcblk0p2                                  /                               ext4    defaults,noatime        0       1

proc                                            /proc                           proc    defaults                0       0

Last edited by skubik; 08-18-2020 at 11:19 PM. Reason: Tweak needed in qemu command (forgot -nographic)
 
  


Reply

Tags
alien, qemu, raspbian, slackware



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
qemu-kvm: iPhone USB passthrough crashes Windows 10 guest on Debian buster TheOneKEA Linux - Virtualization and Cloud 3 07-02-2020 04:01 PM
[SOLVED] After having a successful installation of Debian Buster, Lenovo computer refuses to boot into Debian Buster 10.2 PicardDefendingData Debian 4 12-21-2019 07:51 PM
LXer: Raspbian GNU/Linux upgrade from Stretch to Raspbian Buster 10 LXer Syndicated Linux News 0 07-26-2019 06:12 PM
LXer: Raspbian GNU/Linux upgrade from Wheezy to Raspbian Jessie 8 LXer Syndicated Linux News 1 06-09-2016 12:12 PM
LXer: Set up qemu-kvm-1.0+noroms as spice enabled qemu server vs qemu-kvm-spice on Ubuntu Precise LXer Syndicated Linux News 0 05-26-2012 07:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration