Changeset 38120


Ignore:
Timestamp:
2013-09-22T13:45:09+02:00 (4 years ago)
Author:
juhosg
Message:

ar71xx: simplify wndr3700 image generation

  • remove the kernel and rootfs partitions from the mtd layout, the kernel creates those automatically,
  • remove estimation step, it is not needed anymore
  • put the root squashfs directly after the kernel
  • use the 64kraw template

With the default configuration, this allows to use more space for
rootfs_data with 64KiB. Tested on WNDR3700 v1 only.

Signed-off-by: Gabor Juhos <juhosg@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/ar71xx/image/Makefile

    r38117 r38120  
    185185whrhpg300n_mtdlayout=mtdparts=spi0.0:248k(u-boot)ro,8k(u-boot-env)ro,3712k(firmware),64k(art)ro 
    186186wndap360_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1728k(kernel),6016k(rootfs),64k(nvram)ro,64k(art)ro,7744k@0x50000(firmware) 
    187 wnr2000v3_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1024k(kernel),2688k(rootfs),64k(art)ro,3712k@0x50000(firmware) 
    188 wnr2200_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1152k(kernel),6528k(rootfs),64k(art)ro,7680k@0x70000(firmware) 
    189 wndr3700_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1152k(kernel),6528k(rootfs),64k(art)ro,7680k@0x70000(firmware) 
    190 wndr3700v2_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1152k(kernel),14720k(rootfs),64k(art)ro,15872k@0x70000(firmware) 
     187wnr2200_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,7680k(firmware),64k(art)ro 
     188wnr2000v3_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,3712k(firmware),64k(art)ro 
     189wndr3700_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,7680k(firmware),64k(art)ro 
     190wndr3700v2_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,15872k(firmware),64k(art)ro 
    191191wndr4300_mtdlayout=mtdparts=ar934x-nfc:256k(u-boot)ro,256k(u-boot-env)ro,256k(caldata),512k(pot),2048k(language),512k(config),3072k(traffic_meter),1152k(kernel),24448k(rootfs),25600k@0x6c0000(firmware),256k(caldata_backup),-(reserved) 
    192192zcn1523h_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6208k(rootfs),1472k(kernel),64k(configure)ro,64k(mfg)ro,64k(art)ro,7680k@0x50000(firmware) 
     
    685685endef 
    686686 
    687 define Image/Build/Netgear/Build_uImage 
    688         $(call MkuImageLzma,$(1),$(2) $(3),-d20) 
    689         -rm -rf $(KDIR)/$(1) 
    690         mkdir -p $(KDIR)/$(1)/image 
     687 
     688define Image/Build/Netgear/buildkernel 
     689        $(call MkuImageLzma,$(2),$(3) $(4),-d20) 
     690        -rm -rf $(KDIR_TMP)/$(2) 
     691        mkdir -p $(KDIR_TMP)/$(2)/image 
    691692        $(STAGING_DIR_HOST)/bin/wndr3700 \ 
    692                 $(KDIR_TMP)/vmlinux-$(1).uImage \ 
    693                 $(KDIR)/$(1)/image/uImage \ 
    694                 $(4) 
     693                $(KDIR_TMP)/vmlinux-$(2).uImage \ 
     694                $(KDIR_TMP)/$(2)/image/uImage \ 
     695                $(5) 
    695696        $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \ 
    696                 $(KDIR)/$(1) $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp \ 
    697                 -nopad -noappend -root-owned -be 
    698         -rm -rf $(KDIR)/$(1) 
     697                $(KDIR_TMP)/$(2) $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp1 \ 
     698                -noappend -root-owned -be -b 65536 
     699        ( \ 
     700                cat $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp1; \ 
     701                dd if=/dev/zero bs=1k count=1 \ 
     702        ) > $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp2 
    699703        mkimage -A mips -O linux -T filesystem -C none \ 
    700704                -a 0xbf070000 -e 0xbf070000 \ 
    701705                -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ 
    702                 -d $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp \ 
    703                 $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp2 
     706                -d $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp2 \ 
     707                $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp3 
    704708        $(STAGING_DIR_HOST)/bin/wndr3700 \ 
    705                 $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp2 \ 
    706                 $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs \ 
    707                 $(4) 
    708         -rm -f $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp* 
    709 endef 
    710  
    711 define Image/Build/Netgear/Estimate_uImage 
    712         $(call Image/Build/Netgear/Build_uImage,$(1)_est,$(2),$(3),$(4)) 
    713         ( \ 
    714                 set -e; \ 
    715                 kk=`echo '$(3)' | sed -e 's/.*[:,]\([0-9]*\)k(kernel).*/\1/'`; \ 
    716                 rk=`echo '$(3)' | sed -e 's/.*[:,]\([0-9]*\)k(rootfs).*/\1/'`; \ 
    717                 let 'tk = kk + rk'; \ 
    718                 s=`stat -c'%s' '$(KDIR_TMP)/vmlinux-$(1)_est.uImage.squashfs'`; \ 
    719                 c=`echo '$(3)' | wc -c`; \ 
    720                 let 'kk = (((s + c) / (64 * 1024) + 1) * 64)'; \ 
    721                 let 'rk = tk - kk'; \ 
    722                 echo '$(3)' | sed -e "s/[0-9]*k(kernel)/$$$${kk}k(kernel)/" \ 
    723                                   -e "s/[0-9]*k(rootfs)/$$$${rk}k(rootfs)/" > \ 
    724                         '$(KDIR_TMP)/$(1)_mtdparts'; \ 
    725                 let 'k = kk * 1024'; \ 
    726                 echo "$$$${k}" > '$(KDIR_TMP)/$(1)_kernel_maxsize'; \ 
    727                 let 'r = rk * 1024'; \ 
    728                 echo "$$$${r}" > '$(KDIR_TMP)/$(1)_rootfs_maxsize'; \ 
    729         ) 
    730         -rm -f $(KDIR_TMP)/vmlinux-$(1)_est \ 
    731                $(KDIR_TMP)/vmlinux-$(1)_est.bin.lzma \ 
    732                $(KDIR_TMP)/vmlinux-$(1)_est.uImage \ 
    733                $(KDIR_TMP)/vmlinux-$(1)_est.uImage.squashfs 
     709                $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp3 \ 
     710                $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs \ 
     711                $(5) 
    734712endef 
    735713 
    736714define Image/Build/Netgear 
    737         $(call Image/Build/Netgear/Estimate_uImage,$(2),$(3),$(4),$(5)) 
    738         $(call Image/Build/Netgear/Build_uImage,$(2),$(3),`cat $(KDIR_TMP)/$(2)_mtdparts`,$(5)) 
    739         if [ `stat -c%s '$(KDIR_TMP)/vmlinux-$(2).uImage.squashfs'` -gt \ 
    740              `cat '$(KDIR_TMP)/$(2)_kernel_maxsize'` ]; then \ 
    741                 echo "$(KDIR_TMP)/vmlinux-$(2).uImage.squashfs is too big" >& 2; \ 
    742         else if [ `stat -c%s '$(KDIR)/root.$(1)'` -gt \ 
    743              `cat '$(KDIR_TMP)/$(2)_rootfs_maxsize'` ]; then \ 
    744                 echo "$(KDIR)/root.$(1) is too big" >& 2; \ 
    745         else \ 
    746                 ( \ 
    747                         set -e; \ 
    748                         dd if=$(KDIR_TMP)/vmlinux-$(2).uImage.squashfs \ 
    749                         bs=`cat '$(KDIR_TMP)/$(2)_kernel_maxsize'` conv=sync; \ 
    750                         dd if=$(KDIR)/root.$(1) bs=64k; \ 
    751                 ) > $(call sysupname,$(1),$(2)); \ 
     715        $(eval fwsize=$(call mtdpartsize,firmware,$(4))) 
     716        $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage.squashfs,0,$(KDIR)/root.$(1),$(fwsize),$(call sysupname,$(1),$(2))) 
     717        if [ -e $(call sysupname,$(1),$(2)) ]; then \ 
     718                case "$(1)" in \ 
     719                *squashfs*) \ 
     720                        padjffs2 $(call sysupname,$(1),$(2)) 64; \ 
     721                        ;; \ 
     722                esac; \ 
    752723                for r in $(7) ; do \ 
    753724                        [ -n "$$$$r" ] && dashr="-$$$$r" || dashr= ; \ 
     
    757728                                -o $(call imgname,$(1),$(2))-factory$$$$dashr.img; \ 
    758729                done; \ 
    759         fi; fi 
     730        fi 
    760731endef 
    761732 
     
    910881# This is used with AthGzip profile for now 
    911882$(eval $(call SingleProfile,AthGzip,64k,WNDAP360,wndap360,WNDAP360,ttyS0,9600,$$(wndap360_mtdlayout),1769472,6160384,KRuImage)) 
    912 $(eval $(call SingleProfile,Netgear,64k,WNR2000V3,wnr2000v3,WNR2000V3,ttyS0,115200,$$(wnr2000v3_mtdlayout),2003,WNR2000V3,"" NA,)) 
    913 $(eval $(call SingleProfile,Netgear,64k,WNR2200,wnr2200,WNR2200,ttyS0,115200,$$(wnr2200_mtdlayout),2200,WNR2200,"" NA,)) 
    914 $(eval $(call SingleProfile,Netgear,64k,WNR612V2,wnr612v2,WNR612V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),2061,WNR612V2,"",)) 
    915 $(eval $(call SingleProfile,Netgear,64k,WNDR3700V1,wndr3700,WNDR3700,ttyS0,115200,$$(wndr3700_mtdlayout),3700,WNDR3700,"" NA,)) 
    916 $(eval $(call SingleProfile,Netgear,64k,WNDR3700V2,wndr3700v2,WNDR3700,ttyS0,115200,$$(wndr3700v2_mtdlayout),3701,WNDR3700v2,"",-H 29763654+16+64)) 
    917 $(eval $(call SingleProfile,Netgear,64k,WNDR3800,wndr3800,WNDR3700,ttyS0,115200,$$(wndr3700v2_mtdlayout),3701,WNDR3800,"",-H 29763654+16+128)) 
    918 $(eval $(call SingleProfile,Netgear,64k,WNDRMAC,wndrmac,WNDR3700,ttyS0,115200,$$(wndr3700v2_mtdlayout),3701,WNDRMAC,"",-H 29763654+16+64)) 
    919 $(eval $(call SingleProfile,Netgear,64k,WNDRMACV2,wndrmacv2,WNDR3700,ttyS0,115200,$$(wndr3700v2_mtdlayout),3701,WNDRMACv2,"",-H 29763654+16+128)) 
     883 
     884$(eval $(call SingleProfile,Netgear,64kraw,WNR2000V3,wnr2000v3,WNR2000V3,ttyS0,115200,$$(wnr2000v3_mtdlayout),2003,WNR2000V3,"" NA,)) 
     885$(eval $(call SingleProfile,Netgear,64kraw,WNR2200,wnr2200,WNR2200,ttyS0,115200,$$(wnr2200_mtdlayout),2200,WNR2200,"" NA,)) 
     886$(eval $(call SingleProfile,Netgear,64kraw,WNR612V2,wnr612v2,WNR612V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),2061,WNR612V2,"",)) 
     887$(eval $(call SingleProfile,Netgear,64kraw,WNDR3700V1,wndr3700,WNDR3700,ttyS0,115200,$$(wndr3700_mtdlayout),3700,WNDR3700,"" NA,,7 864 320)) 
     888$(eval $(call SingleProfile,Netgear,64kraw,WNDR3700V2,wndr3700v2,WNDR3700,ttyS0,115200,$$(wndr3700v2_mtdlayout),3701,WNDR3700v2,"",-H 29763654+16+64)) 
     889$(eval $(call SingleProfile,Netgear,64kraw,WNDR3800,wndr3800,WNDR3700,ttyS0,115200,$$(wndr3700v2_mtdlayout),3701,WNDR3800,"",-H 29763654+16+128)) 
     890$(eval $(call SingleProfile,Netgear,64kraw,WNDRMAC,wndrmac,WNDR3700,ttyS0,115200,$$(wndr3700v2_mtdlayout),3701,WNDRMAC,"",-H 29763654+16+64)) 
     891$(eval $(call SingleProfile,Netgear,64kraw,WNDRMACV2,wndrmacv2,WNDR3700,ttyS0,115200,$$(wndr3700v2_mtdlayout),3701,WNDRMACv2,"",-H 29763654+16+128)) 
    920892 
    921893$(eval $(call SingleProfile,NetgearNAND,64k,WNDR4300,wndr4300,WNDR4300,ttyS0,115200,$$(wndr4300_mtdlayout),3703,WNDR4300,"",-H 29763948+0+128+128+2x2+3x3)) 
Note: See TracChangeset for help on using the changeset viewer.