jakkra / ZSWatch

ZSWatch - the Open Source Zephyr™ based Smartwatch, including both HW and FW.
https://forms.gle/G48Sm5zDe9aCaYtT9
GNU General Public License v3.0
2.34k stars 204 forks source link

Auto patches to Zephyr when compiling #44

Closed jakkra closed 11 months ago

jakkra commented 1 year ago

There are some patches, for example to upscale native_posix SDL display. Would be handy to automatically apply those patches when complinging.

vChavezB commented 1 year ago

Golioth has a script to run a patch command when using the manifest file

https://github.com/golioth/golioth-zephyr-sdk/blob/main/scripts/west_commands/patch.py

and you can see it in action here

https://github.com/golioth/golioth-zephyr-sdk/blob/cc146c1e0d4f2c666a37da3b6de7cc5902367484/west-ncs.yml#L15

This issue would be related to first setting up a manifest file as mentioned in https://github.com/jakkra/ZSWatch/issues/35

ldab commented 11 months ago

@jakkra I can only see “ app/zephyr_patches/sdl_upscale.patch” is there another one?

Kampi commented 11 months ago

@ldab we have a patch for the nPM1300 driver which is necessary for later revisions with the new power management. It´s not checked in in Git, so you can add it if you want. Please rename it to nPM1300 patch or something like this. The name is a bad choice :D

ntc_fix.patch

jakkra commented 11 months ago

@ldab do note that this sdl patch does not work anymore, that code was refactored. It's not necessary, so it can be removed.

ldab commented 11 months ago

@ldab do note that this sdl patch does not work anymore, that code was refactored. It's not necessary, so it can be removed.

both kscan_sdl.c and display_sdl.c are not required anymore? How to make the screen bigger?

jakkra commented 11 months ago

@ldab do note that this sdl patch does not work anymore, that code was refactored. It's not necessary, so it can be removed.

both kscan_sdl.c and display_sdl.c are not required anymore? How to make the screen bigger?

Well they are needed to scale it up, but requires re-doing this patch. But current default not scaled is useable also.

Kampi commented 11 months ago

@jakkra @ldab CI/CD is reporting this

image

jakkra commented 11 months ago

@jakkra @ldab CI/CD is reporting this

image

Thought this would fix it but still getting:

Passing ZEPHYR_BASE to -d instead of ../zephyr

patch -p1 -d ${ZEPHYR_BASE} -i ${CMAKE_CURRENT_SOURCE_DIR}/${file} -r - --no-backup-if-mismatch)

patch: **** Can't change to directory -i : No such file or directory
patch: **** Can't change to directory -i : No such file or directory

Edit: it works, but getting above error when doing --pristine build

ldab commented 11 months ago

Strange, main gives me:

-- west build: generating a build system
patching file modules/lvgl/input/lvgl_common_input.c
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored
patching file modules/lvgl/input/lvgl_common_input.h
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored
patching file drivers/sensor/npm1300_charger/npm1300_charger.c
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored

In order to reproduce I tried:

  1. Clean the build folder
  2. Pristine build
  3. Build again
  4. Clean changes on Zephyr repo

Can't reproduce it, my workdir is ~$HOME/ZSWatch

jakkra commented 11 months ago

Fixed now and CI as good. Works locally also for me. https://github.com/jakkra/ZSWatch/commit/694798a6fd55b2753d6025e603d2a14534c9c692