This repository is deprecated in favor of msm8998-mainline/linux on GitLab where development has continued where this tree left off :)
Linux mainline kernel fork focused on OnePlus 5 (cheeseburger) / 5T (dumpling) devices.
Ubuntu 20.04 LTS
# apt install build-essential flex bison libssl-dev bc kmod gcc-aarch64-linux-gnu mkbootimg
export ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
make oneplus5_defconfig # see arch/arm64/configs/
make -j$(nproc)
make INSTALL_MOD_PATH=rootfs modules_install -j$(nproc)
tar -czf modules.tar.gz -C rootfs/lib/modules . --owner=0 --group=0 --numeric-owner
NOTE: In case you want to boot without a ramdisk you need to make menuconfig
after generating a .config
and tweak the following:
# change sde21 (system) below to match your desired rootfs partition
CONFIG_CMDLINE="clk_ignore_unused loglevel=3 quiet root=/dev/sde21"
CONFIG_CMDLINE_FORCE=y
Otherwise see e.g. my initramfs-tools after building; the cmdline below will contain rd.*
option examples that are specific to my ramdisk, such as booting a loopback-based rootfs.img
on the userdata
partition root :)
Next install osm0sis/mkbootimg to create an Android bootloader compatible boot image:
DEVICE="cheeseburger" # change depending on which device you're targeting
cat arch/arm64/boot/{Image.gz,dts/qcom/msm8998-oneplus-$DEVICE.dtb} > Image.gz-dtb
mkbootimg --kernel Image.gz-dtb --ramdisk /path/to/initramfs.cpio* \
--cmdline "clk_ignore_unused loglevel=3 quiet rd.rootfs=/dev/sda13/rootfs.img rd.extra_hooks=configfs,rndis" \
--base 0x0 --pagesize 4096 -o boot.img
Same steps as above apply, except instead of mkbootimg
run:
abootimg -u /path/to/boot.img -k Image.gz-dtb
NOTE: Kernel cmdline can also be easily tweaked using abootimg -u ... -c "cmdline=..."
(assuming you're not using CMDLINE_FORCE=y
).
Now you can use e.g. fastboot boot boot.img
or fastboot flash boot boot.img && fastboot reboot
to boot the newly compiled kernel.
Currently probing ipa
(built as a module) without firmware in place causes a kernel panic (as of v5.12). If you don't wish to deal with this you can:
- Set
CONFIG_QCOM_IPA=n
inmake menuconfig
and rebuild the kernel - Make a new boot image with
modprobe.blacklist=ipa
added to cmdline
Otherwise follow these steps to enable features such as Bluetooth and Wi-Fi:
wget https://github.com/JamiKettunen/firmware-mainline-oneplus5/archive/10.0.1.tar.gz
scp 10.0.1.tar.gz user@172.16.42.1:~
ssh -t user@172.16.42.1 "sudo sh -c 'mkdir -p /lib/firmware && tar -xmf 10.0.1.tar.gz --strip-components=1 -C /lib/firmware && find /lib/firmware/* -maxdepth 0 ! -name qca ! -name ath10k ! -name qcom -delete && rm 10.0.1.tar.gz && sync; echo Firmware deployed.'"
Once booted you should have an SSH connection via USB RNDIS to the device, which means you can just scp
over the previously made modules.tar.gz
and extract it:
scp modules.tar.gz user@172.16.42.1:~
ssh -t user@172.16.42.1 "sudo sh -c 'mkdir -p /lib/modules && tar -xmf modules.tar.gz -C /lib/modules && rm modules.tar.gz && sync && reboot'"
NOTE: 172.16.42.1
is the default IP address my ramdisk assigns to the device's USB interface from the RNDIS hook.
- UFS internal storage
- Samsung S6E3FA5/S6E3FC1 display panels
- There are some issues with refreshing, but the drivers are mostly usable
- Synaptics touchscreen (& back/recents capacitive buttons on OP5) via RMI4
- Capacitive button backlight on OP5 (see
/sys/class/leds/white:kbd_backlight
) - Adreno 540 GPU
- At least partially; there are various visual glitches currently on more complicated scenes
- Bluetooth (requires firmware blobs)
- Wi-Fi via ath10k SNOC (requires firmware blobs & 5 userspace daemons)
- Somewhat unstable; FW keeps crashing without diag-router and on any type of network disconnect
- With
ath10k_snoc
driver probed the shutdown is additionally hung by some amount due to the remoteproc refusing to shutdown cleanly
- Real-time clock (RTC)
- Reported timestamp is always somewhere around 1972
- Stored timestamp cannot be updated, but alarms do fire when written relative to the incorrectly reported timestamp
- USB in peripheral mode
- No power delivery from the device's USB port -> host mode practically useless for now
- GPS via GPSD with Qualcomm PDS patch
- Power and volume buttons
- Haptics/vibration motor
- Battery details query via fuel gauge
- Hall effect sensor (for magnetic flip cases and whatnot)
- Some cellular modem functions (tested via ModemManager/libqmi)
- PIN unlock
- Carrier info query
- Sending SMS
- Notification light
- Any kind of audio input/output (except via Bluetooth)
- Plenty of cellular modem functions (tested via ModemManager/libqmi)
- Receiving SMS
- Calls
- Data connection
- Fingerprint sensors (& home button on OP5)
- Any cameras (sensors: IMX{398,350,376K,371})
- Camera flashlight
- Hardware video acceleration via Venus
- Pending SDM660 patches exist on LKML; could be adapted somewhat easily for MSM8998?
- Practically all sensors
- Needs "low power island" bringup + drivers as most of the sensors are controlled by this DSP
- Fast charging
- This could perhaps be implemented when the proprietary
dashd
Android blob is reverse engineered
- This could perhaps be implemented when the proprietary
- NFC
- While the PN544 I2C chip has a driver and can be hooked up in device tree, there appears to be an SPI "secure element" chip handling some of the tasks (and potentially even an Android blob? check on downstream!)
- CPUfreq scaling
- Probably everything else I forgot to mention
- Performance
- A stock postmarketOS install for example takes 40 seconds to boot; about half of the time is spent decompressing a 40 MB archive which should take only a few seconds when compared with downstream and SDM845 mainline
- Battery life
- Primary sources of power consumption should be measured (how?)
- Might be a nitpick but there's some amount of ugly spam about clocks getting stuck and such in
dmesg
- Android 10 bootloader (OxygenOS 10.0.1 FW) is the only one where I've experienced
fastboot boot
working so far- Particularly it doesn't work with OxygenOS 9.0.11 FW flashed
- If appending more than one DTB (e.g. for cheeseburger + dumpling) the device won't boot anymore
- Perhaps downstream (DTBs) can be investigated as downstream kernel boots fine with many unordered DTBs appended?
- Original README
- initramfs-tools
- firmware-mainline-oneplus5
- Defconfigs
- Device tree (DTS)
- postmarketOS wiki pages
- Other relevant mainline forks