9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] RPi in QEMU
@ 2023-08-26  4:22 Don Bailey
  2023-08-26  9:23 ` Philip Silva via 9fans
  0 siblings, 1 reply; 23+ messages in thread
From: Don Bailey @ 2023-08-26  4:22 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 470 bytes --]

Has anyone gotten Miller's RPI image to boot in QEMU? I'm trying to use -M
raspi1, raspi2, and versatilepb, but nothing boots. I'm using the 9pi
kernel image (both 9pi2 and 9pi4) from contrib and -hda ./9pi.img. Any
advice?

Thanks,
D

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-Mcc569f919c8de1a05a13d987
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1000 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-08-26  4:22 [9fans] RPi in QEMU Don Bailey
@ 2023-08-26  9:23 ` Philip Silva via 9fans
  2023-08-26 11:39   ` hiro
  0 siblings, 1 reply; 23+ messages in thread
From: Philip Silva via 9fans @ 2023-08-26  9:23 UTC (permalink / raw)
  To: 9fans

Hi,

I've only tried qemu with 9front and this got me to a console (the files in dos/ are from the image):

EXTRA_ARGS='user=glenda nobootprompt=local!/dev/sdM0/fs virtio nousbrc='
qemu-system-aarch64 -M raspi3b -dtb dos/bcm2711-rpi-4-b.dtb  -kernel dos/9PI3 -append "console='1 b9600' core_freq=250 arm_64bit=1 gpu_mem=16 enable_uart=1 boot_delay=1 $EXTRA_ARGS"  -drive file=9front.img,if=sd,format=raw -serial mon:stdio

It's awfully slow though but maybe it's possible to run fast with KVM.

Also I had been trying https://github.com/0xMirasio/qemu-patch-raspberry4.git but I think it also works with an unpatched qemu.

Philip



------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-M7e01ab465d585393c0cf2f6b
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-08-26 11:39   ` hiro
@ 2023-08-26 10:44     ` mkf
  2023-08-26 11:48       ` hiro
  0 siblings, 1 reply; 23+ messages in thread
From: mkf @ 2023-08-26 10:44 UTC (permalink / raw)
  To: 9fans

I believe KVM on aarch64 would help aarch64 guests.
i could be wrong.

On Sat, 26 Aug 2023 13:39:01 +0200
hiro <23hiro@gmail.com> wrote:

> why do you assume kvm helps with emulating a raspberry?
> kvm helps virtualize amd64 on amd64, and shouldn't be usable for much else.

-
mkf

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-Mcb513146cffab46d92d4c3f4
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-08-26  9:23 ` Philip Silva via 9fans
@ 2023-08-26 11:39   ` hiro
  2023-08-26 10:44     ` mkf
  0 siblings, 1 reply; 23+ messages in thread
From: hiro @ 2023-08-26 11:39 UTC (permalink / raw)
  To: 9fans

why do you assume kvm helps with emulating a raspberry?
kvm helps virtualize amd64 on amd64, and shouldn't be usable for much else.

On Sat, Aug 26, 2023 at 11:25 AM Philip Silva via 9fans <9fans@9fans.net> wrote:
> 
> Hi,
> 
> I've only tried qemu with 9front and this got me to a console (the files in dos/ are from the image):
> 
> EXTRA_ARGS='user=glenda nobootprompt=local!/dev/sdM0/fs virtio nousbrc='
> qemu-system-aarch64 -M raspi3b -dtb dos/bcm2711-rpi-4-b.dtb  -kernel dos/9PI3 -append "console='1 b9600' core_freq=250 arm_64bit=1 gpu_mem=16 enable_uart=1 boot_delay=1 $EXTRA_ARGS"  -drive file=9front.img,if=sd,format=raw -serial mon:stdio
> 
> It's awfully slow though but maybe it's possible to run fast with KVM.
> 
> Also I had been trying https://github.com/0xMirasio/qemu-patch-raspberry4.git but I think it also works with an unpatched qemu.
> 
> Philip
> 

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-M9e2752b8f55ee0d3c306b0df
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-08-26 10:44     ` mkf
@ 2023-08-26 11:48       ` hiro
  2023-08-26 12:52         ` Philip Silva via 9fans
  2023-08-26 19:38         ` Don A. Bailey
  0 siblings, 2 replies; 23+ messages in thread
From: hiro @ 2023-08-26 11:48 UTC (permalink / raw)
  To: 9fans

ah no i was wrong. first google result "KVM support is available only
for 64-bit ARM architecture (AArch64"
oh well

On Sat, Aug 26, 2023 at 1:45 PM mkf <mkf9@riseup.net> wrote:
>
> I believe KVM on aarch64 would help aarch64 guests.
> i could be wrong.
>
> On Sat, 26 Aug 2023 13:39:01 +0200
> hiro <23hiro@gmail.com> wrote:
>
> > why do you assume kvm helps with emulating a raspberry?
> > kvm helps virtualize amd64 on amd64, and shouldn't be usable for much else.
> 
> -
> mkf

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-M4a05d05887502397c942d91e
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-08-26 11:48       ` hiro
@ 2023-08-26 12:52         ` Philip Silva via 9fans
  2023-08-26 19:38         ` Don A. Bailey
  1 sibling, 0 replies; 23+ messages in thread
