diff mbox

[LEDE-DEV] build: Adds the ability to disable personal initramfs build for target device

Message ID 1466103891-30447-1-git-send-email-adron@yapic.net
State Accepted
Delegated to: Felix Fietkau
Headers show

Commit Message

adron@yapic.net June 16, 2016, 7:04 p.m. UTC
From: Sergey Sergeev <adron@yapic.net>

 If KERNEL_INITRAMFS := in the target/linux/*/image/Makefile->Device/%NAME% section is set to ''
 then personal initramfs file for this target device will not be created.
 This var is similar to the Device/Build/kernel KERNEL_INSTALL :=

Signed-off-by: Sergey Sergeev <adron@yapic.net>
---
 include/image.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Felix Fietkau June 16, 2016, 7:15 p.m. UTC | #1
On 2016-06-16 21:04, adron@yapic.net wrote:
> From: Sergey Sergeev <adron@yapic.net>
> 
>  If KERNEL_INITRAMFS := in the target/linux/*/image/Makefile->Device/%NAME% section is set to ''
>  then personal initramfs file for this target device will not be created.
>  This var is similar to the Device/Build/kernel KERNEL_INSTALL :=
> 
> Signed-off-by: Sergey Sergeev <adron@yapic.net>
What devices do you need to disable initramfs for, and why?

- Felix
adron@yapic.net June 16, 2016, 7:59 p.m. UTC | #2
16.06.2016 22:15, Felix Fietkau пишет:
> On 2016-06-16 21:04, adron@yapic.net wrote:
>> From: Sergey Sergeev <adron@yapic.net>
>>
>>   If KERNEL_INITRAMFS := in the target/linux/*/image/Makefile->Device/%NAME% section is set to ''
>>   then personal initramfs file for this target device will not be created.
>>   This var is similar to the Device/Build/kernel KERNEL_INSTALL :=
>>
>> Signed-off-by: Sergey Sergeev <adron@yapic.net>
> What devices do you need to disable initramfs for, and why?
>
> - Felix
>
>
Hello. I need a Mikrotik devices.

I'm working on support for normal(ubi + jffs2 for NAND and jffs2 for 
NOR) sysupgrade system for all Mikrotiks devices.
This devices hasthree types of flash memory:
NAND flash with blocksize = 512b and oob = 16b  and ecc
   NAND flash with blocksize = 2048b and oob = 64b and ecc
   NOR flash with blocksize = 1024b and without oob and ecc.
So i create 3 type of devices:

ifeq ($(SUBTARGET),mikrotik)

define Device/rb-common
   LOADER_TYPE := elf
   KERNEL_INSTALL :=
   KERNEL = kernel-bin | lzma | loader-kernel | kernel2minor 
$$(KERNEL2MINOR_ARGS)
   KERNEL_INITRAMFS := kernel-bin | lzma | loader-kernel
   IMAGES := sysupgrade.bin
   IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | combined-image | 
check-size $$$$(IMAGE_SIZE)
endef

define Device/NOR
$(Device/rb-common)
   DEVICE_PROFILE := MikrotikDefault MikrotikNorFlash
   BLOCKSIZE := 64k
   IMAGE_SIZE := 16000k
   KERNEL2MINOR_ARGS := -s 1024 -i 0 -p NOR01024 -e
endef
TARGET_DEVICES += NOR

define Device/NAND-2048b
$(Device/rb-common)
   DEVICE_PROFILE := MikrotikDefault MikrotikNorFlash
   BLOCKSIZE := 128k
   IMAGE_SIZE := 32000k
   KERNEL2MINOR_ARGS := -s 2048 -i 65536 -p NND02048 -e -c
endef
TARGET_DEVICES += NAND-2048b

define Device/NAND-512b
$(Device/rb-common)
   DEVICE_PROFILE := MikrotikDefault MikrotikNorFlash
   BLOCKSIZE := 16k
   IMAGE_SIZE := 32000k
   KERNEL2MINOR_ARGS := -s 512 -i 65536 -p NND00512 -e -c
endef
TARGET_DEVICES += NAND-512b

endif # ifeq ($(SUBTARGET),mikrotik)

and after do make I get the following files:
cat ./bin/ar71xx/md5sums
1f5415c6fa8c9ac86ca04ab8d2bb7eaa 
*openwrt-ar71xx-mikrotik-vmlinux-initramfs.bin
74d5315b86e6d6285657097cb88330f1 
*openwrt-ar71xx-mikrotik-vmlinux-initramfs.lzma
8426e37778fb487839553a66f3a5e760 
*openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf
a3d42d184fa59780fda2517062007064 
*openwrt-ar71xx-mikrotik-NAND-2048b-initramfs-kernel.bin
a3d42d184fa59780fda2517062007064 
*openwrt-ar71xx-mikrotik-NAND-512b-initramfs-kernel.bin
a3d42d184fa59780fda2517062007064 
*openwrt-ar71xx-mikrotik-NOR-initramfs-kernel.bin
a3d42d184fa59780fda2517062007064 
*openwrt-ar71xx-mikrotik-vmlinux-initramfs-lzma.elf
a518ab1349dd193f84ff3e00399ba4ce 
*openwrt-ar71xx-mikrotik-vmlinux-initramfs.gz
a9ec346db00358038ed02d2c6759776d 
*openwrt-ar71xx-mikrotik-NOR-squashfs-sysupgrade.bin
adb5078c694fe049d773c6d2c46e4b62 
*openwrt-ar71xx-mikrotik-NAND-512b-squashfs-sysupgrade.bin
b2b003c9ade18a24e64d12de4d6396b2 
*openwrt-ar71xx-mikrotik-NAND-2048b-squashfs-sysupgrade.bin
...

As you can see we have 4identicalfiles:
openwrt-ar71xx-mikrotik-NAND-2048b-initramfs-kernel.bin,
penwrt-ar71xx-mikrotik-NAND-512b-initramfs-kernel.bin,
openwrt-ar71xx-mikrotik-NOR-initramfs-kernel.bin,
openwrt-ar71xx-mikrotik-vmlinux-initramfs-lzma.elf
So i want to use KERNEL_INITRAMFS := and leave only one initramfs 
file(openwrt-ar71xx-mikrotik-vmlinux-initramfs-lzma.elf) and three 
sysupgrade files.
adron@yapic.net June 21, 2016, 2:04 p.m. UTC | #3
16.06.2016 22:15, Felix Fietkau пишет:
> On 2016-06-16 21:04, adron@yapic.net wrote:
>> From: Sergey Sergeev <adron@yapic.net>
>>
>>   If KERNEL_INITRAMFS := in the target/linux/*/image/Makefile->Device/%NAME% section is set to ''
>>   then personal initramfs file for this target device will not be created.
>>   This var is similar to the Device/Build/kernel KERNEL_INSTALL :=
>>
>> Signed-off-by: Sergey Sergeev <adron@yapic.net>
> What devices do you need to disable initramfs for, and why?
>
> - Felix
>
Hello. What about my patch? Maybe there is another correct way to 
disable build initratfs duplicate files?
diff mbox

Patch

diff --git a/include/image.mk b/include/image.mk
index f8291f4..3a27a40 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -351,7 +351,7 @@  endef
 ifndef IB
 define Device/Build/initramfs
   $(call Device/Export,$(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE),$(1))
-  $$(_TARGET): $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)
+  $$(_TARGET): $$(if $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE))
 
   $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare
   $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)