init: simplify initramfs.o build rule

CONFIG_BLK_DEV_INITRD is known to be enabled in the else branch,
so there is no need to use obj-$(CONFIG_BLK_DEV_INITRD). Use obj-y
directly to make the build rule clearer.

Also, reorder the condition to make the code easier to follow.

No functional change.

Link: https://lore.kernel.org/20260930015748.311366-1-yuntao.wang@linux.dev
Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
This commit is contained in:
Yuntao Wang 2026-09-30 09:57:48 +08:00 committed by Andrew Morton
parent 7c3f4d699f
commit a7f476e262

View File

@ -6,10 +6,10 @@
ccflags-y := -fno-function-sections -fno-data-sections
obj-y := main.o version.o mounts.o
ifneq ($(CONFIG_BLK_DEV_INITRD),y)
obj-y += noinitramfs.o
ifeq ($(CONFIG_BLK_DEV_INITRD),y)
obj-y += initramfs.o
else
obj-$(CONFIG_BLK_DEV_INITRD) += initramfs.o
obj-y += noinitramfs.o
endif
obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o
obj-$(CONFIG_INITRAMFS_TEST) += initramfs_test.o