From: Philip Silva via 9fans @ 2023-08-26 12:52 UTC (permalink / raw)
  To: 9fans

Hosting options are quite limited though, there's Hetzner and actually also Arm Virtual Hardware but I couldn't get 9front running there. And at least on real hardware running 32 bit on aarch64 seems to work. Also on macOS qemu there's hardware acceleration. I've tried that as well but I think I ran into another problem there.


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-Me82a3a9b67690664ab9ba539
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-08-26 11:48       ` hiro
  2023-08-26 12:52         ` Philip Silva via 9fans
@ 2023-08-26 19:38         ` Don A. Bailey
  2023-08-31 18:47           ` Richard Miller
  1 sibling, 1 reply; 23+ messages in thread
From: Don A. Bailey @ 2023-08-26 19:38 UTC (permalink / raw)
  To: 9fans

So to get this back on the track of RPI emulated in QEMU … has anyone successfully used the Miller image with Q?

D

> On Aug 26, 2023, at 7:49 AM, hiro <23hiro@gmail.com> wrote:
> 
> ah no i was wrong. first google result "KVM support is available only
> for 64-bit ARM architecture (AArch64"
> oh well
> 
>> On Sat, Aug 26, 2023 at 1:45 PM mkf <mkf9@riseup.net> wrote:
>> 
>> I believe KVM on aarch64 would help aarch64 guests.
>> i could be wrong.
>> 
>> On Sat, 26 Aug 2023 13:39:01 +0200
>> hiro <23hiro@gmail.com> wrote:
>> 
>>> why do you assume kvm helps with emulating a raspberry?
>>> kvm helps virtualize amd64 on amd64, and shouldn't be usable for much else.
>> 
>> -
>> mkf

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-M2124f52071a58e03f83b5f1f
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-08-26 19:38         ` Don A. Bailey
@ 2023-08-31 18:47           ` Richard Miller
  2023-09-01  2:11             ` Don Bailey
  0 siblings, 1 reply; 23+ messages in thread
From: Richard Miller @ 2023-08-31 18:47 UTC (permalink / raw)
  To: 9fans

don.bailey@gmail.com:
> So to get this back on the track of RPI emulated in QEMU … has anyone successfully used the Miller image with Q?

After a bit of experimentation, I have done so, for some value of "successfully".

A few tweaks are required first, because QEMU's emulation of Pi hardware and
firmware is not as faithful as it might be:

- binary kernel file is loaded at 0x10000, not 0x8000
- the watchdog timer doesn't work (or isn't there)
- system timer behaviour is a bit peculiar
- emulation of the SDMMC in multi-block mode is spectacularly slow
  (transfers take not milliseconds but seconds)

After tweaking as shown below, a QEMU-compatible kernel can be built with
  mk CONF'='pi2 9pi2.qemu
and run with something like
  qemu-system-arm -M raspi2b -kernel 9pi2.qemu -serial stdio \
    -drive file=9pi.img,if=sd,format=raw \
    -append 'readparts=1 console=1 *ncpu=1 nobootprompt=local!/dev/sdM0/fossil'

For convenience I've put a kernel file on /n/sources/contrib/miller/9pi2.qemu

However ...

- the DWC usb host adapter of the Pi2/3 does not work the way Plan 9 expects
- therefore there's no functioning usb
- therefore I don't know how to attach a keyboard, mouse or network interface

If anybody wants to debug this further I'm happy to collaborate, but I'm
not sufficiently motivated to do it myself.

Diffs against files in /n/sources/contrib/miller/9/bcm, which I think are
identical to 9legacy 9/bcm sources):

mkfile:
85a86,90
> $p$CONF.qemu:DQ:      $CONF.$O $OBJ $LIB
>       $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
>       echo '# linking kernel for QEMU'
>       $LD -s -l -o $target -H6 -R4096 -T0x80010000 $OBJ $CONF.$O $LIB
> 

mem.h:
48c48
< #define       KTZERO          (KZERO+0x8000)          /* kernel text start */
---
> #define       KTZERO          (KZERO+0x10000)         /* kernel text start */

archbcm2.c:
225c225
<       addclock0link(wdogfeed, HZ);
---
>       //addclock0link(wdogfeed, 1000);

sdmmc.c:
25c25
<       Multiblock      = 1,
---
>       Multiblock      = 0,

clock.c:
35c35
<       MinPeriod       = 10,
---
>       MinPeriod       = 100,
124c124
<       u32int t0, t1, tstart, tend;
---
>       u32int t0, t1, tstart;
142d141
<       tend = tstart + 10000;
145c144
<       }while(tn->clo != tend);
---
>       }while(tn->clo - tstart < 10000);

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-M2edf6c6413ee49aaee761281
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-08-31 18:47           ` Richard Miller
@ 2023-09-01  2:11             ` Don Bailey
  2023-09-01  8:18               ` Richard Miller
  2023-09-01 14:06               ` Richard Miller
  0 siblings, 2 replies; 23+ messages in thread
From: Don Bailey @ 2023-09-01  2:11 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 3479 bytes --]

Hmm, I've applied the patches and built the kernel. I can see the image
loaded at 0x80010000, but it is spinning at address 0xffff000c; is this a
sdmmc load loop?

I'm using version 8.0.0 of QEMU. What version are you using, Mr. Miller?
Also, since the SD takes seconds to load and not ms/us, how long are you
waiting until you see something printed on the console...? Curious if I'm
just running very slow, or if there is still something buggy going on...

Thanks for responding and adding some patches. I am trying to follow along
to make it work, if you don't mind a bit of back and forth :-)

D


On Thu, Aug 31, 2023 at 2:48 PM Richard Miller <9fans@hamnavoe.com> wrote:

> don.bailey@gmail.com:
> > So to get this back on the track of RPI emulated in QEMU … has anyone
> successfully used the Miller image with Q?
>
> After a bit of experimentation, I have done so, for some value of
> "successfully".
>
> A few tweaks are required first, because QEMU's emulation of Pi hardware
> and
> firmware is not as faithful as it might be:
>
> - binary kernel file is loaded at 0x10000, not 0x8000
> - the watchdog timer doesn't work (or isn't there)
> - system timer behaviour is a bit peculiar
> - emulation of the SDMMC in multi-block mode is spectacularly slow
>   (transfers take not milliseconds but seconds)
>
> After tweaking as shown below, a QEMU-compatible kernel can be built with
>   mk CONF'='pi2 9pi2.qemu
> and run with something like
>   qemu-system-arm -M raspi2b -kernel 9pi2.qemu -serial stdio \
>     -drive file=9pi.img,if=sd,format=raw \
>     -append 'readparts=1 console=1 *ncpu=1
> nobootprompt=local!/dev/sdM0/fossil'
>
> For convenience I've put a kernel file on
> /n/sources/contrib/miller/9pi2.qemu
>
> However ...
>
> - the DWC usb host adapter of the Pi2/3 does not work the way Plan 9
> expects
> - therefore there's no functioning usb
> - therefore I don't know how to attach a keyboard, mouse or network
> interface
>
> If anybody wants to debug this further I'm happy to collaborate, but I'm
> not sufficiently motivated to do it myself.
>
> Diffs against files in /n/sources/contrib/miller/9/bcm, which I think are
> identical to 9legacy 9/bcm sources):
>
> mkfile:
> 85a86,90
> > $p$CONF.qemu:DQ:      $CONF.$O $OBJ $LIB
> >       $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
> >       echo '# linking kernel for QEMU'
> >       $LD -s -l -o $target -H6 -R4096 -T0x80010000 $OBJ $CONF.$O $LIB
> >
>
> mem.h:
> 48c48
> < #define       KTZERO          (KZERO+0x8000)          /* kernel text
> start */
> ---
> > #define       KTZERO          (KZERO+0x10000)         /* kernel text
> start */
>
> archbcm2.c:
> 225c225
> <       addclock0link(wdogfeed, HZ);
> ---
> >       //addclock0link(wdogfeed, 1000);
>
> sdmmc.c:
> 25c25
> <       Multiblock      = 1,
> ---
> >       Multiblock      = 0,
>
> clock.c:
> 35c35
> <       MinPeriod       = 10,
> ---
> >       MinPeriod       = 100,
> 124c124
> <       u32int t0, t1, tstart, tend;
> ---
> >       u32int t0, t1, tstart;
> 142d141
> <       tend = tstart + 10000;
> 145c144
> <       }while(tn->clo != tend);
> ---
> >       }while(tn->clo - tstart < 10000);

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-Meca1d0c552a069be2e26805e
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 5796 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-09-01  2:11             ` Don Bailey
@ 2023-09-01  8:18               ` Richard Miller
  2023-09-01  8:47                 ` fgergo
  2023-09-01 14:06               ` Richard Miller
  1 sibling, 1 reply; 23+ messages in thread
From: Richard Miller @ 2023-09-01  8:18 UTC (permalink / raw)
  To: 9fans

don.bailey@gmail.com:
> Hmm, I've applied the patches and built the kernel. I can see the image
> loaded at 0x80010000, but it is spinning at address 0xffff000c; is this a
> sdmmc load loop?

I think that's a trap address. On ARM we re-map the trap vectors away from
address 0 to a high segment.

> I'm using version 8.0.0 of QEMU. What version are you using, Mr. Miller?

Mine is 7.2.4 (just installed it on Debian 12).

> Also, since the SD takes seconds to load and not ms/us, how long are you
> waiting until you see something printed on the console...?

After the 'Multiblock = 0' patch is applied, SD card transfers take about
2 milliseconds on my elderly thinkpad.

> Curious if I'm
> just running very slow, or if there is still something buggy going on...

The trap is a bug which I'm not seeing. Do you get any console messages first?

> Thanks for responding and adding some patches. I am trying to follow along
> to make it work, if you don't mind a bit of back and forth :-)

Maybe do the back & forth off list, unless anyone else is interested?

-- Richard


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-M5bb97b8ca2aff6e9f980d601
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-09-01  8:18               ` Richard Miller
@ 2023-09-01  8:47                 ` fgergo
  2023-09-01  8:56                   ` quiekaizam via 9fans
  0 siblings, 1 reply; 23+ messages in thread
From: fgergo @ 2023-09-01  8:47 UTC (permalink / raw)
  To: 9fans

On 9/1/23, Richard Miller <9fans@hamnavoe.com> wrote:
> don.bailey@gmail.com:
...
>> Thanks for responding and adding some patches. I am trying to follow
>> along
>> to make it work, if you don't mind a bit of back and forth :-)
>
> Maybe do the back & forth off list, unless anyone else is interested?
I'm very interested in learning both about the process and about the
result. Unless others object, I'd like to follow along here.

Also I've learnt more from technical discussions on 9fans in the last
~25 years, than from most other technical discussions available
online.

When a 9fans archive link is in my search results, in most cases my
question is answered.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-Mb271ea42035fc3ca41874792
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-09-01  8:47                 ` fgergo
@ 2023-09-01  8:56                   ` quiekaizam via 9fans
  0 siblings, 0 replies; 23+ messages in thread
From: quiekaizam via 9fans @ 2023-09-01  8:56 UTC (permalink / raw)
  To: 9fans

> > Maybe do the back & forth off list, unless anyone else is interested?
> I'm very interested in learning both about the process and about the
> result. Unless others object, I'd like to follow along here.

Same. Lurking and learning.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-09-01  2:11             ` Don Bailey
  2023-09-01  8:18               ` Richard Miller
@ 2023-09-01 14:06               ` Richard Miller
  2023-09-01 15:38                 ` Don Bailey
  1 sibling, 1 reply; 23+ messages in thread
From: Richard Miller @ 2023-09-01 14:06 UTC (permalink / raw)
  To: 9fans

> I'm using version 8.0.0 of QEMU. What version are you using, Mr. Miller?

I've now reinstalled QEMU from debian unstable, which gives me v8.0.4.
Using the 9pi2.qemu in my contrib, it still boots for me, without any
loop at 0xffff000c.


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-Me1c683349a6d44bfe1f29dca
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-09-01 14:06               ` Richard Miller
@ 2023-09-01 15:38                 ` Don Bailey
  2023-09-01 19:37                   ` Richard Miller
  0 siblings, 1 reply; 23+ messages in thread
From: Don Bailey @ 2023-09-01 15:38 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]

Took a minute to snarf your 9pi2.qemu off of contrib and run it on my
8.0.0... (it wasn't there last night; depends on when 9pio syncs the web
interface, I suppose)

It runs just peachy. Based on the diffs you supplied, it looks like my bcm
sources (from the latest r4 ISO) are not the same as yours. I don't use
9front. What is the best way to make sure my bcm (and 9) kernel trees are
the same as your current tree? I suspect we have a slight deviation that is
enough to cause this kernel not to boot. Otherwise, I've added your changes
to my tree...

Thanks for your time! This is helpful.
D


On Fri, Sep 1, 2023 at 10:07 AM Richard Miller <9fans@hamnavoe.com> wrote:

> > I'm using version 8.0.0 of QEMU. What version are you using, Mr. Miller?
> 
> I've now reinstalled QEMU from debian unstable, which gives me v8.0.4.
> Using the 9pi2.qemu in my contrib, it still boots for me, without any
> loop at 0xffff000c.
> 

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-Mee8ae1299edb6dfc07f4cdf4
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 2496 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-09-01 15:38                 ` Don Bailey
@ 2023-09-01 19:37                   ` Richard Miller
  2023-09-02  2:01                     ` Don Bailey
  0 siblings, 1 reply; 23+ messages in thread
From: Richard Miller @ 2023-09-01 19:37 UTC (permalink / raw)
  To: 9fans

> Based on the diffs you supplied, it looks like my bcm
> sources (from the latest r4 ISO) are not the same as yours. I don't use
> 9front. What is the best way to make sure my bcm (and 9) kernel trees are
> the same as your current tree?

A lot has changed in the bcm kernel since the 4th edition ISO, because
of the release of newer Raspberry Pi models.  Current source is in
contrib/miller/9/bcm - just copy those files into /sys/src/9/bcm (or use
the 9legacy ISO instead, which is kept up to date and has other useful
patches too).


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-Me83a2442fc4a034b67c85cec
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-09-01 19:37                   ` Richard Miller
@ 2023-09-02  2:01                     ` Don Bailey
  2023-09-02  3:25                       ` Don Bailey
  2023-09-02 15:17                       ` Richard Miller
  0 siblings, 2 replies; 23+ messages in thread
From: Don Bailey @ 2023-09-02  2:01 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1414 bytes --]

