Giter Club home page Giter Club logo

m1n1's People

Contributors

5ht2 avatar akihikodaki avatar alxdrl avatar alyssais avatar alyssarosenzweig avatar amarioguy avatar amworsley avatar arcanenibble avatar asahilina avatar chadmed avatar davide125 avatar dberlin avatar eiln avatar ferdi265 avatar jannau avatar javier-varez avatar jmranger avatar kdrag0n avatar kettenis avatar kevans91 avatar marcan avatar mmhj avatar mrsparc avatar phire avatar pipcet avatar povik avatar svenpeter42 avatar tobhe avatar vinduv avatar zech4o avatar

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

m1n1's Issues

run_guest.py fails to boot linux when using a concatenated initrd

Tested with m1n1 8887493
Reporting since this works fine when booting with linux.py. Issue is only in run_guest.py.

Use case: when installing a rootfs with the initrd flavor of Debian's installer [0], it's useful to be able to provide a second initrd containing the Broadcom firmwares.

Commands used:

cat DebianBookwormInstaller.20220125.initrd.gz WiFiFW-MacOS12.1.cpio.gz > merged.cpio.gz
cat m1n1/build/m1n1.macho <(echo 'boot-args=earlycon console=ttySAC0,1500000 console=tty0') linux/arch/arm64/boot/dts/apple/t8103-j313.dtb linux/arch/arm64/boot/Image.gz initrd >| /tmp/m1n1-linux.macho
M1N1DEVICE=/dev/ttyACM0 python3 m1n1/proxyclient/tools/run_guest.py /tmp/m1n1-linux.macho

With DebianBookwormInstaller.20220125.initrd.gz as initrd, boot is successful.
When merged.cpio.gz, linux fails to boot with the following error:

[    1.616933] /dev/root: Can't open blockdev
[    1.618751] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6

Logs attached.

I would totally understand if you'd choose to close this as wontfix.

[0] https://d-i.debian.org/daily-images/arm64/20220125-02:20/netboot/debian-installer/arm64/initrd.gz

bad.txt
good.txt

Seems something wrong in find_sprr_regs.py

zec@zbuntu:~/m1n1/proxyclient/experiments$ sudo M1N1DEVICE=/dev/ttyACM1 python3.9 find_sprr_regs.py

TTY> CPU init... CPU: M1 Icestorm
TTY>
TTY> boot_args at 0x808f54000
TTY> revision: 2
TTY> version: 2
TTY> virt_base: 0xfffffe00219c4000
TTY> phys_base: 0x8019c4000
TTY> mem_size: 0x1d7a20000
TTY> top_of_kdata: 0x808f58000
TTY> video:
TTY> base: 0x9df4e4000
TTY> display: 0x1
TTY> stride: 0x2800
TTY> width: 2560
TTY> height: 1600
TTY> depth: 30bpp
TTY> density: 1
TTY> machine_type: 0
TTY> devtree: 0xfffffe00244f4000
TTY> devtree_size: 0x5c000
TTY> cmdline:
TTY> boot_flags: 0x0
TTY> mem_size_act: 0x200000000
TTY>
TTY>
TTY>
TTY> m1n1 ve08457a
TTY> Copyright (C) 2021 The Asahi Linux Contributors
TTY> Licensed under the MIT license
TTY>
TTY> Running in EL2
TTY>
TTY> Heap base: 0x808f58000
TTY> MMU: Initializing...
TTY> MMU: SCTLR_EL1: 30100180 -> 30901085
TTY> MMU: running with MMU and caches enabled!
TTY> fb init: 2560x1600 (30) [s=2560] @0x9df4e4000
TTY> fb console: max rows 46, max cols 64
TTY> fb: display logo
TTY> Device info:
TTY> Model: MacBookAir10,1
TTY> Target: J313
TTY> Board-ID: 0x26
TTY> Chip-ID: 0x8103
TTY>
TTY> AIC registers @ 0x23b100000
TTY> WDT registers @ 0x23d2b0000
TTY> WDT disabled
TTY> pmgr: initialized, 268 devices found.
TTY> Initialization complete.
TTY> Checking for payloads...
TTY> No more payloads at 0x804804000
TTY> No valid payload found
TTY> USB0: initialized at 0x808f58030
TTY> USB1: initialized at 0x808f58440
TTY> Running proxy...
m1n1 base: 0x8045ac000
(3, 6, 15, 1, 0)
SPRR_PERM_EL20_SILLY_THING --> a005a500f005f00f
SPRR_PERM_EL02 --> 0
SPRR_UMASK0_EL2 --> 0
SPRR_UMASK1_EL2 --> 0
SPRR_UMASK2_EL2 --> 0
SPRR_UMASK3_EL2 --> 0
s3_4_c15_c7_4 --> 0
s3_4_c15_c7_5 --> 0
s3_4_c15_c7_6 --> 0
s3_4_c15_c7_7 --> 0
SPRR_UMASK0_EL12 --> 0
SPRR_UMASK1_EL12 --> 0
SPRR_UMASK2_EL12 --> 0
SPRR_UMASK3_EL12 --> 0
s3_4_c15_c8_4 --> 0
s3_4_c15_c8_5 --> 0
s3_4_c15_c8_6 --> 0
s3_4_c15_c8_7 --> 0
SPRR_UNK1_EL1 --> 7f
SPRR_PERM_EL0 --> a005a500f005f00f
SPRR_PERM_EL1 --> f005a500f00ff00f
SPRR_PERM_EL2 --> f005a500f00ff00f
SPRR_UMASK0_EL1 --> 0
SPRR_KMASK0_EL1 --> 0
SPRR_KMASK0_EL2 --> 0
SPRR_UMASK1_EL1 --> 0
SPRR_UMASK2_EL1 --> 0
SPRR_UMASK3_EL1 --> 0
s3_6_c15_c3_6 --> 0
s3_6_c15_c3_7 --> 0
s3_6_c15_c4_0 --> 0
s3_6_c15_c4_1 --> 0
SPRR_KMASK1_EL1 --> 0
SPRR_KMASK2_EL1 --> 0
SPRR_KMASK3_EL1 --> 0
s3_6_c15_c4_5 --> 0
s3_6_c15_c4_6 --> 0
s3_6_c15_c4_7 --> 0
s3_6_c15_c5_0 --> 0
SPRR_KMASK1_EL2 --> 0
SPRR_KMASK2_EL2 --> 0
SPRR_KMASK3_EL2 --> 0
s3_6_c15_c5_4 --> 0
s3_6_c15_c5_5 --> 0
s3_6_c15_c5_6 --> 0
s3_6_c15_c5_7 --> 0
SPRR_KMASK0_EL12 --> 0
SPRR_KMASK1_EL12 --> 0
SPRR_KMASK2_EL12 --> 0
SPRR_KMASK3_EL12 --> 0
s3_6_c15_c6_4 --> 0
s3_6_c15_c6_5 --> 0
s3_6_c15_c6_6 --> 0
s3_6_c15_c6_7 --> 0
SPRR_UNK1_EL2 --> 7f
SPRR_UNK1_EL12 --> 7f
SPRR_PERM_EL12 --> 0
(3, 6, 15, 1, 2)
s3_1_c15_c8_2 --> 3030000ffff00
AFSR1_GL12 --> 0
GXF_ENTER_EL1 --> 8045b50c4
GXF_ABORT_EL1 --> 8045b6000
VBAR_GL12 --> 0
SPSR_GL12 --> 0
ASPSR_GL12 --> 0
ESR_GL12 --> 0
ELR_GL12 --> 0
s3_6_c15_c9_7 --> 0
SP_GL12 --> 804640000
TPIDR_GL1 --> 0
GXF_ENTER_EL2 --> 8045b50c4
GXF_ABORT_EL2 --> 8045b6000
GXF_ENTER_EL12 --> 8045b50c4
GXF_ABORT_EL12 --> 0
(3, 6, 15, 15, 4)
(3, 6, 15, 15, 1)
GL2
AFSR1_GL1 -> 0
AFSR1_GL2 -> 0
s3_6_c15_c1_1 -> 0
s3_6_c15_c2_6 -> 804803e80
s3_6_c15_c8_5 -> 3030000ffff00
s3_6_c15_c8_7 -> 3030000ffff00
VBAR_GL1 -> 8045b5800
SPSR_GL1 -> 600003c9
ASPSR_GL1 -> 3
ESR_GL1 -> 2000000
ELR_GL1 -> a81188615c
FAR_GL1 -> 0
TPIDR_GL2 -> 0
VBAR_GL2 -> 8045b5800
SPSR_GL2 -> 600003c9
ASPSR_GL2 -> 3
ESR_GL2 -> 2000000
ELR_GL2 -> a811886210
FAR_GL2 -> 0
! GXF_STATUS_EL1 0 -> 1
Traceback (most recent call last):
File "/home/zec/m1n1/proxyclient/experiments/find_sprr_regs.py", line 53, in
gl1_items = list(find_regs(u, regs=static_regs, call="gl1"))
File "/home/zec/m1n1/proxyclient/m1n1/find_regs.py", line 67, in find_regs
u.exec(insns, BAD, data_buffer, call=call, silent=True, ignore_exceptions=True)
File "/home/zec/m1n1/proxyclient/m1n1/proxyutils.py", line 146, in exec
ret = call(self.code_buffer | region, r0, r1, r2, r3)
File "/home/zec/m1n1/proxyclient/m1n1/proxy.py", line 682, in gl1_call
return self.request(self.P_GL1_CALL, addr, *args)
File "/home/zec/m1n1/proxyclient/m1n1/proxy.py", line 625, in request
return self._request(opcode, *args2, **kwargs)
File "/home/zec/m1n1/proxyclient/m1n1/proxy.py", line 591, in _request
reply = self.iface.proxyreq(req, reboot=reboot, no_reply=no_reply, pre_reply=None)
File "/home/zec/m1n1/proxyclient/m1n1/proxy.py", line 356, in proxyreq
return self.reply(self.REQ_PROXY)
File "/home/zec/m1n1/proxyclient/m1n1/proxy.py", line 230, in reply
reply += self.readfull(1)
File "/home/zec/m1n1/proxyclient/m1n1/proxy.py", line 169, in readfull
raise UartTimeout("Expected %d bytes, got %d bytes"%(size,len(d)))
m1n1.proxy.UartTimeout: Expected 1 bytes, got 0 bytes

