build icon indicating copy to clipboard operation
build copied to clipboard

Documentation on generating .patch files for dts(i) changes for uboot/kernel, need to add disable-cqe-dcmd

Open DaveWK opened this issue 2 years ago • 7 comments

Describe the bug I am working on cleaning up and getting the tinker-board-2 (rk3399) build working, which is listed as a .wip in this repo. I noticed I am running into an issue with the MMC after I boot, and getting some issues which I understand to be due to CQE being enabled; for reference:

https://patchwork.kernel.org/project/linux-arm-kernel/patch/[email protected]/

But I am running into an issue with trying to apply the disable-cqe-dcmd param to the u-boot and kernel ".patch" files at: https://github.com/armbian/build/blob/master/patch/kernel/archive/rockchip64-5.18/add-board-tinker-board-2.patch and https://github.com/armbian/build/blob/master/patch/u-boot/u-boot-rockchip64/add-board-tinker-board-2.patch

What I would like to do is generate all the kernel and u-boot files so I can validate that they look correct before I take the extra time to build the actual image files and re-flash the device.

I have read over the doc at: https://docs.armbian.com/Developer-Guide_Building-with-Docker/ and have been successful in building images, however the builder is being too clean and deleting all of the files after it finishes. I started looking through the bash scripts in lib and compile.sh however I can't see a way to tell it to preserve the u-boot and kernel build artifacts in a way that's convenient for me to look at them. Additionally, I was not sure if there was some kind of existing scripting to regenerate these .patch files, since this is creating whole files rather than applying patches to existing files.

I assume I could use a combination of git add and git diff --staged to bundle up all the files I have changed, but wasn't sure if there was an easier way. I saw mk_format_patch was in this repo, however I was not sure how to use this.

Is there a parameter to tell compile.sh to leave the intermediate build artifacts form uboot and the kernel instead of removing them?

DaveWK avatar Jul 21 '22 00:07 DaveWK

Related: https://github.com/armbian/build/pull/4015

juanesf avatar Jul 21 '22 01:07 juanesf

@DaveWK Check those two documents:

  • https://github.com/armbian/build/pull/3999/files (WIP)
  • https://docs.armbian.com/Developer-Guide_Build-Options/ -> CREATE_PATCHES

igorpecovnik avatar Jul 21 '22 08:07 igorpecovnik

Is there a parameter to tell compile.sh to leave the intermediate build artifacts form uboot and the kernel instead of removing them?

@DaveWK Please decipher in more detail what artifacts you want to see. Don't look at the text of the compilation script. Just describe it in words.

The-going avatar Jul 24 '22 08:07 The-going

Thanks for the details on the upcoming docs @igorpecovnik . It does seem like CREATE_PATCHES will do what I want to do if I understand correctly.

@The-going what I would like to do is generate the dts/dtsi files that are created/modified by the combination of all the .patch files for a particular board (in this case, the tinker-board-2) so I can see what it will look like before they get built into the armbian image. It would also be nice if I could preserve the board-specific u-boot loader files and kernel files that get baked into the armbian image separately so while I am iterating over changes to the loader I can just dd the correct disk offsets that rockchip uses for u-boot without the need to re-flash the entire emmc every time. Not having to wait and reflash/reconfigure the rootfs when all I am changing is u-boot would be a significant time savings.

DaveWK avatar Jul 25 '22 20:07 DaveWK

It would also be nice if I could preserve the board-specific u-boot loader files and kernel files that get baked into the armbian image separately so while I am iterating over changes to the loader I can just

When u-boot package is generated with armbian build framework it contains instructions for flashing. U-boot is flashed with nand-sata-install (or via armbian-config) from CLI after package has beeen updated.

igorpecovnik avatar Jul 25 '22 21:07 igorpecovnik

@The-going what I would like to do is generate the dts/dtsi files that are created/modified by the combination of all the .patch files for a particular board (in this case, the tinker-board-2) so I can see what it will look like before they get built into the armbian image. It would also be nice if I could preserve the board-specific u-boot loader files and kernel files