Yeah it must be patches in 9legacy.... because pulling the bcm from contrib
and using that does not alone fix the kernel.

Interestingly, I can get a kernel to boot in a raspi1ap emulated image, but
it faults on what I presume is the jump to userland, resets, and auto-boots
the kernel again in an infinite loop. I cannot get raspi2b to boot at all
(same deadlock as before).

The thing about 9legacy is I'm not sure what patches to pull and what is or
isn't stable.... do you have any recommendations?

Thanks again,
D


On Fri, Sep 1, 2023 at 3:38 PM Richard Miller <9fans@hamnavoe.com> wrote:

> > Based on the diffs you supplied, it looks like my bcm
> > sources (from the latest r4 ISO) are not the same as yours. I don't use
> > 9front. What is the best way to make sure my bcm (and 9) kernel trees are
> > the same as your current tree?
> 
> A lot has changed in the bcm kernel since the 4th edition ISO, because
> of the release of newer Raspberry Pi models.  Current source is in
> contrib/miller/9/bcm - just copy those files into /sys/src/9/bcm (or use
> the 9legacy ISO instead, which is kept up to date and has other useful
> patches too).
> 

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-Md0ae5d80096293254ea4aa1c
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 2796 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-09-02  2:01                     ` Don Bailey
@ 2023-09-02  3:25                       ` Don Bailey
  2023-09-02  8:25                         ` hiro
  2023-09-02 15:20                         ` Richard Miller
  2023-09-02 15:17                       ` Richard Miller
  1 sibling, 2 replies; 23+ messages in thread
From: Don Bailey @ 2023-09-02  3:25 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 2302 bytes --]

Ok I pulled a 9legacy ISO, applied your patch set from this thread above,
and built a 9pi2 kernel. My build now runs as the kernel on a QEMU
raspi2b system.

I didn't realize 9legacy actually had a distribution for some reason I
thought it was only a patch set applied against the old main line. Glad I
don't have to pick apart the patch set that (works)...

It looks like on boot with both the kernel you built and my kernel (the
sizes are different so I presume you added on things in a custom config?)
the system loads into the GUI but then hangs moments later and stops
updating the frame buffer, or the system is hung. Any thoughts on why that
might have occurred? Is this to do with the watchdog...?

Thanks, this is excellent and useful.
D


On Fri, Sep 1, 2023 at 10:01 PM Don Bailey <don.bailey@gmail.com> wrote:

> Yeah it must be patches in 9legacy.... because pulling the bcm from
> contrib and using that does not alone fix the kernel.
>
> Interestingly, I can get a kernel to boot in a raspi1ap emulated image,
> but it faults on what I presume is the jump to userland, resets, and
> auto-boots the kernel again in an infinite loop. I cannot get raspi2b to
> boot at all (same deadlock as before).
>
> The thing about 9legacy is I'm not sure what patches to pull and what is
> or isn't stable.... do you have any recommendations?
>
> Thanks again,
> D
>
>
> On Fri, Sep 1, 2023 at 3:38 PM Richard Miller <9fans@hamnavoe.com> wrote:
>
>> > Based on the diffs you supplied, it looks like my bcm
>> > sources (from the latest r4 ISO) are not the same as yours. I don't use
>> > 9front. What is the best way to make sure my bcm (and 9) kernel trees
>> are
>> > the same as your current tree?
>> 
>> A lot has changed in the bcm kernel since the 4th edition ISO, because
>> of the release of newer Raspberry Pi models.  Current source is in
>> contrib/miller/9/bcm - just copy those files into /sys/src/9/bcm (or use
>> the 9legacy ISO instead, which is kept up to date and has other useful
>> patches too).
>> 

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-M0fe94460eed29c4f77883688
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 4064 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-09-02  3:25                       ` Don Bailey
@ 2023-09-02  8:25                         ` hiro
  2023-09-02 15:20                         ` Richard Miller
  1 sibling, 0 replies; 23+ messages in thread
