Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.14.r1] Add appended DTB support #2475

Draft
wants to merge 2 commits into
base: aosp/LA.UM.9.14.r1
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE
KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
-Werror=implicit-function-declaration -Werror=implicit-int \
-Wno-format-security \
-Wno-format-security -Wno-unused-but-set-variable \
-std=gnu89
KBUILD_CPPFLAGS := -D__KERNEL__
KBUILD_AFLAGS_KERNEL :=
Expand Down
15 changes: 15 additions & 0 deletions arch/arm64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,21 @@ config DMI
However, even with this option, the resultant kernel should
continue to boot on existing non-UEFI platforms.

config BUILD_ARM64_APPENDED_DTB_IMAGE
bool "Build a concatenated Image.gz/dtb by default"
depends on OF
help
Enabling this option will cause a concatenated Image.gz and list of
DTBs to be built by default (instead of a standalone Image.gz.)
The image will built in arch/arm64/boot/Image.gz-dtb

config BUILD_ARM64_APPENDED_DTB_IMAGE_NAMES
string "Default dtb names"
depends on BUILD_ARM64_APPENDED_DTB_IMAGE
help
Space separated list of names of dtbs to append when
building a concatenated Image.gz-dtb.

endmenu

choice
Expand Down
13 changes: 11 additions & 2 deletions arch/arm64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,15 @@ endif

# Default target when executing plain make
boot := arch/arm64/boot
KBUILD_IMAGE := $(boot)/$(KBUILD_TARGET)

all: $(KBUILD_TARGET)
ifeq ($(CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE),y)
# Warning! Uncompressed kernel + appended DTB + DTBO WILL NOT WORK!
KBUILD_IMAGE := $(KBUILD_TARGET)-dtb
else
KBUILD_IMAGE := $(KBUILD_TARGET)
endif
Comment on lines +149 to +154
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original commit has this inside ifeq ($(CONFIG_BUILD_ARM64_KERNEL_COMPRESSION_GZIP),y).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this way it will work with uncompressed kernel without dtbo

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dout uncompressed kernel + appended dtb works? Does it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was working on 4.19


all: $(KBUILD_IMAGE)

Image: vmlinux
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
Expand All @@ -158,6 +164,9 @@ Image.%: Image
zinstall install:
$(Q)$(MAKE) $(build)=$(boot) $@

$(KBUILD_TARGET)-dtb: vmlinux scripts dtbs
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

PHONY += vdso_install
vdso_install:
$(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/boot/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
Image
Image-dtb
Image.gz
Image.gz-dtb
16 changes: 16 additions & 0 deletions arch/arm64/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# Based on the ia64 boot/Makefile.
#

include $(srctree)/arch/arm64/boot/dts/Makefile

OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S

targets := Image Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo
Expand All @@ -33,6 +35,14 @@ rtic_mp.dtb: vmlinux FORCE

endif

DTB_NAMES := $(subst $\",,$(CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE_NAMES))
ifneq ($(DTB_NAMES),)
DTB_LIST := $(addsuffix .dtb,$(DTB_NAMES))
else
DTB_LIST := $(dtb-y)
endif
DTB_OBJS := $(addprefix $(obj)/dts/,$(DTB_LIST))

$(obj)/Image: vmlinux FORCE
$(call if_changed,objcopy)

Expand All @@ -51,6 +61,12 @@ $(obj)/Image.lzma: $(obj)/Image FORCE
$(obj)/Image.lzo: $(obj)/Image FORCE
$(call if_changed,lzo)

$(obj)/Image-dtb: $(obj)/Image $(DTB_OBJS) FORCE
$(call if_changed,cat)

$(obj)/Image.gz-dtb: $(obj)/Image.gz $(DTB_OBJS) FORCE
$(call if_changed,cat)

install:
$(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
$(obj)/Image System.map "$(INSTALL_PATH)"
Expand Down
20 changes: 17 additions & 3 deletions arch/arm64/boot/dts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,21 @@ subdir-y += xilinx
subdir-y += zte

dtstree := $(srctree)/$(src)
vendor := $(dtstree)/vendor
ifneq "$(wildcard $(vendor)/Makefile)" ""
subdir-y += vendor

dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(foreach d,$(subdir), $(wildcard $(dtstree)/$(d)/*.dts)))

always := $(dtb-y)

targets += dtbs

DTB_NAMES := $(subst $\",,$(CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE_NAMES))
ifneq ($(DTB_NAMES),)
DTB_LIST := $(addsuffix .dtb,$(DTB_NAMES))
else
DTB_LIST := $(dtb-y)
endif
targets += $(DTB_LIST)

dtbs: $(addprefix $(obj)/, $(DTB_LIST))

clean-files := dts/*.dtb *.dtb
Comment on lines +35 to +51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was moved to arch/arm64/boot/Makefile.