Skip to content

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

Display: boot-arg fbscale=2 (two pixels a point instead of three)

vcvkk5e7c1964255c
diff --git a/README.md b/README.md
index 224356d..41548d2 100644
--- a/README.md
+++ b/README.md
@@ -130,6 +130,7 @@ XL_SECS=900 XL_CMDLINE="touchscreen=1 cpufreq=1 bootcpu=7" ./xl run # 15 м
| `-v` | текст загрузки на экране (по умолчанию у `xl run`, если `XL_CMDLINE` не задана) |
| `applog=1` / `applog=2` | stderr приложений в журнал / плюс os_log всех процессов |
| `systrace=1` | печатать неудачные системные вызовы и аварии процессов |
+| `fbscale=2` | рисовать в 2 пикселя на точку вместо 3 и растягивать на панель: в 2,25 раза меньше работы программному рендеру (на телефоне пик 28 кадров/с вместо 19), картинка мягче, сверху появляется красная служебная полоса SpringBoard |
| `machine_name=1` | представляться iPhone10,3 (иначе устройство называется «iPod touch»); мало проверено |
## Сборка из исходников
diff --git a/prebuilt/SHA256SUMS b/prebuilt/SHA256SUMS
index 10ae87c..ebf37f1 100644
--- a/prebuilt/SHA256SUMS
+++ b/prebuilt/SHA256SUMS
@@ -1,6 +1,6 @@
-Built 2026-10-12 15:57 from this tree.
+Built 2026-10-12 16:10 from this tree.
-9143be25277056c53869892f85c76f276ba97f16af74f839ef18245bfe82f337 prebuilt/mach.development.bcm2837
+f3b1da7a405250d815ee4e1cc6ea13bfcab0a81429f777274c9390cbf81611e2 prebuilt/mach.development.bcm2837
4a875f2943b3c2ead63ee9e4c6141251c1a62c24639954114651e37157f4dab8 prebuilt/loader.efi
d2a35a4a1d6658ffb3696914f727661b52c9333de8a3af8a31642b8023ce03ac prebuilt/userland/child
db564073effc31e7ab1679a7ffe0631ec22c3030ad347c927028f3e53c8583c3 prebuilt/userland/hello
diff --git a/prebuilt/mach.development.bcm2837 b/prebuilt/mach.development.bcm2837
index 78f3711..a0bd754 100755
Binary files a/prebuilt/mach.development.bcm2837 and b/prebuilt/mach.development.bcm2837 differ
diff --git a/xnu/files/iokit/Kernel/MiniIOMobileFramebuffer.cpp b/xnu/files/iokit/Kernel/MiniIOMobileFramebuffer.cpp
index 1b1915d..2876605 100644
--- a/xnu/files/iokit/Kernel/MiniIOMobileFramebuffer.cpp
+++ b/xnu/files/iokit/Kernel/MiniIOMobileFramebuffer.cpp
@@ -94,6 +94,15 @@ static uint8_t gFBCalls[128]; /* how many calls of each selector were
static TUNABLE(uint32_t, gFBWidth, "fbwidth", kFBDefaultWidth);
static TUNABLE(uint32_t, gFBHeight, "fbheight", kFBDefaultHeight);
+/*
+ * Boot-arg fbscale=2: the same 375 x 812 points drawn at two pixels a point instead of three.
+ * Everything that is drawn is drawn by the processor, and this is 2.25 times fewer pixels to
+ * draw; the picture is then enlarged to the panel and is that much less sharp.
+ */
+#define kFBPointsWide 375
+#define kFBPointsHigh 812
+#define kFBDefaultScale 3
+static TUNABLE(uint32_t, gFBScale, "fbscale", 0);
/* Boot-arg fbtrace=N: log the first N calls of every selector (default 3). */
static TUNABLE(uint32_t, gFBTrace, "fbtrace", 3);
@@ -258,6 +267,22 @@ IOMobileFramebuffer::start(IOService * provider)
fRowBytes = vinfo.v_rowbytes;
fWidth = gFBWidth ? gFBWidth : fPanelWidth;
fHeight = gFBHeight ? gFBHeight : fPanelHeight;
+ if (gFBScale != 0 && gFBScale != kFBDefaultScale) {
+ static const char * const places[][2] = { { "/chosen", "display-scale" }, { "/product", "artwork-scale-factor" } };
+ uint32_t scale = gFBScale;
+
+ fWidth = kFBPointsWide * scale;
+ fHeight = kFBPointsHigh * scale;
+ /* what the loader's device tree says about the scale is where MobileGestalt has it from */
+ for (unsigned i = 0; i < sizeof(places) / sizeof(places[0]); i++) {
+ IORegistryEntry * node = IORegistryEntry::fromPath(places[i][0], gIODTPlane);
+
+ if (node != NULL) {
+ node->setProperty(places[i][1], &scale, sizeof(scale));
+ node->release();
+ }
+ }
+ }
fColumn = IONewZero(uint32_t, fPanelWidth);
IOLog("MiniIOMobileFramebuffer: display %ux%u on a panel of %ux%u (%u bytes per row)\n", fWidth, fHeight,
fPanelWidth, fPanelHeight, fRowBytes);
@@ -693,7 +718,7 @@ IOMobileFramebufferUserClient::externalMethod(uint32_t selector, IOExternalMetho
if (args->scalarOutputCount < 1) {
return kIOReturnBadArgument;
}
- out[0] = kFBDotsPerInch;
+ out[0] = kFBDotsPerInch * fOwner->fWidth / kFBDefaultWidth;
args->scalarOutputCount = 1;
return kIOReturnSuccess;