From: hiro @ 2023-09-02  8:25 UTC (permalink / raw)
  To: 9fans

> I didn't realize 9legacy actually had a distribution for some reason I
> thought it was only a patch set applied against the old main line. Glad I
> don't have to pick apart the patch set that (works)...

yes. i was expecting this confusion will arise some day. officially
it's a spoon, nor a fork.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-M1db836357d101fab323e306d
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-09-02  2:01                     ` Don Bailey
  2023-09-02  3:25                       ` Don Bailey
@ 2023-09-02 15:17                       ` Richard Miller
  1 sibling, 0 replies; 23+ messages in thread
From: Richard Miller @ 2023-09-02 15:17 UTC (permalink / raw)
  To: 9fans

> The thing about 9legacy is I'm not sure what patches to pull and what is or
> isn't stable.... do you have any recommendations?

I've put a script in contrib/miller/build-9pi.rc which shows the complete
process of building (almost) the 9pi image from the 4th edition ISO. You
can look at that to see what 9legacy patches are applied.

The "almost" is because applying the patches each time the image is built
loses some useful metadata. The actual 9pi.img.gz on contrib is a "golden"
copy which I've been updating with individual patches since about 2012,
so the modification dates on source files can be used to see what has
changed an when.


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-M6e7469bcf7263ca55ec33053
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-09-02  3:25                       ` Don Bailey
  2023-09-02  8:25                         ` hiro
@ 2023-09-02 15:20                         ` Richard Miller
  2023-09-14 11:52                           ` adr via 9fans
  1 sibling, 1 reply; 23+ messages in thread
From: Richard Miller @ 2023-09-02 15:20 UTC (permalink / raw)
  To: 9fans

> the system loads into the GUI but then hangs moments later and stops
> updating the frame buffer, or the system is hung. Any thoughts on why that
> might have occurred? Is this to do with the watchdog...?

It won't be the watchdog, because this QEMU patch prevents it
from being enabled.

archbcm2.c:
225c225
<       addclock0link(wdogfeed, HZ);
---
>       //addclock0link(wdogfeed, 1000);

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-Macf52942455e106b08c9cd5b
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-09-02 15:20                         ` Richard Miller
@ 2023-09-14 11:52                           ` adr via 9fans
  2023-09-14 17:11                             ` Richard Miller
  0 siblings, 1 reply; 23+ messages in thread
