User:Newbyte/Mainlining Notes

From postmarketOS Wiki

Troubleshooting

Can't find default configuration "arch/arm/configs/msm8916_defconfig"!

If you get this error when working with envkernel.sh, it likely means that you have the wrong architecture or device selected in pmbootstrap. Do pmbootstrap init again and make sure you have the right device selected.

mkdir: can't create directory '.tmp_XXXXX': Permission denied

I'm not sure why this happens, but generally you can fix it by running rm -rf .output/ in your Linux kernel tree. You will probably need to use sudo. Also, make sure to reactivate after doing this.

Kernel configuration keeps restarting or being cleaned up even though you've copied one to .output/.config

This can be for multiple reasons.

Ensure:

  1. pmbootstrap is set to the right device (an architecture mismatch can cause this for instance)
  2. you've copied it to .output/.config and not .config

Using envkernel.sh with linux-postmarketos-exynos4

linux-postmarketos-exynos4 has a "unique" setup where it does some magic to work around quirks in the Samsung bootloader[1]. Due to this, you will likely find that the kernel fails to build with ../usr/gen_initramfs.sh: Cannot open 'usr/initramfs.list' if you try to build it with envkernel.sh. To resolve this, copy initramfs.list and init from the linux-postmarketos-exynos4 package into .output/usr in your Linux source directory. You also need to get a copy of busybox.static for armv7 in there (the executable, not the package).

fastboot stuff

Get current slot

fastboot getvar current-slot

Set current slot

fastboot set_active <slot, either a or b>

Working with device trees

On modern devices, the easiest way to get a full dtb for your particular device is likely by coping /sys/firmware/fdt from a running Android device (or TWRP).

Decompilation of a dtb can be done like so:

dtc -I dtb -O dts <filename>.dtb -o <filename>.dts

Useful links

Device trees

Downstream reserved-memory bindings docs: https://android.googlesource.com/kernel/msm/+/android-msm-bullhead-3.10-marshmallow-dr/Documentation/devicetree/bindings/memory.txt

Mainline reserved-memory bindings docs: https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/reserved-memory/reserved-memory.yaml

Introduction to device trees: https://www.nxp.com/docs/en/application-note/AN5125.pdf

U8500 modem stuff

http://lkml.iu.edu/hypermail/linux/kernel/1207.3/02878.html

http://lkml.iu.edu/hypermail/linux/kernel/1207.3/02879.html

http://lkml.iu.edu/hypermail/linux/kernel/1207.3/02881.html

i2c stuff

https://ansari.sh/posts/finding_sensors_i2c