No HDMI output on boot

After installing on a M1 mini, I get no HDMI output after the boot picker using a Lenovo L27m-28 monitor. Monitor works fine in macOS & Recovery/Boot picker. Install works fine with different screen (Dell UltraSharp 43).

Happy to provide any other details and conduct any testing required.

Resizing error

I got this error:

04-04 11:02 root         DEBUG    run: diskutil ('apfs', 'resizeContainer', 'disk0s2', '399999238144')
04-04 11:06 root         INFO     MSG: Failed to run process: diskutil apfs resizeContainer disk0s2 399999238144
04-04 11:06 root         ERROR    Process execution failed
Traceback (most recent call last):
  File "/private/tmp/asahi-install/main.py", line 820, in <module>
    InstallerMain().main()
  File "/private/tmp/asahi-install/main.py", line 672, in main
    while self.main_loop():
  File "/private/tmp/asahi-install/main.py", line 792, in main_loop
    return self.action_resize(parts_resizable)
  File "/private/tmp/asahi-install/main.py", line 612, in action_resize
    self.dutil.resizeContainer(target.name, val)
  File "/private/tmp/asahi-install/diskutil.py", line 208, in resizeContainer
    self.action("apfs", "resizeContainer", name, size, verbose=2)
  File "/private/tmp/asahi-install/diskutil.py", line 38, in action
    subprocess.run(["diskutil"] + list(args), check=True)
  File "/private/tmp/asahi-install/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['diskutil', 'apfs', 'resizeContainer', 'disk0s2', '399999238144']' returned non-zero exit status 1.

installer.log

trace_all.py fails while tracing with "Event checksum error"

When running the hypervisor with trace_all, the trace always fails after a few seconds with "Event checksum error".

M1 Device: Mac Mini, m1n1 d2d5952, macOS 12.0b5.

Host running the python shell: macOS 11.6/MacBook Pro 2015

python3 run_guest.py -m ../hv/trace_all.py -S /Volumes/thickhd/docs/macos12b5/kernelcache_uncompressed_mac.macho "-v -s cpus=1 debug=0x4 wdt=-1 rd=md0"

after some messages

Event checksum error: Expected 0x0013ee84, got 0xd0decade
Traceback (most recent call last):
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<console>", line 1, in <module>
  File "/Users/zhuowei/Documents/repos/m1n1/proxyclient/m1n1/shell.py", line 129, in display
    val()
  File "/Users/zhuowei/Documents/repos/m1n1/proxyclient/m1n1/hv.py", line 1313, in start
    self.p.hv_start(self.entry, self.guest_base + self.bootargs_off)
  File "/Users/zhuowei/Documents/repos/m1n1/proxyclient/m1n1/proxy.py", line 951, in hv_start
    return self.request(self.P_HV_START, entry, *args)
  File "/Users/zhuowei/Documents/repos/m1n1/proxyclient/m1n1/proxy.py", line 625, in request
    return self._request(opcode, *args2, **kwargs)
  File "/Users/zhuowei/Documents/repos/m1n1/proxyclient/m1n1/proxy.py", line 591, in _request
    reply = self.iface.proxyreq(req, reboot=reboot, no_reply=no_reply, pre_reply=None)
  File "/Users/zhuowei/Documents/repos/m1n1/proxyclient/m1n1/proxy.py", line 357, in proxyreq
    return self.reply(self.REQ_PROXY)
  File "/Users/zhuowei/Documents/repos/m1n1/proxyclient/m1n1/proxy.py", line 256, in reply
    raise UartChecksumError()
m1n1.proxy.UartChecksumError

If I try to start another shell:

python3 shell.py 
Event checksum error: Expected 0xd0decade, got 0x66d4435d
Traceback (most recent call last):
  File "shell.py", line 6, in <module>
    from m1n1.setup import *
  File "/Users/zhuowei/Documents/repos/m1n1/proxyclient/m1n1/setup.py", line 17, in <module>
    bootstrap_port(iface, p)
  File "/Users/zhuowei/Documents/repos/m1n1/proxyclient/m1n1/proxyutils.py", line 447, in bootstrap_port
    do_baud = proxy.iodev_whoami() == IODEV.UART
  File "/Users/zhuowei/Documents/repos/m1n1/proxyclient/m1n1/proxy.py", line 928, in iodev_whoami
    return IODEV(self.request(self.P_IODEV_WHOAMI))
  File "/Users/zhuowei/Documents/repos/m1n1/proxyclient/m1n1/proxy.py", line 625, in request
    return self._request(opcode, *args2, **kwargs)
  File "/Users/zhuowei/Documents/repos/m1n1/proxyclient/m1n1/proxy.py", line 591, in _request
    reply = self.iface.proxyreq(req, reboot=reboot, no_reply=no_reply, pre_reply=None)
  File "/Users/zhuowei/Documents/repos/m1n1/proxyclient/m1n1/proxy.py", line 357, in proxyreq
    return self.reply(self.REQ_PROXY)
  File "/Users/zhuowei/Documents/repos/m1n1/proxyclient/m1n1/proxy.py", line 256, in reply
    raise UartChecksumError()
m1n1.proxy.UartChecksumError

and finally, if I run shell.py again it works:

python3 shell.py 
TTY> usb-dwc3@382280000: ACM device closed
TTY> usb-dwc3@382280000: ACM device opened
m1n1 base: 0x8038dc000
Have fun!
>>> 

RFE: Load the splash logo at runtime

In Fedora, we have a unified branding setup that depends on us being able to ship our branding assets in a single package (fedora-logos). The reason for this is so that the package can be swapped with generic branding (generic-logos) or downstreams can ship their own branding and everything can leverage it automatically.

Currently, m1n1 pulls in the logo asset at build time, translates the input PNG into an alternate binary format, and embeds it into the loader binary itself. Would it be possible to change it so it can load it externally so that this can be swapped at install-time instead?

Reading the last bytes of memory (sometimes) SErrors

This is a bit of a weird one, but I'm using vanilla m1n1 and can reproduce this at will. Here's a log that demonstrates what's going on:

TTY> CPU init... CPU: M1 Icestorm
TTY> 
TTY> boot_args at 0x807f38000
TTY>   revision:     2
TTY>   version:      2
TTY>   virt_base:    0xfffffe0007f44000
TTY>   phys_base:    0x801f44000
TTY>   mem_size:     0x3d7554000
TTY>   top_of_kdata: 0x807f3c000
TTY>   video:
TTY>     base:       0xbdf438000
TTY>     display:    0x0
TTY>     stride:     0x2800
TTY>     width:      2560
TTY>     height:     1600
TTY>     depth:      65566bpp
TTY>   machine_type: 0
TTY>   devtree:      0xfffffe00096a0000
TTY>   devtree_size: 0x5c000
TTY>   cmdline:      -v
TTY>   boot_flags:   0x0
TTY>   mem_size_act: 0x400000000
TTY> 
TTY> 
TTY> 
TTY> m1n1 v7c54aa3-dirty
TTY> Copyright (C) 2021 The Asahi Linux Contributors
TTY> Licensed under the MIT license
TTY> 
TTY> Running in EL2
TTY> 
TTY> Heap base: 0x807f3c000
TTY> MMU: Initializing...
TTY> MMU: SCTLR_EL1: 30100180 -> 30901085
TTY> MMU: running with MMU and caches enabled!
TTY> fb init: 2560x1600 (30) [s=2560] @0xbdf438000
TTY> fb console: max rows 46, max cols 64
TTY> fb: display logo
TTY> Device info:
TTY>   Model: MacBookPro17,1
TTY>   Target: J293
TTY>   Board-ID: 0x24
TTY>   Chip-ID: 0x8103
TTY> 
TTY> WDT registers @ 0x23d2b0000
TTY> WDT disabled
TTY> pmgr: initialized, 272 devices found.
TTY> Initialization complete.
TTY> Checking for payloads...
TTY> No more payloads at 0x803854000
TTY> No valid payload found
TTY> i2c: want to read 1 bytes from addr 63 but can only read 0
TTY> usb: tps6598x_powerup failed for /arm-io/i2c0/hpmBusManager/hpm1.
TTY> usb: failed to init hpm1
TTY> USB0: initialized at 0x807f3c030
TTY> USB1: initialized at 0x807f3c440
TTY> Running proxy...
m1n1 base: 0x80375c000
Have fun!
>>> get_bootargs()
0x807f38000
>>> read64(get_bootargs()+16)
0x801f44000
>>> read64(get_bootargs()+24)
0x3d7554000
>>> top_of_mem = 0x801f44000 + 0x3d7554000
>>> readmem(top_of_mem-8, 8)
Traceback (most recent call last):
  File "/usr/lib/python3.9/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<console>", line 1, in <module>
  File "/home/pip/metalinux/m1n1/proxyclient/m1n1/proxy.py", line 400, in readmem
    raise UartChecksumError(f"Reply data sentinel error: Expected "
m1n1.proxy.UartChecksumError: Reply data sentinel error: Expected 0xb0cacc10, got 0x45cacc10

What happens on the console is an SError with ESR 0xbe000000 and L2C_ERR_ADR 0x300000bd9498000, which is the top_of_mem address.

(The "65566 bpp" thing and the i2c error are real, too, I'm afraid)

I guess this all makes sense since we did create a "normal" mapping for the poisoned page that starts unavailable "memory", but I'm not sure how best to fix it. I think what happens is the CPU speculatively prefetches from the mapped-but-inaccessible page. The ringbuffer read code, which is where the SError hits, does look like it would trigger such a prefetch by reading bytes sequentially (which is why it might not be possible to reproduce this using a UART, come to think of it).

"Second-generation" Apple silicon OpenBSD support

Hello! Quick disclaimer, this is probably a pretty low priority "enhancement" question, so feel free to tag it as you see fit.

I greatly appreciate the work you all are doing with apple silicon platforms, and I've seen that you've been collaborating with the OpenBSD developers - they seem to now (with some confidence) support Apple M1/M1 Pro/M1 Max chips. I'm not asking for an ETA for "full support", as I'm well aware that's a silly question, but as you continue to work on Linux support for the "Second-generation" platforms (i.e. M2, M1 Ultra), will support also be mirrored with OpenBSD?

Thank you, and have a great day!

failed to installer,macOS12.3.1,M1,curl

xiaotaiyang@bogon asahi-installer % curl https://alx.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1049 100 1049 0 0 835 0 0:00:01 0:00:01 --:--:-- 841

Bootstrapping installer:
Checking version...
Version: v0.3.26
Downloading...
xiaotaiyang@bogon asahi-installer %

kmutil returns: Error: Invalid Mach-O boot properties

I've tried following the QuickStart instructions to the dot on a MacBook Pro with M1 Pro. The mac came with macOS monteray pre-installed.

However, I hit a snag when trying to use kmutil:

-bash-3.2# kmutil configure-boot -c m1n1.macho -C -v /Volumes/Linux
By setting a custom boot object, you will be putting your system into Permissive Security.

Are you sure you want to do this? (enter y or n) y
found valid Mach-O binary, deriving Mach-O boot properties...
Error Domain=KMErrorDomain Code=71 "Fileset Error: Invalid Mach-O boot properties" UserInfo={NSLocalizedDescription=Fileset Error: Invalid Mach-O boot properties}

Any ideas?

[cosmetic] "dirname: command not found" when started from recovery

When started (curl https://alx.sh | sh) from recovery:

Bootstrapping installer:
  Checking version...
  Version: v0.4.1
  Downloading...
  Extracting...
  Initializing...

./install.sh: line 6: dirname: command not found

Welcome to the Asahi Linux installer!
...

Does not seem to be affecting anything.

Why the mach-O header reports a section past the end of file?

cmd LC_SEGMENT_64 cmdsize 72 segname PYLD vmaddr 0xfffffe00070d0000 vmsize 0x0000000004000000 fileoff 638976 filesize 67108864 (past end of file) maxprot 0x00000003 initprot 0x00000003 nsects 0 flags 0x0

I am doing some experiments with the t8030 emulator.

[Testing] virtual targets

How hard would it be to add virtual (aarch64 QEMU) hardware support to m1n1? This could be useful to develop and test hardware-independent features like config, filesystem and secure boot without needing the hardware, also allowing debugging. If it's simple enough, that would be useful for Rust porting as well.

python fails to load ADT since calculated base address ends up negative

I've only hit the following problem once with 12.1 firmware and couldn't reproduce it after a reboot now.

I've added some debug prints and m1n1 computes the ADT base address as 0x12c0000 - 0xffffffffff0a8000 + 0x8010a8000 = -0xfffffff7fcd40000.
The same thing works in C because it overflows back to 0x8032c0000.

I'm not sure if this is just a python issue and casting the result down to a u64 is good enough or if 0xffffffffff0a8000 is an unexpected virt_base.

TTY> CPU init (MIDR: 0x611f0221)...
TTY>   CPU part: 0x22 rev: 0x11
TTY>   CPU: M1 Icestorm
TTY>
TTY> boot_args at 0x803b3c000
TTY>   revision:     2
TTY>   version:      2
TTY>   virt_base:    0xffffffffff0a8000
TTY>   phys_base:    0x8010a8000
TTY>   mem_size:     0x1df98c000
TTY>   top_of_kdata: 0x803b40000
TTY>   video:
TTY>     base:       0x9e3a5c000
TTY>     display:    0x1
TTY>     stride:     0xa00
TTY>     width:      640
TTY>     height:     1136
TTY>     depth:      32bpp
TTY>     density:    1
TTY>   machine_type: 0
TTY>   devtree:      0x12c0000
TTY>   devtree_size: 0x58000
TTY>   cmdline:
TTY>   boot_flags:   0x0
TTY>   mem_size_act: 0x200000000
TTY>
TTY>
TTY>
TTY> m1n1 v69ed3e4-dirty
TTY> Copyright The Asahi Linux Contributors
TTY> Licensed under the MIT license
TTY>
TTY> Running in EL2
TTY>
TTY> Device info:
TTY>   Model: Macmini9,1
TTY>   Target: J274
TTY>   Board-ID: 0x22
TTY>   Chip-ID: 0x8103
TTY>
TTY> Heap base: 0x803b40000
TTY> MCC: Initializing T8103 MCC...
TTY> MCC: Initialized T8103 MCC (8 channels)
TTY> MMU: Initializing...
TTY> MMU: Adding nGnRE mapping at 0x400000000 (0x80000000)
TTY> MMU: Adding nGnRE mapping at 0x480000000 (0x80000000)
TTY> MMU: Adding nGnRE mapping at 0x580000000 (0x80000000)
TTY> MMU: Adding nGnRE mapping at 0x600000000 (0x80000000)
TTY> MMU: Adding nGnRE mapping at 0x6a0000000 (0x20000000)
TTY> MMU: Adding nGnRE mapping at 0x6c0000000 (0x40000000)
TTY> MMU: Adding nGnRE mapping at 0x700000000 (0x100000000)
TTY> MMU: RAM base: 0x800000000
TTY> MMU: Top of normal RAM: 0x9e0a34000
TTY> MMU: Unmapping TZ0 region at 0x9e0a3c000..0x9e275c000
TTY> MMU: Unmapping TZ1 region at 0x9e0a34000..0x9e0a3c000
TTY> MMU: Unmapping TZ3 region at 0x9e6e64000..0x9ffe64000
TTY> MMU: SCTLR_EL1: 30100180 -> 30901085
TTY> MMU: running with MMU and caches enabled!
TTY> display: Dummy framebuffer found, initializing display
TTY> dart: dart /arm-io/dart-dcp at 0x23130c000 is a t8020 (locked)
TTY> dart: dart /arm-io/dart-disp0 at 0x231304000 is a t8020
TTY> rtkit(dcp): booting with version 12
TTY> rtkit(dcp): unknown system endpoint 0x0a
TTY> rtkit(dcp): pre-allocated buffer (ep 0x1, dva 0xf00243000, phys 0x9e6263000)
TTY> EPIC: started interface 0 (disp0-service)
TTY> display: waited 2000 ms for display status
TTY> display: connected:0 timing_cnt:0 color_cnt:0
TTY> fb init: 640x1136 (32) [s=640] @(nil)
TTY> fb console: max rows 31, max cols 4
TTY> fb: display logo
TTY> AIC: Version 1 @ 0x23b100000
TTY> WDT registers @ 0x23d2b0000
TTY> WDT disabled
TTY> pmgr: Cleaning up device states...
TTY> pmgr: Enabling SIO_ADMA, parent of active device MCA1
TTY> pmgr: Enabling ANS2, parent of active device APCIE_ST
TTY> pmgr: Enabling DEBUG, parent of active device DEBUG_USB
TTY> pmgr: initialized, 268 devices found.
TTY> cpufreq: Initializing clusters
TTY> cpufreq: Switching cluster PCPU to P-State 7
TTY> Initialization complete.
TTY> Checking for payloads...
TTY> Devicetree compatible value: apple,j274
TTY> Unknown payload at 0x803438000 (magic: 3083702c)
TTY> No valid payload found
TTY> dart: dart /arm-io/dart-usb0 at 0x382f80000 is a t8020
TTY> USB0: initialized at 0x803f46030
TTY> dart: dart /arm-io/dart-usb1 at 0x502f80000 is a t8020
TTY> USB1: initialized at 0x803f46360
TTY> Running proxy...
readmem: 803b3c000 2e0
m1n1 base: 0x803378000
LOAD: _HDR 16384 bytes from 0 to 0
LOAD: TEXT 163840 bytes from 4000 to 4000
LOAD: RODA 32768 bytes from 2c000 to 2c000
LOAD: DATA 393216 bytes from 34000 to 34000
ZERO: 196608 bytes from 0x94000 to 0xc4000
LOAD: PYLD 0 bytes from 94000 to c4000
SKIP: 67108864 bytes from 0xc4000 to 0x40c4000
12c0000 ffffffffff0a8000 8010a8000
Fetching ADT (0x00058000 bytes)...
readmem: -fffffff7fcd40000 58000
Traceback (most recent call last):
  File "/Users/speter/asahi/git/m1n1/proxyclient/tools/chainload.py", line 37, in <module>
    sepfw_start, sepfw_length = u.adt["chosen"]["memory-map"].SEPFW
  File "/Users/speter/asahi/git/m1n1/proxyclient/m1n1/proxyutils.py", line 326, in __getitem__
    return self._adt[item]
  File "/Users/speter/.asdf/installs/python/3.10.1/lib/python3.10/functools.py", line 970, in __get__
    val = self.func(instance)
  File "/Users/speter/asahi/git/m1n1/proxyclient/m1n1/proxyutils.py", line 324, in _adt
    return adt.load_adt(self._utils.get_adt())
  File "/Users/speter/asahi/git/m1n1/proxyclient/m1n1/proxyutils.py", line 184, in get_adt
    self.adt_data = self.iface.readmem(adt_base, self.ba.devtree_size)
  File "/Users/speter/asahi/git/m1n1/proxyclient/m1n1/proxy.py", line 385, in readmem
    req = struct.pack("<QQ", addr, size)
struct.error: argument out of range

Mac mini 12+ DCP initialization fails with some monitors

I have two monitors: An iiyama ProLite E2473HDS (1080p) and a Philips 279P1 (4K). They do not work with m1n1 from a 12.1 Mac mini (connected over HDMI).
When m1n1 starts, the 1080p monitor wakes up from sleep (power LED turns blue), and a few seconds later displays “No signal” and goes back to sleep. m1n1 logs (including the DCP syslog messages) indicate nothing out of the ordinary; the display is correctly recognized at the correct resolution/refresh rate. In fact, the log is identical to the one produced when the mini is connected to a 1080p capture card.
The 4K monitor does not seem to even wake up.

I’ve messed with m1n1’s display init code (mostly with the 1080p monitor since it’s not my primary display) and found out the following:

  • The monitor wakes up from sleep when dcp_ib_swap_begin is called.
  • Calling dcp_ib_set_mode after dcp_ib_swap_begin does not change anything at that point.
  • Calling dcp_ib_get_hpd in a loop after dcp_ib_swap_begin shows that connected goes back to 0 after 1-2 seconds, then goes back to 1 after ~400ms.
  • Calling dcp_ib_set_mode after connected is back to 1, then completing the swap (dcp_ib_swap_set_layer/dcp_ib_swap_end) makes the monitor work correctly; it will actually show m1n1 logo/console. It still takes a couple of seconds after completing the swap for the image to actually appear.
  • When rebooting, the situation is messier; after the call to dcp_ib_swap_begin, the monitor will still disconnect/reconnect, but after 5-6 seconds, not 1-2 seconds. It is, however, not necessary to wait for the disconnection: calling dcp_ib_set_mode a couple of seconds after dcp_ib_swap_begin seems to prevent the disconnection, and the monitor works afterwards.

I managed to make both my monitors work by making these changes: wait up to 5 seconds for the display to disconnect; if it does, wait for it to reconnect and call dcp_ib_set_mode; if it doesn’t, call dcp_ib_set_mode anyway.

This has the obvious issue of slowing down startup by at least 5 seconds on all monitors; it also seems very fragile and timing-dependent. I’m guessing there must be a better solution, since the monitors work (most of the time) in m1n1 with 11.6 iBoot, and it doesn’t seem to wait 5 seconds for the monitor to disconnect/reconnect… (I’ve tried to measure the time iBoot takes before starting m1n1, and it seems 11.6 is only slower than 12.1 by 900ms)

Second Display is not detected.

Hi, I have a Mac Mini and I use the HDMI port in order to my main monitor but my second display is not detected, I using an adapter type c with 2 connections HDMI and VGA in this case I use another HDMI port.

I tried reboot the system and disconnect and connect the port and still not working.

image

Another thing is my monitor is 120Hz. How I can help to set 120 Hz.

Proxy memory barriers

While apparently functional at the moment, ARM says you need to use DSB's after the data cache invalidate and another after the instruction/branch predictor invalidate. They can both be dsb ish. After the second dsb ish it says to use isb. The code that doesn't use this is the msr/mrs/inst functionality in the proxy, which just does cleans without synchronization barriers.

The first dsb forces the data cache invalidate to be completed before the instruction cache invalidate, the second dsb makes sure that the instruction cache invalidate is complete, the isb ensures that the instruction fetch itself will be clean state. Then you can branch to the new code.

Reference manual here:
image

There's also some additional semantics for doing instruction writes that need to be visible to another processor, namely that the other processor completes it's own isb locally before jumping into the newly written code (in additional to the previously mentioned requirements). The dsb ish all must take place on the writing processor, as while it guarantees completion of the cache clean on all other processors before completion, it only applies to locally issued cache cleans (so executing it on the secondary processor would not work).

Trouble with bootlogo_128.o and bootlogo_256.o not in the tree

Dear all,

I am trying to build m1n1 to use it in my MacStudio. But I am having trouble with a simple make because it complains that there is no rule to process the logos:

  TAG   build/build_tag.h
  CFG   build/build_cfg.h
  CC    build/adt.o
  CC    build/afk.o
  CC    build/aic.o
  CC    build/asc.o
make: *** No rule to make target 'data/bootlogo_128.png', needed by 'build/bootlogo_128.bin'.  Stop.

The png files with the logos are there, but not the .o. Also, if I comment line X in the Makefile it can run fine until it complains in fb.c that there is a problem with the logo.

Is it supposed to be a src/bootlogo_128.o or src/bootlogo_256.o? Is convert supposed to handle this automatically? Sorry I believe I am missing something very easy, but I can't seem to figure it out.

Thank you very much for your support.

FDT: DT CPU 2 MPIDR mismatch 0x2 != 0x10100

Trying to boot Asahi Linux on MacBookPro18,2 M1 Max .

sudo python3.9 m1n1/proxyclient/tools/linux.py -b 'earlycon console=ttySAC0,1500000 console=tty0 debug' Image.gz t8103-j274.dtb initrd.gz
m1n1 base: 0x1000461c000
Setting boot args: "earlycon console=ttySAC0,1500000 console=tty0 debug"
Loading 6336201 bytes to 0x10013a70200..0x1001407b0c9...
...........................................................................................................................................................................................................
Loading DTB to 0x1001407b100...
Kernel_base: 0x10014200000
Loading 27649945 initramfs bytes to 0x10034200000...
...........................................................................................................................................................................................................
TTY> Starting secondary CPUs...
TTY> Starting CPU 1 (0:1)... Started.
TTY> Starting CPU 2 (1:0)... Started.
TTY> Starting CPU 3 (1:1)... Started.
TTY> Starting CPU 4 (1:2)... Started.
TTY> Starting CPU 5 (1:3)... Started.
TTY> Starting CPU 6 (2:0)... Started.
TTY> Starting CPU 7 (2:1)... Started.
TTY> Starting CPU 8 (2:2)... Started.
TTY> Starting CPU 9 (2:3)... Started.
TTY> FDT: bootargs = 'earlycon console=ttySAC0,1500000 console=tty0 debug'
TTY> FDT: initrd at 0x10034200000 size 0x1a5e799
TTY> FDT: framebuffer@107d1b10000 base 0x107d1b10000 size 0x1d73c00
TTY> ADT: 64 bytes of random seed available
TTY> FDT: KASLR seed initialized
TTY> FDT: Passing 64 bytes of random seed
TTY> FDT: DRAM at 0x10000000000 size 0x800000000
TTY> FDT: Usable memory is 0x10001e28000..0x107cb154000 (0x7c932c000)
TTY> FDT: CPU 1 MPIDR=0x1 release-addr=0x10004a8c050
TTY> FDT: DT CPU 2 MPIDR mismatch: 0x2 != 0x10100
DT prepare failed

No screen output on macOS 12

I configure-boot m1n1.macho and m1n1.bin separately on macOS-12.0.1 and macOS-12.1, but no screen output of HDMI.

Then I restore macOS to 11.6 on DFU mode with ipsw file, and using m1n1.macho it works well.
I think something wrong on macOS 12+

is it possible to install Ubuntu with "UEFI Environment only" option?

Hey,
I was thinking on testing this new technology out. I want to install ubuntu instead of arch linux and i think using the uefi environment option would make it work. however, i need to know how to boot into it and check if it is possible with m1 macbook pro architecture. Could you guys help me out here?

Duplicate entry for register SPRR_KMASK0_EL12 in apple_regs.json

Context

I'm using tools/apple_regs.json as input for other tools. This does not create issues in m1n1 (or at least I did not identify it myself).

Issue

The SPRR_KMASK0_EL12 register has 2 definitions such as:

line 144:

{"index": 0, "name": "SPRR_KMASK0_EL12",            "fullname": "SPRR Kernel Permission Unlock Mask (EL12)",                    "enc": [3, 4, 15, 6, 0  ], "width": 32},

line 216:

{"index": 0, "name": "SPRR_KMASK0_EL12",            "fullname": "SPRR Kernel Permission Unlock Mask 0 (EL12)",                  "enc": [3, 6, 15, 6, 0  ], "width": 32},

Since the first is defined adjacent to SPRR_UMASK*, I couldn't tell if it's a typo or if 2 registers are effectively used for the same thing.

I apologize in advance if this issue is not relevant :)

tps6598x_powerup failed for /arm-io/i2c0/hpmBusManager/hpm1

(Split off from #97)

On my MacBook Pro, which has run other kernels and boot loaders but is currently loading vanilla m1n1, commit c2c6da3, directly from iBoot, I occasionally see messages like:

TTY> i2c: want to read 1 bytes from addr 63 but can only read 0
TTY> usb: tps6598x_powerup failed for /arm-io/i2c0/hpmBusManager/hpm1.
TTY> usb: failed to init hpm1

I've been unable to reproduce this at will. I've never seen the problem except when the power supply was connected to either one of the USB-C ports. However, it's always hpm1 that's mentioned in the error message.

In #72, @jannau mentions he had to add delays to the i2c code in order to avoid similar-sounding issues. Do you want me to try doing that?

tunable: unable to find ADT node /arm-io/apcie/pci-bridge1.

`
$ sudo M1N1DEVICE=/dev/ttyACM0 python3.9 linux.py -b 'earlycon console=ttySAC0,1500000 console=tty0 debug' Image.gz t8103-j274.dtb initrd.gz

m1n1 base: 0x8031c8000
Setting boot args: "earlycon console=ttySAC0,1500000 console=tty0 debug"
Loading 6349721 bytes to 0x810448200..0x810a56599...
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Loading DTB to 0x810a565c0...
Kernel_base: 0x810c00000
Loading 27650501 initramfs bytes to 0x830c00000...

................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

TTY> Starting secondary CPUs...
TTY> Starting CPU 1 (0:1)... Started.
TTY> Starting CPU 2 (0:2)... Started.
TTY> Starting CPU 3 (0:3)... Started.
TTY> Starting CPU 4 (1:0)... Started.
TTY> Starting CPU 5 (1:1)... Started.
TTY> Starting CPU 6 (1:2)... Started.
TTY> Starting CPU 7 (1:3)... Started.
TTY> FDT: bootargs = 'earlycon console=ttySAC0,1500000 console=tty0 debug'
TTY> FDT: initrd at 0x830c00000 size 0x1a5e9c5
TTY> FDT: framebuffer@9df4e4000 base 0x9df4e4000 size 0xfa0000
TTY> ADT: 64 bytes of random seed available
TTY> FDT: KASLR seed initialized
TTY> FDT: Passing 64 bytes of random seed
TTY> FDT: DRAM at 0x800000000 size 0x200000000
TTY> FDT: Usable memory is 0x8019c4000..0x9d93e4000 (0x1d7a20000)
TTY> FDT: CPU 1 MPIDR=0x1 release-addr=0x803298110
TTY> FDT: CPU 2 MPIDR=0x2 release-addr=0x803298150
TTY> FDT: CPU 3 MPIDR=0x3 release-addr=0x803298190
TTY> FDT: CPU 4 MPIDR=0x10100 release-addr=0x8032981d0
TTY> FDT: CPU 5 MPIDR=0x10101 release-addr=0x803298210
TTY> FDT: CPU 6 MPIDR=0x10102 release-addr=0x803298250
TTY> FDT: CPU 7 MPIDR=0x10103 release-addr=0x803298290
TTY> FDT prepared at 0x808338000
Uncompressing gz ...
15026688
Decompress OK...
Ready to boot
DAIF: c0
TTY> tunable: unable to find ADT node /arm-io/apcie/pci-bridge1.
TTY> pcie: Error applying apcie-config-tunables for /arm-io/apcie/pci-bridge1
TTY> Preparing to boot kernel at 0x810c00000 with fdt at 0x808338000
`

I can boot into m1n1 successfully but when I try to boot the kernel, it always display 'unable to find ADT mode ...'. Then the screen stucks at a Apple icon. I think I have followed the steps in README. It looks like M1N1 have some trouble when dealing with ADT? or I miss something?

Enable the notch

According to the two blog posts that mention the notch, support for drawing on the entire screen will be added in the future. This is the commit that hides it: 287a963

I have interest in this feature, and I noticed there was no issue for it yet.

Makefile

Are you building this the standard way by including libSystem, or have you found a more bare-metal way?

proxyclient ADT decoder faults on pmgr devices with iPhone 5S/6 ADT

Example output:

python3 -m m1n1.adt ~/DeviceTree.n61ap.bin > n61_m1n1parsed
Exception parsing /device-tree/arm-io/pmgr.devices value 8000020100000000000000000500000035de000070fd34000000000000000000435055300000000000000000000000008000020200000000000001000600000035de000070fd3400000000000000000043505531000000000000000000000000100002030000000000000000000000000000000000000000000000000000000043505500000000000000000000000000030000040000000000001f01000000000000000000000000000000000000000053494f5f500000000000000000000000000000060000000000000902000000000000000000000000010000000c00000055534200000000000000000000000000000000080600000000000a0201000000991903000c62000000000000000000005553424354524c0000000000000000000000000a0800000000000b02000000000000000000000000000000000000000055534232484f535430000000000000000000000c0800000000000d02000000000000000000000000000000000000000055534232484f535431000000000000000000000e0800000000000f02000000000000000000000000000000000000000055534232484f5354320000000000000020000010000000000b00150201000000b8be0600000000000100000007000000444953505f4255534d55580000000000200000120000000005001b020100000031280000146e010001000000010000004d4544494100000000000000000000002300001600000000190003030100000066260a003dea01000100000000000000414e5300000000000000000000000000000000180000000000001a02040000000000fa000a971300010000000600000049535000000000000000000000000000200000191200000007001c020100000099d96200c420040001000000020000004d5352000000000000000000000000002000001a1200000006001d020100000028dc1500c420040001000000030000004a5047000000000000000000000000002000001b1200000009000003020000000000c8003dca0e00010000000400000056454e430000000000000000000000002000001c100000000a0016020100000066e652007ad405000100000008000000444953503000000000000000000000002300001d100000000c00190201000000f5286100494c040001000000090000004449535031000000000000000000000010000020180000000000000000000000000000000000000000000000000000004953505f44415254000000000000000010000021190000000000000000000000000000000000000000000000000000004d53525f444152540000000000000000100000221a0000000000000000000000000000000000000000000000000000004a50475f444152540000000000000000100000231b0000000000000000000000000000000000000000000000000000004156455f444152540000000000000000100000241c00000000000000000000000000000000000000000000000000000044495350305f44415254000000000000100000251d00000000000000000000000000000000000000000000000000000044495350315f4441525400000000000010010126000000000000000004000000000050000a97130000000000000000004953502d46415354000000000000000010010127000000000000000002000000000064003dca0e00000000000000000056454e432d464153540000000000000010010128000000000000000003000000a330110028dc02000000000000000000564445432d46415354000000000000001001012900000000000000000100000099192200c420040000000000000000004a50472d464153540000000000000000000002300000000000000800000000000000000000000000000000000000000043504d0000000000000000000000000030000031000000000100000000000000000000000000000000000000000000004c494f5f4146000000000000000000002300003200000000000000010100000078e90000ba69020000000000000000004c494f000000000000000000000000000300003300000000000001010000000000000000000000000000000000000000494f4d5558000000000000000000000003000034000000000000020100000000000000000000000000000000000000004149430000000000000000000000000003000035000000000000030100000000000000000000000000000000000000004445425547000000000000000000000003000036000000000000040100000000000000000000000000000000000000004457490000000000000000000000000003000037000000000000050107000000991919000000000000000000000000004750494f00000000000000000000000024000038000000001a0004020000000000000000000000000000000000000000504349455f5245460000000000000000200000390000000004000103010000001ec51300353e0100010000000d000000504349450000000000000000000000000000003a00000000000002030000000000000000000000000000000000000000504349455f415558000000000000000000000040040000000000060101000000000006000000000000000000000000004d43413000000000000000000000000000000041040000000000070101000000000006000000000000000000000000004d43413100000000000000000000000000000042040000000000080101000000000006000000000000000000000000004d43413200000000000000000000000000000043040000000000090101000000000006000000000000000000000000004d434133000000000000000000000000000000440400000000000a0101000000000006000000000000000000000000004d434134000000000000000000000000000000450400000000000b01000000000000000000000000000000000000000050574d30000000000000000000000000000000460400000000000c01000000000000000000000000000000000000000049324330000000000000000000000000000000470400000000000d01000000000000000000000000000000000000000049324331000000000000000000000000000000480400000000000e01000000000000000000000000000000000000000049324332000000000000000000000000000000490400000000000f010000000000000000000000000000000000000000493243330000000000000000000000000000004a04000000000010010000000000000000000000000000000000000000535049300000000000000000000000000000004b04000000000011010000000000000000000000000000000000000000535049310000000000000000000000000000004c04000000000012010000000000000000000000000000000000000000535049320000000000000000000000000000004d0400000000001301000000000000000000000000000000000000000053504933000000000000000000000000030000500400000000001401000000000000000000000000000000000000000055415254300000000000000000000000030000510400000000001501000000000000000000000000000000000000000055415254310000000000000000000000030000520400000000001601000000000000000000000000000000000000000055415254320000000000000000000000030000530400000000001701000000000000000000000000000000000000000055415254330000000000000000000000030000540400000000001801000000000000000000000000000000000000000055415254340000000000000000000000030000550400000000001901000000000000000000000000000000000000000055415254350000000000000000000000030000560400000000001a01000000000000000000000000000000000000000055415254360000000000000000000000030000570400000000001b01000000000000000000000000000000000000000055415254370000000000000000000000030000580400000000001c01000000000000000000000000000000000000000055415254380000000000000000000000030000590400000000001d010000000000000000000000000000000000000000414553300000000000000000000000002300005a0400000003001e0101000000c215010000000000000000000000000053494f000000000000000000000000002000005b0c00000017000002000000000000000000000000000000000000000048534943305f504859000000000000002000005c0e00000018000102000000000000000000000000000000000000000048534943315f50485900000000000000000000600000000000000202000000000000000000000000000000000000000049535053454e53300000000000000000000000610000000000000302000000000000000000000000000000000000000049535053454e533100000000000000002300006200000000100006020100000066665500d9ce010000000000000000004d43430000000000000000000000000023000063000000000f0007020100000099190000852b010000000000000000004d4355000000000000000000000000000300006400000000000008020000000000000000000000000000000000000000414d5000000000000000000000000000000000670a00000000000c02000000000000000000000000000000000000000055534232484f5354305f4f484349000000000069080000000000110200000000000000000000000000000000000000005553424f5447000000000000000000002300006a000000000e001202010000000080210068b100000000000000000000534d58000000000000000000000000002300006b000000000d0013020100000099991500eb5101000000000000000000534600000000000000000000000000000300006c00000000000014020000000000000000000000000000000000000000435000000000000000000000000000001000006d000000000000000000000000000000000000000000000000000000004350552d425553590000000000000000130000701c00000000000000000000000000000000000000000000000000000044495350302d5600000000000000000003000071100000000000170200000000000000000000000000000000000000004d4950495f4453490000000000000000010000721c000000000018020100000000005000000000000000000000000000445000000000000000000000000000001000007400000000000000000000000000000000000000000000000000000000444953502d46422d41435449564500001000007600000000000000000000000000000000000000000000000000000000444953502d4d49452d44504200000000200000771200000008001e0203000000cccc0a0028dc02000100000005000000564445430000000000000000000000000000007c0000000000000403000000000000000000000000020000000a0b0000474658000000000000000000000000002b00007d00000000020000040000000000000000000000000000000000000000534550000000000000000000000000001000007e00000000000000000000000000000000000000000000000000000000535743505400000000000000000000003100008000000000110000000000000000000000000000000000000000000000414d504341485f4649584544000000003100008100000000120000000000000000000000000000000000000000000000414d504341565f4649584544000000003100008200000000130000000000000000000000000000000000000000000000414d50445148305f46495845440000003100008300000000140000000000000000000000000000000000000000000000414d50445156305f46495845440000003100008400000000150000000000000000000000000000000000000000000000414d50445148315f46495845440000003100008500000000160000000000000000000000000000000000000000000000414d50445156315f4649584544000000000000861b00000000000005000000000000000000000000000000000000000056454e435f5049504500000000000000000000871b00000000000105000000000000000000000000000000000000000056454e435f4d45300000000000000000000000881b00000000000205000000000000000000000000000000000000000056454e435f4d45310000000000000000:
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Volumes/Projects/m1n1/proxyclient/m1n1/adt.py", line 581, in <module>
    assert new_data == adt_data[:len(new_data)]
AssertionError

Similar failures pop up when using 5S (n51/53) ADTs from the latest IPSWs.

Native keyboard support

As a not so well educated user I would greatly appreciate support for native keyboard of MacBook Air/Pro

Windows support?

First of all, I'd like to express my gratitude and respect about what you are doing here, and I find it enjoyable to watch the work streams on YouTube even though it takes hours and I do learn a lot new stuff from them.

It occurred to me while watching you working that have you ever considered the possibility to boot Windows using m1n1, if so, is there any plan to support Windows to make m1n1 an open sourced BootCamp?

Serial crash when trying to boot t6000 dev kernel with hypervisor

I am currently trying to boot my MBP 14 Pro (target) from my M1 Mini (proxy) using the KDK Version 12.3 (21E230) & the following command sequence:

export M1N1DEVICE=/dev/cu.usbmodemP_01
./proxyclient/tools/chainload.py -r build/m1n1.bin
python3 proxyclient/tools/run_guest.py -S -m hv/trace_all.py -s ../macOS.kernel/t6000.21E230.DWARF ../macOS.kernel/dev.kc.macho.development -- "cpus=1 debug=0x14e serial=3 apcie=0xffffffef -enable-kprintf-spam wdt=-1"

The kernel starts to boot but after a few seconds it crashes with the following output (and the MBP rebooting):

[cpu0][0xfffffe00138efd28] MMIO: W.4   0x291e6f0ec (unknown, offset 0x291e6f0ec) = 0x0
[cpu0][0xfffffe001460e688] MMIO: R.4   0x2920a1300 (nub-spmi0[0], offset 0x00) = 0x1000100
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.9/site-packages/serial/serialposix.py", line 575, in read
    buf = os.read(self.fd, size - len(read))
OSError: [Errno 6] Device not configured

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<console>", line 1, in <module>
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/shell.py", line 129, in display
    val()
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/hv.py", line 1440, in start
    self.p.hv_start(self.entry, self.guest_base + self.bootargs_off)
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/proxy.py", line 975, in hv_start
    return self.request(self.P_HV_START, entry, *args)
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/proxy.py", line 643, in request
    return self._request(opcode, *args2, **kwargs)
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/proxy.py", line 609, in _request
    reply = self.iface.proxyreq(req, reboot=reboot, no_reply=no_reply, pre_reply=None)
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/proxy.py", line 356, in proxyreq
    return self.reply(self.REQ_PROXY)
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/proxy.py", line 230, in reply
    reply += self.readfull(1)
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/proxy.py", line 167, in readfull
    block = self.dev.read(size - len(d))
  File "/opt/homebrew/lib/python3.9/site-packages/serial/serialposix.py", line 581, in read
    raise SerialException('read failed: {}'.format(e))
serial.serialutil.SerialException: read failed: [Errno 6] Device not configured

Things I have tried:

  • Increasing CPU to cpu=2+ but I get this instead:
[cpu1][0xfffffe0013e3ecec] MMIO: R.1   0x59020000e (apcie[0], offset 0x20000e) = 0x80
Event checksum error: Expected 0x00150100, got 0xd0decade
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<console>", line 1, in <module>
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/shell.py", line 129, in display
    val()
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/hv.py", line 1440, in start
    self.p.hv_start(self.entry, self.guest_base + self.bootargs_off)
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/proxy.py", line 978, in hv_start
    return self.request(self.P_HV_START, entry, *args)
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/proxy.py", line 646, in request
    return self._request(opcode, *args2, **kwargs)
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/proxy.py", line 612, in _request
    reply = self.iface.proxyreq(req, reboot=reboot, no_reply=no_reply, pre_reply=None)
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/proxy.py", line 359, in proxyreq
    return self.reply(self.REQ_PROXY)
  File "/Users/robin/Developer/m1n1/proxyclient/m1n1/proxy.py", line 259, in reply
    raise UartChecksumError()
m1n1.proxy.UartChecksumError
  • Increasing iface.dev.timeout = 1 in proxy.py (no change).
  • Using trace_pmgr.py instead of trace_all.py (no change).
  • Setting the baud to 256000 using export M1N1DEVICE=/dev/cu.usbmodemP_01:256000 (no change)

No more output after "Booting kernel at ..."

First of all, thank you all for the effort put into this project!

I am trying to get Linux to boot and everything works up until m1n1 jumps into the kernel. There is no more output after that.
I followed the instructions here and here step by step and there were no errors whatsoever. The m1n1 log looks fine to me up to the last message Booting kernel at 0x811200000 with fdt at 0x808d60000.
Also tried embedding the kernel directly in m1n1 with exactly the same result.

My setup:

  • Build machine: Debian 10 Arm VM running on M1
  • Host: M1 Mac Mini connected to a M1 MacBook Air running macvdmtool

I am happy to debug it myself but I am not sure where to start. Any help is appreciated.

Full log:

python linux.py -b 'earlycon console=ttySAC0,1500000 console=tty0 debug' ../build/Image.gz ../build/apple-j274.dtb
Base at: 0x804690000
FB at: 0x9e0df8000
Setting boot args: "earlycon console=ttySAC0,1500000 console=tty0 debug"
.
Loading 1992012 bytes to 0x810e6c040..0x81105258c...
....................................................................................................................................................................................................................................................
Loading DTB to 0x8110525c0...
Kernel_base: 0x811200000
TTY> Starting secondary CPUs...
TTY> Starting CPU 1 (0:1)... OK
TTY>   Stack base: 0x804744040
TTY>   MPIDR: 0x80000001
TTY>   CPU: M1 Icestorm
TTY>   Index: 1 (table: 0x80475c080)
TTY>
TTY> Starting CPU 2 (0:2)... OK
TTY>   Stack base: 0x804748040
TTY>   MPIDR: 0x80000002
TTY>   CPU: M1 Icestorm
TTY>   Index: 2 (table: 0x80475c0c0)
TTY>
TTY> Starting CPU 3 (0:3)... OK
TTY>   Stack base: 0x80474c040
TTY>   MPIDR: 0x80000003
TTY>   CPU: M1 Icestorm
TTY>   Index: 3 (table: 0x80475c100)
TTY>
TTY> Starting CPU 4 (1:0)... OK
TTY>   Stack base: 0x804750040
TTY>   MPIDR: 0x80010100
TTY>   CPU: M1 Firestorm
TTY>   Index: 4 (table: 0x80475c140)
TTY>
TTY> Starting CPU 5 (1:1)... OK
TTY>   Stack base: 0x804754040
TTY>   MPIDR: 0x80010101
TTY>   CPU: M1 Firestorm
TTY>   Index: 5 (table: 0x80475c180)
TTY>
TTY> Starting CPU 6 (1:2)... OK
TTY>   Stack base: 0x804758040
TTY>   MPIDR: 0x80010102
TTY>   CPU: M1 Firestorm
TTY>   Index: 6 (table: 0x80475c1c0)
TTY>
TTY> Starting CPU 7 (1:3)... OK
TTY>   Stack base: 0x80475c040
TTY>   MPIDR: 0x80010103
TTY>   CPU: M1 Firestorm
TTY>   Index: 7 (table: 0x80475c200)
TTY>
TTY> FDT: bootargs = 'earlycon console=ttySAC0,1500000 console=tty0 debug'
TTY> FDT: framebuffer@9e0df8000 base 0x9e0df8000 size 0x7e9000
TTY> ADT: 64 bytes of random seed available
TTY> FDT: KASLR seed initialized
TTY> FDT: Passing 64 bytes of random seed
TTY> FDT: DRAM at 0x800000000 size 0x200000000
TTY> FDT: Usable memory is 0x80134c000..0x9db5e0000 (0x1da294000)
TTY> FDT: CPU 0 MPIDR=0x0 release-addr=0x80475c050
TTY> FDT: CPU 1 MPIDR=0x1 release-addr=0x80475c090
TTY> FDT: CPU 2 MPIDR=0x2 release-addr=0x80475c0d0
TTY> FDT: CPU 3 MPIDR=0x3 release-addr=0x80475c110
TTY> FDT: CPU 4 MPIDR=0x10100 release-addr=0x80475c150
TTY> FDT: CPU 5 MPIDR=0x10101 release-addr=0x80475c190
TTY> FDT: CPU 6 MPIDR=0x10102 release-addr=0x80475c1d0
TTY> FDT: CPU 7 MPIDR=0x10103 release-addr=0x80475c210
TTY> FDT prepared at 0x808d60000
Uncompressing gz ...
5627912
Decompress OK...
Ready to boot
DAIF: c0
--- TTY mode | Quit: CTRL+] | Menu: CTRL+T ---
MMU: shutting down...
MMU: shutdown successful, clearing caches
Booting kernel at 0x811200000 with fdt at 0x808d60000

Mac Studio support?

Hello, what is the ETA for support for the Mac Studio? Dying to try this out.

Trouble in booting Linux under Hypervisor.

Here's the log when I directly boot the Linux. Although the Linux can boot up, the log on the host side shows like this.

zec@ubuntu-zec:~/GitTools/m1n1/proxyclient/tools$ sudo M1N1DEVICE=/dev/ttyACM0 python3.9 linux.py -b 'earlycon console=SAC0,1500000 console=tty0 debug' asahi_Image.gz asahi.dtb initramfs-busybox.cpio.gz

TTY> CPU init... CPU: M1 Icestorm
TTY>
TTY> boot_args at 0x808e08000
TTY> revision: 2
TTY> version: 2
TTY> virt_base: 0xfffffe001b9c4000
TTY> phys_base: 0x8019c4000
TTY> mem_size: 0x1d7a20000
TTY> top_of_kdata: 0x808e0c000
TTY> video:
TTY> base: 0x9df4e4000
TTY> display: 0x1
TTY> stride: 0x2800
TTY> width: 2560
TTY> height: 1600
TTY> depth: 0x1001e
TTY> machine_type: 0
TTY> devtree: 0xfffffe001e508000
TTY> devtree_size: 0x5c000
TTY> cmdline:
TTY> boot_flags: 0x0
TTY> mem_size_act: 0x200000000
TTY>
TTY>
TTY>
TTY> m1n1 v63e8d0d-dirty
TTY> Copyright (C) 2021 The Asahi Linux Contributors
TTY> Licensed under the MIT license
TTY>
TTY> Running in EL2
TTY>
TTY> Heap base: 0x808e0c000
TTY> MMU: Initializing...
TTY> MMU: SCTLR_EL1: 30100180 -> 30901085
TTY> MMU: running with MMU and caches enabled!
TTY> fb init: 2560x1600 (30) [s=2560] @0x9df4e4000
TTY> fb console: max rows 46, max cols 64
TTY> fb: display logo
TTY> Device info:
TTY> Model: MacBookAir10,1
TTY> Target: J313
TTY> Board-ID: 0x26
TTY> Chip-ID: 0x8103
TTY>
TTY> WDT registers @ 0x23d2b0000
TTY> WDT disabled
TTY> pmgr: initialized, 268 devices found.
TTY> Initialization complete.
TTY> Checking for payloads...
TTY> No more payloads at 0x8046b8000
TTY> No valid payload found
TTY> USB0: initialized at 0x808e0c030
TTY> USB1: initialized at 0x808e0c440
TTY> Running proxy...
m1n1 base: 0x8045c0000
Setting boot args: "earlycon console=ttySAC0,1500000 console=tty0 debug"
Loading 6364959 bytes to 0x811840200..0x811e5211f...
.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Loading DTB to 0x811e52140...
Kernel_base: 0x812000000
Loading 2024993 initramfs bytes to 0x832000000...
........................................................................................................................................................................................................................................................
TTY> Starting secondary CPUs...
TTY> Starting CPU 1 (0:1)... Started.
TTY> Starting CPU 2 (0:2)... Started.
TTY> Starting CPU 3 (0:3)... Started.
TTY> Starting CPU 4 (1:0)... Started.
TTY> Starting CPU 5 (1:1)... Started.
TTY> Starting CPU 6 (1:2)... Started.
TTY> Starting CPU 7 (1:3)... Started.
TTY> FDT: bootargs = 'earlycon console=ttySAC0,1500000 console=tty0 debug'
TTY> FDT: initrd at 0x809730000 size 0x93e824
TTY> FDT: framebuffer@9df4e4000 base 0x9df4e4000 size 0xfa0000
TTY> ADT: 64 bytes of random seed available
TTY> FDT: KASLR seed initialized
TTY> FDT: Passing 64 bytes of random seed
TTY> FDT: DRAM at 0x800000000 size 0x200000000
TTY> FDT: Usable memory is 0x8019c4000..0x9d93e4000 (0x1d7a20000)
TTY> FDT: CPU 1 MPIDR=0x1 release-addr=0x804690110
TTY> FDT: CPU 2 MPIDR=0x2 release-addr=0x804690150
TTY> FDT: CPU 3 MPIDR=0x3 release-addr=0x804690190
TTY> FDT: CPU 4 MPIDR=0x10100 release-addr=0x8046901d0
TTY> FDT: CPU 5 MPIDR=0x10101 release-addr=0x804690210
TTY> FDT: CPU 6 MPIDR=0x10102 release-addr=0x804690250
TTY> FDT: CPU 7 MPIDR=0x10103 release-addr=0x804690290
TTY> FDT prepared at 0x80a070000
Uncompressing gz ...
15096320
Decompress OK...
Ready to boot
DAIF: c0
TTY> tunable: unable to find ADT node /arm-io/apcie/pci-bridge1.
TTY> pcie: Error applying apcie-config-tunables for /arm-io/apcie/pci-bridge1
TTY> Preparing to boot kernel at 0x812000000 with fdt at 0x80a070000
--- TTY mode | Quit: CTRL+] | Menu: CTRL+T ---
Preparing to run next stage at 0x812000000...
Exception in thread rx:
Traceback (most recent call last):
File "/usr/local/bin/lib/python3.9/threading.py", line 973, in _bootstrap_inner
--- Exit TTY mode ---
self.run()
File "/usr/local/bin/lib/python3.9/threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/bin/lib/python3.9/site-packages/serial/tools/miniterm.py", line 499, in reader
data = self.serial.read(self.serial.in_waiting or 1)
File "/usr/local/bin/lib/python3.9/site-packages/serial/serialposix.py", line 595, in read
raise SerialException(
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

It seems that some mistakes happen.

Then I want to boot the Linux on m1n1 hypervisor. The log shows like this.

zec@ubuntu-zec:~/GitTools/m1n1/proxyclient/tools$ sudo M1N1DEVICE=/dev/ttyACM1 python3.9 run_guest.py -S m1n1-payload.macho
TTY> CPU init... CPU: M1 Icestorm
TTY>
TTY> boot_args at 0x808e18000
TTY> revision: 2
TTY> version: 2
TTY> virt_base: 0xfffffe00119c4000
TTY> phys_base: 0x8019c4000
TTY> mem_size: 0x1d7a20000
TTY> top_of_kdata: 0x808e1c000
TTY> video:
TTY> base: 0x9df4e4000
TTY> display: 0x1
TTY> stride: 0x2800
TTY> width: 2560
TTY> height: 1600
TTY> depth: 0x1001e
TTY> machine_type: 0
TTY> devtree: 0xfffffe0014518000
TTY> devtree_size: 0x5c000
TTY> cmdline:
TTY> boot_flags: 0x0
TTY> mem_size_act: 0x200000000
TTY>
TTY>
TTY>
TTY> m1n1 v63e8d0d-dirty
TTY> Copyright (C) 2021 The Asahi Linux Contributors
TTY> Licensed under the MIT license
TTY>
TTY> Running in EL2
TTY>
TTY> Heap base: 0x808e1c000
TTY> MMU: Initializing...
TTY> MMU: SCTLR_EL1: 30100180 -> 30901085
TTY> MMU: running with MMU and caches enabled!
TTY> fb init: 2560x1600 (30) [s=2560] @0x9df4e4000
TTY> fb console: max rows 46, max cols 64
TTY> fb: display logo
TTY> Device info:
TTY> Model: MacBookAir10,1
TTY> Target: J313
TTY> Board-ID: 0x26
TTY> Chip-ID: 0x8103
TTY>
TTY> WDT registers @ 0x23d2b0000
TTY> WDT disabled
TTY> pmgr: initialized, 268 devices found.
TTY> Initialization complete.
TTY> Checking for payloads...
TTY> No more payloads at 0x8046c8000
TTY> No valid payload found
TTY> USB0: initialized at 0x808e1c030
TTY> USB1: initialized at 0x808e1c440
TTY> Running proxy...
Fetching ADT (0x0005C000 bytes)...
Disable iodev IODEV.USB1
Initializing hypervisor over iodev IODEV.USB0
TTY> Starting secondary CPUs...
TTY> Starting CPU 1 (0:1)... Started.
TTY> Starting CPU 2 (0:2)... Started.
TTY> Starting CPU 3 (0:3)... Started.
TTY> Starting CPU 4 (1:0)... Started.
TTY> Starting CPU 5 (1:1)... Started.
TTY> Starting CPU 6 (1:2)... Started.
TTY> Starting CPU 7 (1:3)... Started.
Removing ADT node /arm-io/dart-usb0
Removing ADT node /arm-io/atc-phy0
Removing ADT node /arm-io/usb-drd0
Removing ADT node /arm-io/acio0
Removing ADT node /arm-io/acio-cpu0
Removing ADT node /arm-io/dart-acio0
Removing ADT node /arm-io/apciec0
Removing ADT node /arm-io/dart-apciec0
Removing ADT node /arm-io/apciec0-piodma
Removing ADT node /arm-io/i2c0/hpmBusManager/hpm0
Removing ADT node /arm-io/atc0-dpxbar
Removing ADT node /arm-io/atc0-dpphy
Removing ADT node /arm-io/atc0-dpin0
Removing ADT node /arm-io/atc0-dpin1
Removing ADT node /arm-io/atc-phy0
LOAD: _HDR 16384 bytes from 0 to 0
LOAD: TEXT 131072 bytes from 4000 to 4000
LOAD: RODA 32768 bytes from 24000 to 24000
LOAD: DATA 393216 bytes from 2c000 to 2c000
ZERO: 1884160 bytes from 0x8c000 to 0x258000
LOAD: PYLD 8561277 bytes from 8c000 to 258000
SKIP: 58547587 bytes from 0xa8227d to 0x4258000
Total region size: 0x11d8000 bytes
Physical memory: 0x819740000 .. 0x9d93e4000
Guest region start: 0x81a7f8000
Mapping guest physical memory...
Loading kernel image (0xa82281 bytes)...
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Copying SEPFW (0x750000 bytes)...
Copying TrustCache (0x5c000 bytes)...
Adjusting addresses in ADT...
Setting up bootargs at 0x81b9cc000...
Setting secondary CPU RVBARs...
cpu1: [0x210150000] = 0x81a7fc000
cpu2: [0x210250000] = 0x81a7fc000
cpu3: [0x210350000] = 0x81a7fc000
cpu4: [0x211050000] = 0x81a7fc000
cpu5: [0x211150000] = 0x81a7fc000
cpu6: [0x211250000] = 0x81a7fc000
cpu7: [0x211350000] = 0x81a7fc000
Entering hypervisor shell. Type start to start the guest.

start
Disabling other iodevs...

  • IODEV.UART
  • IODEV.FB
  • IODEV.USB1
  • IODEV.USB0_SEC
  • IODEV.USB1_SEC
    Doing essential MMIO remaps...
    Updating page tables...
    PT[200000000:235200000] -> HW
    PT[235200000:235204000] -> RESERVED VUART
    PT[235204000:23b700420] -> HW
    PT[23b700420:23b700424] -> RESERVED PMGR HACK
    PT[23b700424:23b754000] -> HW
    PT[23b754000:23b754010] -> RESERVED CPU_START
    PT[23b754010:23d280088] -> HW
    PT[23d280088:23d28008c] -> RESERVED PMGR HACK
    PT[23d28008c:23d280098] -> HW
    PT[23d280098:23d28009c] -> RESERVED PMGR HACK
    PT[23d28009c:700000000] -> HW
    Uploading ADT (0x51110 bytes)...
    Improving logo...
    Shutting down framebuffer...
    Enabling SPRR...
    Enabling GXF...
    Jumping to entrypoint at 0x81a7fc800
    TTY> Exception taken from EL2h
    TTY> Running in EL2
    TTY> MPIDR: 0x80000000
    TTY> Registers: (@0x8046c7b30)
    TTY> x0-x3: 0000000000000000 000000080465b108 0000000000000001 0000000000000002
    TTY> x4-x7: 000000081a7fc800 0000000000000000 0000000000000005 000000000000c40c
    TTY> x8-x11: 00000000000000be 0000000000000010 00000000000000be 0000000000000014
    TTY> x12-x15: 0000000804660038 0000000000010000 00000000000003a0 0000000000000000
    TTY> x16-x19: 00000008045e6428 0000000000000000 0000000000000003 0000000804670000
    TTY> x20-x23: 0000000000000001 00040008045dfe22 00000008046c7d20 00000008045dfe20
    TTY> x24-x27: 000000081a7fc908 00000008045dfe20 00000000b9002020 0000000000000000
    TTY> x28-x30: 00000000addedbad 00000008046c7c30 00000008045dfe74
    TTY> PC: 0x8045e084c (rel: 0x1084c)
    TTY> SP: 0x8046c7c30
    TTY> SPSR_EL1: 0x600003c9
    TTY> FAR_EL1: 0x0
    TTY> ESR_EL1: 0x96000006 (data abort (current))
    TTY> L2C_ERR_STS: 0x11000ffc00000000
    TTY> L2C_ERR_ADR: 0x0
    TTY> L2C_ERR_INF: 0x0
    TTY> E_LSU_ERR_STS: 0x0
    TTY> E_FED_ERR_STS: 0x0
    TTY> E_MMU_ERR_STS: 0x0
    Traceback (most recent call last):
    File "/usr/local/bin/lib/python3.9/code.py", line 90, in runcode
    exec(code, self.locals)
    File "", line 1, in
    File "/home/zec/GitTools/m1n1/proxyclient/m1n1/shell.py", line 129, in display
    val()
    File "/home/zec/GitTools/m1n1/proxyclient/m1n1/hv.py", line 1297, in start
    self.p.hv_start(self.entry, self.guest_base + self.bootargs_off)
    File "/home/zec/GitTools/m1n1/proxyclient/m1n1/proxy.py", line 950, in hv_start
    return self.request(self.P_HV_START, entry, *args)
    File "/home/zec/GitTools/m1n1/proxyclient/m1n1/proxy.py", line 624, in request
    return self._request(opcode, *args2, **kwargs)
    File "/home/zec/GitTools/m1n1/proxyclient/m1n1/proxy.py", line 590, in _request
    reply = self.iface.proxyreq(req, reboot=reboot, no_reply=no_reply, pre_reply=None)
    File "/home/zec/GitTools/m1n1/proxyclient/m1n1/proxy.py", line 357, in proxyreq
    return self.reply(self.REQ_PROXY)
    File "/home/zec/GitTools/m1n1/proxyclient/m1n1/proxy.py", line 230, in reply
    reply += self.readfull(1)
    File "/home/zec/GitTools/m1n1/proxyclient/m1n1/proxy.py", line 167, in readfull
    block = self.dev.read(size - len(d))
    File "/usr/local/bin/lib/python3.9/site-packages/serial/serialposix.py", line 595, in read
    raise SerialException(
    serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

Some problem about serial things?

macOS12.3.1,M1,Downloading就自动结束了

xiaotaiyang@bogon ~ % curl https://alx.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1049 100 1049 0 0 969 0 0:00:01 0:00:01 --:--:-- 974

Bootstrapping installer:
Checking version...
Version: v0.3.26
Downloading...
xiaotaiyang@bogon ~ %

`dlmalloc.rs` assumes `realloc` will keep alignment from `posix_memalign`

The implementation of GlobalAlloc in dlmalloc.rs assumes realloc will keep the alignment of a heap chunk allocated with posix_memalign.

This is a) not guaranteed by POSIX and b) not implemented in dlmalloc.

A minimal example of this behaviour is given in this gist.

One simple solution could be to try to realloc_in_place, and fall back to another posix_memalign+memcpy if it cannot be done in place.

Unknown payload at 0x(varies) (magic 30837271)

I believe there's a glitch in the support of new bin file format for MacOS 12.1 stubs. Tested with version 8887493, which is the one in the current version of the pre-alpha installer.

The bootlog now contains the title line in all cold boots.

I did rebuild that version locally, and installed it on both a 12.0 and a 12.1 stub. Issue only present on 12.1. Issue is not present when chainloading, on both 12.0 and 12.1.

I blame C ;-)