From: adr via 9fans @ 2023-09-14 11:52 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 862 bytes --]

> I've put a script in contrib/miller/build-9pi.rc which shows the complete
process of building (almost) the 9pi image from the 4th edition ISO. You
can look at that to see what 9legacy patches are applied.

Hi Richard. I'm surprised by the small number of 9legacy patches you are using. Any reason in particular that you could share? I'm preparing a new installation and this is a good time to choose the starting point.

> The actual 9pi.img.gz on contrib is a "golden"
copy which I've been updating with individual patches since about 2012

Do you mean other patches than the ones you shared with 9legacy?

Regards,
adr
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-M274ad663cccfc3a3db43b78f
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1623 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-09-14 11:52                           ` adr via 9fans
@ 2023-09-14 17:11                             ` Richard Miller
  2023-09-14 17:25                               ` adr via 9fans
  0 siblings, 1 reply; 23+ messages in thread
From: Richard Miller @ 2023-09-14 17:11 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1199 bytes --]

On Thursday, 14 September 2023, adr via 9fans <9fans@9fans.net> wrote:

Hi Richard. I'm surprised by the small number of 9legacy patches you are
> using. Any reason in particular that you could share? I'm preparing a new
> installation and this is a good time to choose the starting point.
>
>
The 9pi image is intended as a close approximation to the 4th edition,
adapted for the Raspberry Pi. For practical daily use I'd recommend the
9legacy SD image instead. The 9legacy.org site has a build script showing
how that is made, starting from the 9legacy CD image,

The actual 9pi.img.gz on contrib is a "golden"
> copy which I've been updating with individual patches since about 2012
>
>
> Do you mean other patches than the ones you shared with 9legacy?
>

No, they are the exact same patches. I meant that each patch has been
applied only once, so the source file modification times show when the
patch was done, not when the SD image was made.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-Mae18a741bedf77dd602953ab
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 2180 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [9fans] RPi in QEMU
  2023-09-14 17:11                             ` Richard Miller
