This is my attempt to compile a mainline kernel for the Gemini PDA.
Currently, only serial console works. The system boots into BusyBox, which is accessible over the serial console (with the USB FTDI cable).
- Clone this repository.
- Run
make init, to build mkbootimg and to initialize buildroot to defconfig. - Run
make toolchainto build the cross-compilation toolchain. This will take a while. - Run
maketo build the image. This will also take a while. The image will appear inoutput/boot_linux.img. ddthe image to the recovery partition, connect your UART cable, boot and enjoy the mainline kernel!
The defconfig for buildroot uses build cache. The cache is in
~/.buildroot-ccache. Buildroot does not clear it, you must manually empty
the directory to clear the build cache.
You can add a custom script to run after the build in
scripts/custom-after-build.sh. It will be executed after a successful build
(full-image builds only, i.e. make, not make rebuild-linux). The script
runs in the root of the repository. You can e.g. copy the image to a server
for easy flashing.
When making any changes to the kernel configuration, sources, or the device tree, the kernel has to be rebuilt separately:
make linux-rebuild allall is the default make target, so the above command will first rebuild the
kernel, followed by rest of the build operations.
The device tree is located at board/gemini-pda/gemini-pda.dts.
make linux-menuconfigNOTE: the resulting .config will be saved in
ext/buildroot/output/build/linux-*/.config, and you will need to copy
it to board/gemini-pda/kernel.config to yourself to preserve your changes.
You can edit the Linux source in ext/buildroot/output/build/linux-*.
Note that the changes will be lost if the kernel is cleaned with
make linux-dirclean, so make sure to export the modifications as patches.
make menuconfig NOTE: the Buildroot .config file will be saved in ext/buildroot/.config,
and you will need to copy it to configs/defconfig yourself to preserve your
changes.
You can kexec into the new kernel dynamically. To facilitate this, there are
two scripts: kexecboot.sh and run-kexecboot.sh. kexecboot.sh runs on the
device, and run-kexecboot.sh runs on the host. run-kexecboot.sh ttyUSB0
opens ttyUSB0, writes to the terminal /usr/local/bin/kexecboot.sh, and then
transfers the latest build results to the PDA. The PDA then patches the device
tree and kexecs into the new kernel. Note that the transfer takes about a
minute, so it's not significantly faster than booting to Gemian and dding the
image to recovery.
You can make scripts/custom-after-build.sh run run-kexecboot.sh after every
build.
| Directory | Description |
|---|---|
board/gemini-pda |
Contains the DTS and kernel, uClibc-ng, and busybox configs. |
board/gemini-pda/root-overlay |
Contains the files copied over the root filesystem. |
configs |
Contains Buildroot's defconfig |
docs |
Notes about the Gemini PDA hardware and configuration. |
ext |
External dependencies, as |
logs |
Contains log files from terminal runs. |
output |
Will contain the built boot image. |
package |
Custom Buildroot packages. Contains the mt6797_debug module. |
scripts |
run-minicom.sh and build-related scripts. |
Running ./scripts/run-minicom.sh ttyUSB0 will open a minicom terminal with
the correct settings for Gemini. It will also store logs into the logs/
directory.
The included mt6797_debug module provides MT6797-specific files in
/sys/kernel/debug/mt6797. The module is loaded by default.
| File | Description |
|---|---|
emi_mpu |
Information about memory regions protected with EMI MPU |
pll_bus |
Measured frequency of the main AXI bus clock. |
psci_status |
PSCI-reported status of CPUs |
regs/EMI_CONM |
Contents of the EMI_CONM register (memory clocks) |
regs/M4U_PT_BASE_ADDR |
Base address of M4U page table |
regs/M4U_PT_BASE_ADDR_SEC |
Second base address of M4U page table |
regs/M4U_CTRL |
Control registers of M4U |
regs/M4U_IVRP_PADDR |
Address of M4U's violation info area |
regs/* |
Various other registers |
The module can be rebuilt with make mt6797_debug-rebuild all.
The following patch sets are included:
This patchset marks critical clocks as such. Without these patches, the memory would get corrupted.
The patch set has been sent to MediaTek's Linux mailing list.
This patchset fixes scpsys to allow gaps in the power domains, otherwise the probe for it would fail.
The patch set has been sent to MediaTek's Linux mailing list.
PMIC wrapper requires a reset signal. A patch set adds the required resets to
infracfg.
The kernel has been tested on Umidigi Umi Z. It's preloader does not attempt to
detect the UART cable, so the Force UART option of mt6797_debug has to be
selected in make menuconfig.