[LEDE-DEV] RFC: files included in initramfs images (was: [PATCH] ramips: enable ramdisk for mt7621)

Daniel Golle daniel at makrotopia.org
Thu May 4 08:53:50 PDT 2017


Hi everyone,

I found another quick solution to the problem which was to reduce
the amount of packages in the default profile of MT7621.
See commit d17cb4a68a45 in the master branch.
When it came to backport this to lede-17.01 I noticed that several
boards have been added to master since and are not yet present in the
lede-17.01 branch. Also the ZBT WG3526 has been split-up into a
16MB flash and 32MB flash variant and Digineo AC1200 Pro has been
renamed/merged with ZBT-WG3625-16M.
Should I cherry-pick all added boards to lede-17.01, including the
rename of the Digineo device?
Or just backport the commit changing the default packages from master
and skip the boards which are not preset in lede-17.01 (which obviously
makes future backporting of the commits adding those boards harder)?

Cheers

Daniel


On Thu, May 04, 2017 at 05:35:59AM +0200, Daniel Golle wrote:
> Hi Paul,
> 
> I've merged your patch, however, it looks like the buildbot process
> still doesn't generate the desired image (despite our tests and success
> we've seen earlier). This is because the ubnt-erx-factory-image build
> artifact cannot work in the ImageBuilder and I've converted it into
> a nicer and more compact variant (see patch below).
> However, it still doesn't work for a rather odd and not as easy to fix
> reason:
> The resulting initramfs-kernel.bin as found on
> http://downloads.lede-project.org/snapshots/targets/ramips/mt7621/lede-ramips-mt7621-ubnt-erx-initramfs-kernel.bin
> is 3427 KB in size -- however, the Er-X allows only up to 3072 KB.
> This is because (other than the rootfs) the initramfs is still not
> generated individually for each board but rather contains all packages
> needed for all boards in the same subtarget: on MT7621 this includes
> several WiFi drivers and lots of things you usually won't ever need
> on the Er-X.
> 
> Hence I suggest to change the way to initramfs is generated in general:
> Create a second rootfs for initramfs and have only a very minimal and
> not board-specific set of packages installed there. Maybe this could
> also include stuff usually only needed during recovery/rescue/factory
> situations such as a minimal web-interface which allows flashing the
> 'real' LEDE firmware.
> To control the initramfs behaviour of the build-system we could
> introduce a new config variable such as
> CONFIG_TARGET_ROOTFS_INITRAMFS_MINIMAL which defaults to y
> but can be disabled if people actually want the whole usual rootfs
> being included in the initrd as well.
> And we could have CONFIG_TARGET_ROOTFS_INITRAMFS_MINIMAL_EXTRA_PACKAGES
> to allow including packages which aren't part of the normal rootfs.
> 
> I'd like to hear some opinion about that from Felix, John, Matthias,
> Jo-Philipp, Hauke, Yousong, et al. before I get started to implement
> this because it's a quite drastic change...
> 
> 
> Cheers
> 
> 
> Daniel
> 
> 
> 
> 
> diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
> index b57552a6f4..c9b2e537d4 100644
> --- a/target/linux/ramips/image/mt7621.mk
> +++ b/target/linux/ramips/image/mt7621.mk
> @@ -3,27 +3,19 @@
>  #
>  
>  define Build/ubnt-erx-factory-image
> -	if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(KERNEL_SIZE)" ]; then \
> -		echo '21001:6' > $(1).compat; \
> -		$(TAR) -cf $(1) --transform='s/^.*/compat/' $(1).compat; \
> -		\
> -		$(TAR) -rf $(1) --transform='s/^.*/vmlinux.tmp/' $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE); \
> -		mkhash md5 $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) > $(1).md5; \
> -		$(TAR) -rf $(1) --transform='s/^.*/vmlinux.tmp.md5/' $(1).md5; \
> -		\
> -		echo "dummy" > $(1).rootfs; \
> -		$(TAR) -rf $(1) --transform='s/^.*/squashfs.tmp/' $(1).rootfs; \
> -		\
> -		mkhash md5 $(1).rootfs > $(1).md5; \
> -		$(TAR) -rf $(1) --transform='s/^.*/squashfs.tmp.md5/' $(1).md5; \
> -		\
> -		echo '$(BOARD) $(VERSION_CODE) $(VERSION_NUMBER)' > $(1).version; \
> -		$(TAR) -rf $(1) --transform='s/^.*/version.tmp/' $(1).version; \
> -		\
> -		$(CP) $(1) $(BIN_DIR)/; \
> -	else \
> -		echo "WARNING: initramfs kernel image too big, cannot generate factory image" >&2; \
> -	fi
> +	rm -rf $@.uImage $@.compat $@.rootfs $@.md5 $@.version
> +	mv $@ $@.uImage
> +	echo '21001:6' > $@.compat
> +	$(TAR) -cf $@ --transform='s/^.*/compat/' $@.compat
> +	$(TAR) -rf $@ --transform='s/^.*/vmlinux.tmp/' $@.uImage
> +	mkhash md5 $@.uImage > $@.md5
> +	$(TAR) -rf $@ --transform='s/^.*/vmlinux.tmp.md5/' $@.md5
> +	echo "dummy" > $@.rootfs
> +	$(TAR) -rf $@ --transform='s/^.*/squashfs.tmp/' $@.rootfs
> +	mkhash md5 $@.rootfs > $@.md5
> +	$(TAR) -rf $@ --transform='s/^.*/squashfs.tmp.md5/' $@.md5
> +	echo '$(BOARD) $(VERSION_CODE) $(VERSION_NUMBER)' > $@.version
> +	$(TAR) -rf $@ --transform='s/^.*/version.tmp/' $@.version
>  endef
>  
>  define Device/11acnas
> @@ -166,10 +158,12 @@ TARGET_DEVICES += timecloud
>  define Device/ubnt-erx
>    DTS := UBNT-ERX
>    FILESYSTEMS := squashfs
> -  KERNEL_SIZE := 3145728
> +  KERNEL_SIZE := 3072k
>    KERNEL := $(KERNEL_DTB) | uImage lzma
>    IMAGES := sysupgrade.tar
> -  KERNEL_INITRAMFS := $$(KERNEL) | ubnt-erx-factory-image $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.tar
> +  KERNEL_INITRAMFS := $(KERNEL_DTB) | uImage lzma | check-size $(KERNEL_SIZE) | ubnt-erx-factory-image
> +  KERNEL_INITRAMFS_PREFIX = $$(IMAGE_PREFIX)-factory
> +  KERNEL_INITRAMFS_SUFFIX := .tar
>    IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata
>    DEVICE_TITLE := Ubiquiti EdgeRouter X
>    DEVICE_PACKAGES := -kmod-mt76 -kmod-mt7603 -kmod-mt76x2 -kmod-mt76-core -kmod-mac80211 -kmod-cfg80211 -wpad-mini -iwinfo
> 
> 
> 
> 
> On Thu, May 04, 2017 at 12:47:34AM +0200, Paul Spooren wrote:
> > Fixes #758
> > 
> > Signed-off-by: Paul Spooren <paul at spooren.de>
> > ---
> >  target/linux/ramips/mt7621/target.mk | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/target/linux/ramips/mt7621/target.mk b/target/linux/ramips/mt7621/target.mk
> > index 121761f45f..d075acbf87 100644
> > --- a/target/linux/ramips/mt7621/target.mk
> > +++ b/target/linux/ramips/mt7621/target.mk
> > @@ -4,7 +4,7 @@
> >  
> >  SUBTARGET:=mt7621
> >  BOARDNAME:=MT7621 based boards
> > -FEATURES+=usb rtc nand
> > +FEATURES+=nand ramdisk rtc usb
> >  CPU_TYPE:=24kc
> >  
> >  DEFAULT_PACKAGES += kmod-mt76
> > -- 
> > 2.11.0
> > 
> > 
> > _______________________________________________
> > Lede-dev mailing list
> > Lede-dev at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/lede-dev
> 
> _______________________________________________
> Lede-dev mailing list
> Lede-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev



More information about the Lede-dev mailing list