OP-TEE / build

Makefiles to use OP-TEE on various platforms
107 stars 209 forks source link

Modify the linux kernel but not working #676

Closed fengyuanyu1 closed 10 months ago

fengyuanyu1 commented 10 months ago

Hello, optee team, According to the guideline, I build the Linux with optee in QEMU successfully. I want to add some functions in the linux kernel using optee. But I find that my modification in optee project doesn't work. My pipeline is as following:

1. build optee project
2. modify the source code in <optee project>/linux
3. in <optee project>/build, make -f qemu_v8.mk linux
4. in <optee project>/build, make -f qemu_v8.mk run-only.

One of my modification is:

// <optee project>/linux/drivers/pci/probe.c
int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
            struct resource *res, unsigned int pos) {
        ...
        // line 318
        pci_info(dev, "Hack!!! reg 0x%x: %pR\n", pos, res);
        ...
}

And this modification can be complied successfully. But I cant find the HACK message in the boot log. I try to recompile the whole project, the Linux, change the compile flag. But it is useless.

jforissier commented 10 months ago
  1. build optee project
  2. modify the source code in /linux
  3. in /build, make -f qemu_v8.mk linux
  4. in /build, make -f qemu_v8.mk run-only.

That's mostly good except that the linux kernel is now post-processed to produce uImage (to be loaded by U-Boot). So the "make linux" target does not do enough. Please try the following patch:

diff --git a/qemu_v8.mk b/qemu_v8.mk
index 92702e0..324f8cf 100644
--- a/qemu_v8.mk
+++ b/qemu_v8.mk
@@ -394,6 +394,8 @@ $(KERNEL_UIMAGE): u-boot linux | $(BINARIES_PATH)
                -n "Linux kernel" \
                -d $(BINARIES_PATH)/linux.bin $(KERNEL_UIMAGE)

+uImage: $(KERNEL_UIMAGE)
+
 $(ROOTFS_UGZ): u-boot buildroot | $(BINARIES_PATH)
    ln -sf $(ROOT)/out-br/images/rootfs.cpio.gz $(BINARIES_PATH)
    $(MKIMAGE_PATH)/mkimage -A arm64 \

...and do the following sequence instead:

  1. build optee project
  2. modify the source code in /linux
  3. in /build, make uImage
  4. in /build, make run-only.
jforissier commented 10 months ago

https://github.com/OP-TEE/build/pull/677

fengyuanyu1 commented 10 months ago

@jforissier Thanks for your quick reply. It works.