Apple's open-source XNU kernel on Android phones: its own loader and drivers, Metal on the Adreno. Runs from RAM; a reboot gives the phone back to Android.
C
press_power=S: the power key tapped S seconds after boot and again ten seconds later (the lock and the wake, with nobody at the phone); rc.jobs.stress: Metal, frame pacing and stability under use
shimoku74b8d4748dcc5c
diff --git a/configs/boot-args.lst b/configs/boot-args.lstindex bc8e9c6..0834f73 100644--- a/configs/boot-args.lst+++ b/configs/boot-args.lst@@ -91,6 +91,7 @@ fb_beat kfb_diff kfb_filter kfb_hz k+fb_measure kfb_queue kfb_threads kfbheight k@@ -198,6 +199,8 @@ net_names knet_trace kpmic kpmic_list k+press_power k+press_power_ms kprivs krd klrec_mb k@@ -278,6 +281,7 @@ ustacks_count kustacks_ms kustacks_threads kustacks_tname k+var_hfs uvar_save_ms kvar_store uvblur udiff --git a/configs/symbols.tsv b/configs/symbols.tsvindex e812a99..85ec1aa 100644--- a/configs/symbols.tsv+++ b/configs/symbols.tsv@@ -82,6 +82,7 @@ FB_BEAT arg fb_beat GPU and display k MiniIOMobileFramebuffer.cppFB_DIFF arg fb_diff GPU and display k MiniIOMobileFramebuffer.cpp which pixels of the panel each frame changed (it costs: the panel's memory is slow to read)FB_FILTER arg fb_filter GPU and display k MiniIOMobileFramebuffer.cpp the picture is scaled to the panel nearest neighbour, as it once wasFB_HZ arg fb_hz GPU and display k MiniIOMobileFramebuffer.cpp+FB_MEASURE arg fb_measure GPU and display k MiniIOMobileFramebuffer.cpp how often the panel is really refreshedFB_QUEUE arg fb_queue GPU and display k MiniIOMobileFramebuffer.cppFB_THREADS arg fb_threads GPU and display k MiniIOMobileFramebuffer.cppFBHEIGHT arg fbheight GPU and display k MiniIOMobileFramebuffer.cpp@@ -177,6 +178,8 @@ MODEM_STEP arg modem_step Cellular k hakios.mpss.c the steps once the root is thMODEM_WAIT arg modem_wait Cellular k hakios.mpss.cMODEM_WDA_OFF arg modem_wda_off Cellular k hakios.mpss.cPMIC_LIST arg pmic_list Chip, thermal and PMIC k hakios.pmic.c only the clock, not the inventory of every block+PRESS_POWER arg press_power Touch and buttons k hakios.buttons.c a short press of the power key that many seconds after boot, and another ten seconds later, given to Darwin as the key's own are (hakios_touch_post):+PRESS_POWER_MS arg press_power_ms Touch and buttons k hakios.buttons.cPRIVS arg privs Security stand-ins k kern_minimac.cRD arg rd CPU, memory and boot kl (patch),loader.cREC_MB arg rec_mb GPU and display k MiniIOMobileFramebuffer.cpp@@ -247,6 +250,7 @@ USTACKS_COUNT arg ustacks_count Debugging k user_exception_trace.cUSTACKS_MS arg ustacks_ms Debugging k user_exception_trace.cUSTACKS_THREADS arg ustacks_threads Debugging k user_exception_trace.cUSTACKS_TNAME arg ustacks_tname Debugging k user_exception_trace.c+VAR_HFS arg var_hfs User space u init.cVAR_SAVE_MS arg var_save_ms Storage and APFS k hakios.ufs.cVBLUR arg vblur GPU and display u eagl.cVIRTIO_BLK arg virtio_blk Storage and APFS k hakios.virtio_blk.cdiff --git a/docs/boot-args.md b/docs/boot-args.mdindex df76645..fe5e30f 100644--- a/docs/boot-args.md+++ b/docs/boot-args.md@@ -2,13 +2,13 @@Made by `tools/boot-args.py --markdown`; CI fails if it is out of date with the source (`tools/boot-args.py --check`).-Every argument that the kernel, the loader or user space of this port reads, and which file reads it. **319 arguments**: 270 read by the kernel, 14 by the loader, 45 by user space (one is read in more than one place).+Every argument that the kernel, the loader or user space of this port reads, and which file reads it. **323 arguments**: 273 read by the kernel, 14 by the loader, 46 by user space (one is read in more than one place).This is a catalogue of what exists and who reads it, not a manual. What an argument means is in the head of the file that reads it. The stable switches have a symbol in the configuration (`tools/hakios-config.py help SYMBOL`, `docs/configs.md`); the rest are the knobs of bring-up (a driver's steps, pauses, traces, test modes) and can change with the driver. Any of them can be given in a configuration with `CONFIG_BOOTARGS="name=value ..."`, which checks that each name is in this list.Layers: **K** the kernel, **L** the loader, **U** user space (through `sysctl kern.bootargs`).-## GPU and display (68)+## GPU and display (69)| Argument | Layer | Read by | Configuration | Set by ||---|---|---|---|---|@@ -29,6 +29,7 @@ Layers: **K** the kernel, **L** the loader, **U** user space (through `sysctl ke| `fb_diff` | K | `MiniIOMobileFramebuffer.cpp` | `CONFIG_FB_DIFF` | || `fb_filter` | K | `MiniIOMobileFramebuffer.cpp` | `CONFIG_FB_FILTER` | || `fb_hz` | K | `MiniIOMobileFramebuffer.cpp` | `CONFIG_FB_HZ` | |+| `fb_measure` | K | `MiniIOMobileFramebuffer.cpp` | `CONFIG_FB_MEASURE` | || `fb_queue` | K | `MiniIOMobileFramebuffer.cpp` | `CONFIG_FB_QUEUE` | || `fb_threads` | K | `MiniIOMobileFramebuffer.cpp` | `CONFIG_FB_THREADS` | || `fbheight` | K | `MiniIOMobileFramebuffer.cpp` | `CONFIG_FBHEIGHT` | |@@ -237,12 +238,14 @@ Layers: **K** the kernel, **L** the loader, **U** user space (through `sysctl ke| `cam_shutter` | K | `hakios.camera.c` | `CONFIG_CAM_SHUTTER` | || `cam_vblank` | K | `hakios.camera.c` | `CONFIG_CAM_VBLANK` | |-## Touch and buttons (8)+## Touch and buttons (10)| Argument | Layer | Read by | Configuration | Set by ||---|---|---|---|---|| `buttons` | K | `hakios.buttons.c` | `CONFIG_BUTTONS` | || `buttons_steps` | K | `hakios.buttons.c` | `CONFIG_BUTTONS_STEPS` | |+| `press_power` | K | `hakios.buttons.c` | `CONFIG_PRESS_POWER` | |+| `press_power_ms` | K | `hakios.buttons.c` | `CONFIG_PRESS_POWER_MS` | || `touch_flip` | K | `hakios.goodix.c` | `CONFIG_TOUCH_FLIP` | || `touch_poll_us` | K | `hakios.goodix.c` | `CONFIG_TOUCH_POLL_US` | || `touch_rate` | K | `hakios.goodix.c` | `CONFIG_TOUCH_RATE` | |@@ -387,7 +390,7 @@ Layers: **K** the kernel, **L** the loader, **U** user space (through `sysctl ke| `ufs` | L | `loader.c` | `CONFIG_UFS` | || `ufs_probe` | L | `loader.c` | `CONFIG_UFS_PROBE` | |-## User space (15)+## User space (16)| Argument | Layer | Read by | Configuration | Set by ||---|---|---|---|---|@@ -405,4 +408,5 @@ Layers: **K** the kernel, **L** the loader, **U** user space (through `sysctl ke| `root_apfs` | U | `init.c` | `CONFIG_ROOT_APFS` | || `sb_delay` | U | `inject_sb.c` | | xl (XL_SB_DELAY) || `switcher_wallpaper` | U | `inject_sb.c` | `CONFIG_SWITCHER_WALLPAPER` | |+| `var_hfs` | U | `init.c` | `CONFIG_VAR_HFS` | || `var_store` | U | `init.c` | `CONFIG_VAR_STORE` | |diff --git a/drivers/input/hakios.buttons.c b/drivers/input/hakios.buttons.cindex 3c9b01a..27203ee 100644--- a/drivers/input/hakios.buttons.c+++ b/drivers/input/hakios.buttons.c@@ -45,6 +45,7 @@#include <kern/clock.h>#include <kern/locks.h>#include <kern/thread.h>+#include <kern/thread_call.h>#include <libkern/libkern.h>#include <mach/mach_types.h>#include <pexpert/pexpert.h>@@ -513,12 +514,61 @@ out:thread_terminate(current_thread());}+/*+ * boot-arg press_power=<seconds>: a short press of the power key that many seconds after boot, and another ten+ * seconds later, given to Darwin as the key's own are (hakios_touch_post): the lock, and the wake, tried with nobody+ * at the phone. press_power_ms=<ms> is how long each is held (default 150: a tap; 3000 and up is a long press).+ */+static uint32_t press_ms = 150, press_left;+static thread_call_t press_call;++static void+press_step(__unused thread_call_param_t p0, __unused thread_call_param_t p1)+{+ static bool down;+ uint64_t deadline;+ char when[64];++ down = !down;+ now_text(when, sizeof(when), mach_absolute_time());+ printf("buttons: press_power: power %s at %s\n", down ? "PRESSED (by the test)" : "released (by the test)", when);+ hakios_touch_post(down ? HAKIOS_BUTTON_DOWN : HAKIOS_BUTTON_UP, HAKIOS_BUTTON_LOCK, 0, 0);+ if (down) {+ clock_interval_to_deadline(press_ms, NSEC_PER_MSEC, &deadline);+ } else if (--press_left > 0) {+ clock_interval_to_deadline(10, NSEC_PER_SEC, &deadline);+ } else {+ return;+ }+ thread_call_enter_delayed(press_call, deadline);+}++static void+press_power_init(void)+{+ uint32_t seconds = 0;+ uint64_t deadline;++ if (!PE_parse_boot_argn("press_power", &seconds, sizeof(seconds)) || seconds == 0) {+ return;+ }+ PE_parse_boot_argn("press_power_ms", &press_ms, sizeof(press_ms));+ press_left = 2;+ press_call = thread_call_allocate(press_step, NULL);+ clock_interval_to_deadline(seconds, NSEC_PER_SEC, &deadline);+ thread_call_enter_delayed(press_call, deadline);+ printf("buttons: press_power: the power key will be pressed for %u ms at %u s and at %u s\n", press_ms, seconds,+ seconds + 10);+}+voidhakios_buttons_init(void){uint32_t enabled = 0, steps = 5;thread_t thread;+ press_power_init();+/** On with the touch screen (the phone, somebody at it) unless buttons=0 says otherwise: a hand* has pressed all three keys and each press and release was read as it was made.diff --git a/userland/rc.jobs.stress b/userland/rc.jobs.stressnew file mode 100644index 0000000..5164c95--- /dev/null+++ b/userland/rc.jobs.stress@@ -0,0 +1,24 @@+# Commands run by the launchd job com.hakios.demo (see com.hakios.demo.plist).+# Metal, then frame pacing and stability under use, with nobody at the phone (RC_JOBS=rc.jobs.stress, gpu=1 metal=1,+# about 9 minutes): metal_test (as rc.jobs.metal); unlock; the page swipes, Search, Control Center and Settings of+# rc.jobs.fps three times; then the applications of rc.jobs.tour, each opened for 20 seconds and closed. A hang under+# use was seen twice by hand (30 October); this brings it out again with the log fetched every second (XL_FOLLOW=1).+/redwood/bin/sound_test springboard+/redwood/bin/rwtouch wait 25+/redwood/bin/metal_test+/redwood/bin/rwtouch wait 26 swipe 0.5 0.985 0.5 0.3 200 wait 30+/redwood/bin/rwtouch swipe 0.85 0.5 0.15 0.5 300 wait 2 swipe 0.15 0.5 0.85 0.5 300 wait 2 swipe 0.85 0.5 0.15 0.5 300 wait 2 swipe 0.15 0.5 0.85 0.5 300 wait 3+/redwood/bin/rwtouch swipe 0.5 0.4 0.5 0.7 300 wait 3 button home wait 3 swipe 0.92 0.003 0.92 0.5 300 wait 3 button home wait 3+/redwood/bin/rwtouch tap 0.615 0.71 wait 3 swipe 0.5 0.8 0.5 0.3 150 wait 3 swipe 0.5 0.3 0.5 0.8 150 wait 3 swipe 0.5 0.995 0.5 0.55 150 wait 3+/redwood/bin/rwtouch swipe 0.85 0.5 0.15 0.5 300 wait 2 swipe 0.15 0.5 0.85 0.5 300 wait 2 swipe 0.85 0.5 0.15 0.5 300 wait 2 swipe 0.15 0.5 0.85 0.5 300 wait 3+/redwood/bin/rwtouch swipe 0.5 0.4 0.5 0.7 300 wait 3 button home wait 3 swipe 0.92 0.003 0.92 0.5 300 wait 3 button home wait 3+/redwood/bin/rwtouch tap 0.615 0.71 wait 3 swipe 0.5 0.8 0.5 0.3 150 wait 3 swipe 0.5 0.3 0.5 0.8 150 wait 3 swipe 0.5 0.995 0.5 0.55 150 wait 3+/redwood/bin/rwtouch swipe 0.85 0.5 0.15 0.5 300 wait 2 swipe 0.15 0.5 0.85 0.5 300 wait 2 swipe 0.85 0.5 0.15 0.5 300 wait 2 swipe 0.15 0.5 0.85 0.5 300 wait 3+/redwood/bin/rwtouch swipe 0.5 0.4 0.5 0.7 300 wait 3 button home wait 3 swipe 0.92 0.003 0.92 0.5 300 wait 3 button home wait 3+/redwood/bin/rwtouch tap 0.615 0.71 wait 3 swipe 0.5 0.8 0.5 0.3 150 wait 3 swipe 0.5 0.3 0.5 0.8 150 wait 3 swipe 0.5 0.995 0.5 0.55 150 wait 3+/redwood/bin/rwtouch tap 0.15 0.475 wait 20 button home wait 5 tap 0.385 0.475 wait 20 button home wait 5 tap 0.615 0.475 wait 20 button home wait 5 tap 0.845 0.475 wait 20 button home wait 5+/redwood/bin/rwtouch tap 0.15 0.59 wait 20 button home wait 5 tap 0.385 0.59 wait 20 button home wait 5 tap 0.615 0.59 wait 20 button home wait 5 tap 0.845 0.59 wait 20 button home wait 5+/redwood/bin/rwtouch tap 0.15 0.71 wait 20 button home wait 5 tap 0.385 0.71 wait 20 button home wait 5 tap 0.615 0.71 wait 20 button home wait 5+/redwood/bin/rwtouch tap 0.15 0.925 wait 20 button home wait 5 tap 0.615 0.925 wait 20 button home wait 5 tap 0.845 0.925 wait 20 button home wait 5+/bin/ps -A+/usr/bin/vm_stat