The only impact I found is the line on the screen - everything seems to work. So don't hesitate to close wontfix.

A hunch about unkFloat in swap_submit_dcp()

Just read the Asahi Linux status update, great work people! At your rate of progress, my own neuroscience OSS software might run well on Asahi Linux, long before it runs bearable on macOS 12 with M1 SoC's :)

Looking at the signature of swap_submit_dcp() and the actual DPC interface, i have a hunch that the unkFloat 64 Bit double in ...

unkBool=False, unkFloat=0.0, unkInt=0, unkOutBool=outB)

... could be related to / an implementation of macOS Metal's MTLDrawable:presentAtTime: argument:
https://developer.apple.com/documentation/metal/mtldrawable/1470282-presentattime?language=objc

Iow. a double value presenting Mach host system time of when a swap should ideally occur? Assuming the DCP has a shared timebase with the ARM cpu, or some mapping happens? Would make sense, given that they offload other rather high-level things to the DCP.

Just a thought. Have a nice weekend
-mario

[help] question with the commands

Any help with this "kmutil configure-boot -c m1n1.bin --raw --entry-point 2048 --lowest-virtual-address 0 -v " where it says is it my linux volume or my mac os volume and where would I put my linux volume if so

dart.py: ioremap_at fails for large ranges

To map a 4K framebuffer (which works now), I used this code:

fbsize = 4096 * 4096 * 4
framebuffer = u.memalign(0x4000, fbsize)

disp_dart.iomap_at(0, 0xc000000, framebuffer, fbsize)

To my surprise, that failed to set up a mapping from 0xc000000..0xe000000 to the new framebuffer; it only set up the second half of the range, 0xe000000..0x10000000

Seems a fairly obvious bug in dart.py, but I don't fully understand what that code was ever supposed to do so I figured I'd report the issue as an issue first.

Secure boot support?

Hi,

I think it would be nice to allow stage 1 to check the hash of stage 2 in order to support secure boot. I'm not a macos expert but IIUC currently an evil maid could boot from a usb [0], mount the efi partition, and replace the stage 2 with a malicious binary without entering the admin password. All that renders locking of downstream u-boot and grub moot. It would be nice to be able to simply set the hash of stage 2 via a config variable.

[0] If booting from usb requires a full-security mode, then I suppose one could boot from an official macos installers, install a separate macos, perform the attack, and then clean up the macos afterwards.

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.