2021-01-09
00:02bear24rw_ has joined #asahi-re
00:02bear24rw has quit [Read error: Connection reset by peer]
00:06bear24rw_ has quit [Remote host closed the connection]
00:06bear24rw has joined #asahi-re
00:15bear24rw has quit [Remote host closed the connection]
00:16bear24rw has joined #asahi-re
00:26bear24rw has quit [Remote host closed the connection]
00:27bear24rw has joined #asahi-re
00:30bear24rw has quit [Remote host closed the connection]
00:31bear24rw has joined #asahi-re
00:39modwizcode has quit [Quit: Later]
00:40stormclad has joined #asahi-re
00:47stormclad has quit [Remote host closed the connection]
00:47stormclad has joined #asahi-re
01:07bear24rw has quit [Remote host closed the connection]
01:07bear24rw has joined #asahi-re
01:15* rwhitbynotes the System Information Thunderbolt Firmware Version is 0.0, whereas on Intel MBP it's 55.3
01:15aratuk has quit [Read error: Connection reset by peer]
01:16aratuk has joined #asahi-re
01:17rwhitbyLooking at the back of the M1 Mini, TBT Bus 0 is the left-hand port (closest to ethernet) and TBT Bus 1 is the right-hand port (closest to HDMI).
01:20aratuk has quit [Read error: Connection reset by peer]
01:21aratuk has joined #asahi-re
01:26aratuk has quit [Read error: Connection reset by peer]
01:27aratuk has joined #asahi-re
01:41krbtgt has quit [Quit: leaving]
01:47krbtgt has joined #asahi-re
01:51stormclad has quit [Ping timeout: 264 seconds]
02:16stormclad has joined #asahi-re
02:25davidrysk[m]rwhitby: yep, they advertise USB4 but not TBT4, because it doesn't support all the requirements of TBT4
02:26rwhitbyWell, TBT4 is just an Intel trademark which is identical technically to a fully-optioned USB4.
02:26stormclad has quit [Ping timeout: 260 seconds]
02:40roxfan has quit [Remote host closed the connection]
02:41aratuk has quit [Ping timeout: 246 seconds]
02:43roxfan has joined #asahi-re
02:46aratuk has joined #asahi-re
02:47aratuk_ has joined #asahi-re
02:48aratuk_ has quit [Read error: Connection reset by peer]
02:48aratuk__ has joined #asahi-re
02:49aratuk__ has quit [Read error: Connection reset by peer]
02:49aratuk_ has joined #asahi-re
02:50aratuk has quit [Ping timeout: 246 seconds]
02:56Namidairo has quit [Quit: ZNC - https://znc.in]
02:56Namidairo has joined #asahi-re
03:22stormclad has joined #asahi-re
03:47artemistHow does the kernel get the device tree? Does iBoot pass a pointer to it in a register?
03:54stormclad has quit [Ping timeout: 240 seconds]
03:56Shizartemist: I'm a bit unclear about that part of the boot proces as well; my guess rn is that the locations are hardcoded by the stage before iboot and loaded into mem
03:58roxfanon iphone devicetree was in a separate file which was decompressed and passed to the kernel as a blob IIRC
04:00artemistIf the Linux devicetrees and apple device trees are not binary compatible (or I need to change the compatible strings to fit Linux requirements) I wonder if it would be useful for me to write a converter
04:11davidrysk[m]j313ap is the macbook air, t485ap is the dtk
04:12Shizif you want to get the devicetree yourself without having access to an m1 cpu, its in the ipsw file :)
04:15marcanthe formats are different, but even if they were the same, the way devices are implemented is different
04:15marcanthey are both descended from the same concept, and the overall structure is quite similar
04:16marcaninstead, what will have to happen is we maintain parallel device tree images for all supported mac boards, and then if any dynamic stuff needs to be carried over, our bootloader will take care of translating only those bits
04:16marcanI did this for PS3, where I would pull some info from the hypervisor database and into the devicetree
04:17marcankeep in mind that with includes and overlays and such, this is all very nicely maintainable in linux
04:19artemistI was thinking that could be useful to make the bootloader compatible with all devices, then I realized you could just read "model" in the root and just read a device tree off the FS
04:27marcanyeah the bootloader should support all devices of course, it can just embed all devicetree blobs or read them from storage, depending on dependencies/etc
04:28davidrysk[m]an ioregistry dump from macOS might be useful as it is populated with dynamic as well as static information
04:29davidrysk[m]ah nice
04:29davidrysk[m]among other things it tells you what brcm firmware blobs you need
04:29artemistFunny how the device tree has several references to 10 gigabit ethernet and the AQ107 10 gigabit ethernet controller
04:29davidrysk[m]there's a 10GbE model of the mac mini that's apparently available to datacenters or something
04:38aead has joined #asahi-re
04:51davidrysk[m]it would be nice for someone to dump the NOR
04:51davidrysk[m]but it probably just has the second stage iBoot
04:52davidrysk[m](all of the bootloaders are iBoot — the first (ROM), second (NOR), and third (preboot partion) stage), just different "flavors"
04:58DarthCloud has quit [Remote host closed the connection]
04:58DarthCloud has joined #asahi-re
05:18Tokamak has quit [Ping timeout: 246 seconds]
05:20artemistDoes DFU happen in the first stage loader? Bricking something by messing up the NOR is not my idea of fun
05:24marcanDFU happens in the boot ROM. however, the NOR includes critical factory data, so if you wipe it, only apple can fix that (they'd still use DFU, but special software and tools to basically redo part of the manufacturing process)
05:25marcanhowever, if we can read it, I'll add that to our installer etc so that people can keep a backup
05:25davidrysk[m]it's interesting that the OS has a partition called FactoryData
05:26davidrysk[m]sorry, not OS, but one of the partitions in the Apple_APFS_ISC
05:27marcandavidrysk[m]: I think apple calls them SecureROM, iBoot1, iBoot2 or something like that, but yes they're all the same codebase
05:27davidrysk[m]Yeah, my question would be whether it copies everything from the NOR
05:28marcanwe might end end up with a boot chain along the lines of SecureROM -> iBoot1 -> iBoot2 -> mini -> U-Boot -> Linux :^)
05:28davidrysk[m]SecureROM -> LLB -> iBoot
05:28davidrysk[m]but apparently they got rid of LLB in the A10
05:28davidrysk[m]which means SecureROM loads iBoot directly? huh
05:28davidrysk[m]then what's in the NOR
05:28Shiz./preboot/System/Volumes/Preboot/00000000-0000-0000-0000-000000000000/boot/<x>/System/Library/Caches/com.apple.factorydata: broken symbolic link to /mnt6/FactoryData/System/Library/Caches/com.apple.factorydata
05:29davidrysk[m]UEFI support among other things
05:29Tokamak has joined #asahi-re
05:32artemistIf you want boot options then mini either needs to parse extlinux.conf (a complete pain) or you need u-boot
05:33ransom has quit [Quit: Textual IRC Client: www.textualapp.com]
05:56aratuk has joined #asahi-re
06:00aratuk_ has quit [Ping timeout: 272 seconds]
06:06aratuk has quit [Remote host closed the connection]
06:06aratuk has joined #asahi-re
06:11aratuk has quit [Ping timeout: 264 seconds]
06:42_whitelogger has joined #asahi-re
07:21bear24rw has quit [Remote host closed the connection]
07:22bear24rw has joined #asahi-re
08:26bear24rw has quit [Remote host closed the connection]
08:26bear24rw has joined #asahi-re
08:32bear24rw has quit [Ping timeout: 260 seconds]
08:51Necrosporus_ has joined #asahi-re
08:51Necrosporus is now known as Guest90598
08:51Necrosporus_ is now known as Necrosporus
08:51Guest90598 has quit [Killed (card.freenode.net (Nickname regained by services))]
08:56bear24rw has joined #asahi-re
09:13Tokamak has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
09:44bear24rw has quit [Remote host closed the connection]
09:44bear24rw has joined #asahi-re
09:49bear24rw has quit [Ping timeout: 265 seconds]
10:10maor26 has joined #asahi-re
10:57marcan changed the topic of #asahi-re to: Asahi Linux: porting Linux to Apple Silicon macs | Hardware / boot process / firmware interface reverse engineering | Keep things on topic | GitHub: https://alx.sh/g | Logs: https://alx.sh/l/asahi-re
11:00marcan changed the topic of #asahi-re to: Asahi Linux: porting Linux to Apple Silicon macs | Hardware / boot process / firmware interface reverse engineering | RE policy: https://alx.sh/re | GitHub: https://alx.sh/g | Logs: https://alx.sh/l/asahi-re
11:00marcan changed the topic of #asahi-re to: Asahi Linux: porting Linux to Apple Silicon macs | Hardware / boot process / firmware interface reverse engineering | RE policy: https://alx.sh/re | GitHub: https://alx.sh/g | Wiki: https://alx.sh/w | Logs: https://alx.sh/l/asahi-re
11:04marcannot at the moment, first thing I'm going to look at is the kernel itself just to make sure I understand the entrypoint, and after that I want to get the mini thing up and running so we can dump registers/etc
11:22konstater has joined #asahi-re
11:32GrumbleTurtle has joined #asahi-re
12:08aratuk has joined #asahi-re
12:12aratuk has quit [Ping timeout: 240 seconds]
12:31Necrosporusmarcan, is posting say NOR dump illegal?
12:50ronyrus[m] has joined #asahi-re
13:11davidrysk[m]I find it more useful to e.g. run `strings` on things at this point
14:00aratuk has joined #asahi-re
14:00brinly has quit [Quit: Connection closed for inactivity]
14:05aratuk has quit [Ping timeout: 246 seconds]
14:41reispflanze[m] has joined #asahi-re
15:19GrumbleTurtle has quit [Quit: WeeChat 2.9]
15:30stemnic has quit [Quit: The Lounge - https://thelounge.chat]
15:31stemnic has joined #asahi-re
15:40stemnic has quit [Ping timeout: 256 seconds]
16:01aratuk has joined #asahi-re
16:06aratuk has quit [Ping timeout: 272 seconds]
16:13modwizcode has joined #asahi-re
16:16bear24rw has joined #asahi-re
16:20bear24rw has quit [Ping timeout: 265 seconds]
17:07ransom has joined #asahi-re
17:48ransom has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
18:35aead has joined #asahi-re
18:35aead has quit [Changing host]
18:37stormclad has joined #asahi-re
18:43davidrysk[m]huh, looking more closely at xnu src it does seem that they used EL3 for the xnu monitor in the older chips, and then did CTRR and later KTRR to eliminate the need for EL3
18:43davidrysk[m]xnu-7195.50.7.100.1/osfmk/arm64/machine_routines_asm.s has a monitor_call() function, but the monitor-side code seems to have been removed from the xnu src
18:49stormclad has quit [Ping timeout: 256 seconds]
18:50davidrysk[m]Shiz: can you put your fixed-up dyld_shared_cache extractor somewhere?
18:51davidrysk[m]I was gonna fix it up myself but I'd rather not duplicate work, hah
18:51davidrysk[m]yeah idc
18:55davidrysk[m]I was reading about Memory Protection Keys for Userspace for x86_64 some time ago and it seems horrible compared to what Apple is doing
18:56davidrysk[m]> This post tries to detail the mechanism used in Apple’s A10 chips and later to prevent modification of an iOS kernel at runtime.
18:56davidrysk[m]> Older chips attempt to do this via a monitor program loaded in EL3, which is inherently flawed and bypassable though as detailed in “Tick Tock” by xerub.
19:03davidrysk[m]yep :)
19:09davidrysk[m]Shiz: I run into issues with the availability macros
19:10davidrysk[m]I can patch it out of dyld.h :)
19:10davidrysk[m]but maybe you had a better fix
19:11davidrysk[m]a lot of this stuff depends on other crap that's also on opensource.apple.com but building it correctly is a huge mess
19:11davidrysk[m]there used to be darwinbuild but it's dead
19:14modwizcodeYeah Apple's method seems kinda nice as opposed to the insane thing Intel came up with
19:14flokk[m] has joined #asahi-re
19:18davidrysk[m]oh yeah tip if you're limited for disk space: cp -c will make a reflink copy
19:19davidrysk[m](copy on write, like cp --reflink=always on linux)
19:19davidrysk[m](well, linux with btrfs or xfs)
19:24davidrysk[m]Shiz: > re:string, libbootpolicy.dylib is *extremely* verbose
19:24davidrysk[m]are they using objc or swift?
19:25davidrysk[m]due to dynamic runtime crap, objc/swift compiled binaries necessarily have lots of strings in them
19:26davidrysk[m]Shiz: did you see how much crap bputil prints out if you enable debugging?
19:26davidrysk[m]well, yep
19:26davidrysk[m]that's my point
19:28davidrysk[m]hm, probably just un-stripped
19:28davidrysk[m]with mach-o, full debug information is stored separately from the binaries
19:29davidrysk[m]dSYMs contain a dwarf file
19:29davidrysk[m]the dwarf files for some kernels can be found in the KDKs
19:29davidrysk[m](including for the t8020 kernels for the DTK)
19:29davidrysk[m]I believe the t8101 debug kernels are waiting for configure-boot to be finished
19:29davidrysk[m]they'll be incredibly useful for kext dev
19:30davidrysk[m](which isn't what we're doing here)
19:30modwizcodeDoes apple actually intend kext dev to continue?
19:30davidrysk[m]modwizcode: they wrote a fair amount of documentation for it
19:31davidrysk[m]I expect to see it for a few specific use cases: primarily filesystems and stuff that requires maximum performance
19:31modwizcodeFor recent stuff?
19:31davidrysk[m]though I do hope they implement a proper FUSE layer in macOS 12
19:32modwizcodeI wouldn't be surprised if they added a FUSE like layer, they've definitely tried to move most of the driver stuff into userspace
19:33karthek has joined #asahi-re
19:34karthek has quit [Remote host closed the connection]
19:35davidrysk[m]it makes lots of sense to move as much of the driver stuff as possible to userspace
19:36davidrysk[m]and since Apple controls the hardware down to the architecture level now, they can modify the hardware design as needed to avoid the typical problems with microkernels
19:37davidrysk[m]I kinda want to see them move their own drivers into userspace as much as possible too, in order to reduce kernel attack surface
19:37davidrysk[m]that said, there still are uses for kernel/kext programming
19:38modwizcodeYeah I doubt they can get rid of them entirely with something like a Mac Pro line around that supports more than just USB addons
19:38modwizcodeI guess thunderbolt might expose stuff too
19:39davidrysk[m]they're heavily leveraging IOMMUs to reduce the exposure that Thunderbolt and PCIe would otherwise cause
19:39davidrysk[m]but in some cases you still need maximum performance
19:54Shizspeculating that if coih and/or a linked auxk/fuos manifest exists, it will go through loading that instead of nsih
20:00bear24rw has joined #asahi-re
20:03aratuk has joined #asahi-re
20:07aratuk has quit [Ping timeout: 260 seconds]
20:07bear24rw has quit [Remote host closed the connection]
20:23DarthCloud has quit [Read error: Connection reset by peer]
20:25DarthCloud has joined #asahi-re
20:42klaus has joined #asahi-re
22:03aratuk has joined #asahi-re
22:04stormclad has joined #asahi-re
22:07aratuk has quit [Ping timeout: 240 seconds]
22:09stormclad has quit [Ping timeout: 260 seconds]
22:41HoneyTubes has joined #asahi-re
23:22maor26 has quit [Ping timeout: 260 seconds]
23:24HoneyTubes has quit [Remote host closed the connection]
23:24cyrozap has joined #asahi-re
23:29bear24rw has joined #asahi-re
23:34bear24rw has quit [Ping timeout: 240 seconds]