Fix init_boot.img build rule with TARGET_NO_KERNEL:=true

If TARGET_NO_KERNEL is true (device has prebuilt boot.img), then the
init_boot.img build arguments wouldn't be propagated correctly.
This is because INTERNAL_INIT_BOOT_IMAGE_ARGS is misplaced within a
`ifneq ($(strip $(TARGET_NO_KERNEL)),true)` conditional block.

Fix this by moving INTERNAL_INIT_BOOT_IMAGE_ARGS initialization into the
`ifeq ($(BUILDING_INIT_BOOT_IMAGE),true)` block, which is closer to its
first use.

Bug: 237630862
Test: m initbootimage
Change-Id: I6c0ee2c4b5d0be77a93311eba714e0ed555ffd25
diff --git a/core/Makefile b/core/Makefile
index a96cfd5..dcf5912 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -967,15 +967,11 @@
 INTERNAL_BOOTIMAGE_ARGS := \
 	$(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET))
 
-INTERNAL_INIT_BOOT_IMAGE_ARGS :=
-
 # TODO(b/229701033): clean up BOARD_BUILD_GKI_BOOT_IMAGE_WITHOUT_RAMDISK.
 ifneq ($(BOARD_BUILD_GKI_BOOT_IMAGE_WITHOUT_RAMDISK),true)
   ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
     ifneq ($(BUILDING_INIT_BOOT_IMAGE),true)
       INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
-    else
-      INTERNAL_INIT_BOOT_IMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
     endif
   endif
 endif
@@ -1222,6 +1218,8 @@
 INSTALLED_INIT_BOOT_IMAGE_TARGET := $(PRODUCT_OUT)/init_boot.img
 $(INSTALLED_INIT_BOOT_IMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_RAMDISK_TARGET)
 
+INTERNAL_INIT_BOOT_IMAGE_ARGS := --ramdisk $(INSTALLED_RAMDISK_TARGET)
+
 ifdef BOARD_KERNEL_PAGESIZE
   INTERNAL_INIT_BOOT_IMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
 endif