First, let's look at the general algorithm of the armbian assembly system.

  1. Make a recursive cleanup of all sources of git repositories and check their relevance as git pull, which will be used to create packages.
  2. If the package file does not exist in the output/debs/ folder, then build this package.
  3. If there is an order to assemble an image, then make the specified image and install the assembled packages into this image. Or build an image and install pre-assembled packages from a remote external armbian repository.

You need to create a u-boot package and kernel packages. Delete these packages from the output/debs folder. Start the build system with the KERNEL_ONLY="yes" parameter. When the build is finished, you will be able to see what I see.

Screenshot_VM

leo@vm-hirsute:~/build$ cd cache/sources/u-boot/
leo@vm-hirsute:~/build/cache/sources/u-boot$ ls
v2021.10
leo@vm-hirsute:~/build/cache/sources/u-boot$ cd v2021.10/
leo@vm-hirsute:~/build/cache/sources/u-boot/v2021.10$ git status
Refresh index: 100% (17781/17781), done.
HEAD detached at FETCH_HEAD
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   arch/arm/Kconfig
        modified:   arch/arm/dts/Makefile
        modified:   arch/arm/dts/sun50i-a64-olinuxino.dts
        modified:   arch/arm/dts/sun50i-a64-orangepi-win.dts
        modified:   arch/arm/dts/sun7i-a20-bananapro.dts
        modified:   arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts
        modified:   arch/arm/dts/sun8i-h3-beelink-x2.dts
        modified:   arch/arm/dts/sun8i-h3-nanopi-duo2.dts
        modified:   arch/arm/dts/sun8i-h3-nanopi-neo-air.dts
        modified:   arch/arm/dts/sun8i-h3-nanopi-neo.dts
        modified:   arch/arm/dts/sun8i-h3-orangepi-zero-plus2.dts
        modified:   arch/arm/dts/sun8i-h3-zeropi.dts
........

We can see all\any changes in the source files that have occurred as a result of applying all patches. Further actions take place at the level of the git commands. I am only interested in one file and I make a command: leo@vm-hirsute:~/build/cache/sources/u-boot/v2021.10$ git diff -- arch/arm/dts/sun8i-h3-nanopi-neo.dts

diff --git a/arch/arm/dts/sun8i-h3-nanopi-neo.dts b/arch/arm/dts/sun8i-h3-nanopi-neo.dts
index 9f33f6fa..4a56e6a9 100644
--- a/arch/arm/dts/sun8i-h3-nanopi-neo.dts
+++ b/arch/arm/dts/sun8i-h3-nanopi-neo.dts
@@ -58,6 +58,16 @@
        status = "okay";
 };
 
+&mmc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc2_8bit_pins>;
+       vmmc-supply = <&reg_vcc3v3>;
+       bus-width = <8>;
+       non-removable;
+       cap-mmc-hw-reset;
+       status = "okay";
+};
+
 &ohci0 {
        status = "okay";
 };

Next I do the following: git add --all git commit -m "Add all patches armbian" nano arch/arm/dts/sun8i-h3-nanopi-neo.dts git add arch/arm/dts/sun8i-h3-nanopi-neo.dts git commit -m "add node i2c for nanopi-neo board" git format-patch -1 -o ~/build/patch/u-boot/u-boot-sunxi/

Now you need to change the name of the patch file so that it is applied after the last of the existing patches makes changes to the target file.

If there are difficulties, do not hesitate to ask.

The-going avatar Jul 26 '22 11:07 The-going

if I could preserve the board-specific u-boot loader files and kernel files

My bananapi is connected to a local network via ethernet. And I just unload the collected packages directly into it using the mc file manager from a virtual machine.

The-going avatar Jul 26 '22 11:07 The-going

Updated documentation was merged: https://github.com/armbian/build/blob/master/CONTRIBUTING.md Closing.

igorpecovnik avatar Sep 14 '22 19:09 igorpecovnik