@ 2023-09-14 17:25                               ` adr via 9fans
  0 siblings, 0 replies; 23+ messages in thread
From: adr via 9fans @ 2023-09-14 17:25 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 242 bytes --]

I see, thanks.
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5da5467097e4eab2-M0fe5284a21a2266220ee5409
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 736 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-09-14 17:25 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-26  4:22 [9fans] RPi in QEMU Don Bailey
2023-08-26  9:23 ` Philip Silva via 9fans
2023-08-26 11:39   ` hiro
2023-08-26 10:44     ` mkf
2023-08-26 11:48       ` hiro
2023-08-26 12:52         ` Philip Silva via 9fans
2023-08-26 19:38         ` Don A. Bailey
2023-08-31 18:47           ` Richard Miller
2023-09-01  2:11             ` Don Bailey
2023-09-01  8:18               ` Richard Miller
2023-09-01  8:47                 ` fgergo
2023-09-01  8:56                   ` quiekaizam via 9fans
2023-09-01 14:06               ` Richard Miller
2023-09-01 15:38                 ` Don Bailey
2023-09-01 19:37                   ` Richard Miller
2023-09-02  2:01                     ` Don Bailey
2023-09-02  3:25                       ` Don Bailey
2023-09-02  8:25                         ` hiro
2023-09-02 15:20                         ` Richard Miller
2023-09-14 11:52                           ` adr via 9fans
2023-09-14 17:11                             ` Richard Miller
2023-09-14 17:25                               ` adr via 9fans
2023-09-02 15:17                       ` Richard Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).