Ticket #4134: arm-magic.2.patch

File arm-magic.2.patch, 4.0 KB (added by jvasco@…, 8 years ago)
  • scripts/arm-magic.sh

     
    2121 
    2222# NOTE: for now it's for only IXP4xx in big endian mode 
    2323 
     24if [ "$BIG_ENDIAN" != 'y' ]; then 
     25  exit 1 
     26fi 
     27 
    2428# list of supported boards, in "boardname machtypeid" format 
    25 for board in "avila 526" "gateway7001 731" "nslu2 597" "nas100d 865" "wg302v1 889" "wg302v2 890" "pronghorn 928" "pronghornmetro 1040" "compex 1273" "wrt300nv2 1077" "loft 849" "dsmg600 964" "fsg3 1091" "ap1000 1543" "tw2662 1658" "tw5334 1664" "ixdpg425 604" "cambria 1468" "sidewinder 1041" 
     29for brd in $MKBOARDIMG 
    2630do 
    27   set -- $board 
    28   hexid=$(printf %x\\n $2) 
    29   if [ "$2" -lt "256" ]; then 
    30     # we have a low machtypeid, we just need a "mov" (e3a) 
    31     printf "\xe3\xa0\x10\x$hexid" > $BIN_DIR/openwrt-$1-zImage 
    32   else 
    33     # we have a high machtypeid, we need a "mov" (e3a) and an "orr" (e38) 
    34     printf "\xe3\xa0\x10\x$(echo $hexid|cut -b "2 3")\xe3\x81\x1c\x$(echo $hexid|cut -b 1)" > $BIN_DIR/openwrt-$1-zImage 
    35   fi 
     31  board=${brd:12} 
     32  p="#define.MACH_TYPE_$board" 
     33  machtypeid=`grep $p $LINUX_DIR/include/asm-arm/mach-types.h` 
     34  if [ $? -eq   0 ]; then 
     35    set -- `echo $board | tr A-Z a-z` ${machtypeid:${#p}} 
     36 
     37    hexid=$(printf %x\\n $2) 
     38    if [ "$2" -lt "256" ]; then 
     39      # we have a low machtypeid, we just need a "mov" (e3a) 
     40      printf "\xe3\xa0\x10\x$hexid" > $BIN_DIR/openwrt-$1-zImage 
     41    else 
     42      # we have a high machtypeid, we need a "mov" (e3a) and an "orr" (e38) 
     43      printf "\xe3\xa0\x10\x${hexid:1:2}\xe3\x81\x1c\x${hexid:0:1}" > $BIN_DIR/openwrt-$1-zImage 
     44    fi 
    3645    # generate the image 
    3746    cat $BIN_DIR/openwrt-ixp4xx-zImage >> $BIN_DIR/openwrt-$1-zImage 
     47  fi 
    3848done 
  • target/linux/ixp4xx/image/Makefile

     
    77include $(TOPDIR)/rules.mk 
    88include $(INCLUDE_DIR)/image.mk 
    99 
     10ifdef $(CONFIG_TARGET_ixp4xx_generic_NSLU2) 
    1011define Image/Build/slug 
    1112        BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/slugimage.pl \ 
    1213                -L $(KDIR)/apex-nslu2-armeb.bin \ 
     
    3031define Build/Clean 
    3132        $(MAKE) -C apex clean 
    3233endef 
     34endif 
    3335 
    3436define Image/Prepare 
    3537        cp $(LINUX_DIR)/arch/arm/boot/zImage $(KDIR)/zImage 
    3638endef 
    3739 
     40#IXP4XXBOARDS=$(subst CONFIG_MACH_,,$(filter CONFIG_MACH_%,$(.VARIABLES))) 
     41IXP4XXBOARDS= \ 
     42        CONFIG_MACH_NSLU2 \ 
     43        CONFIG_MACH_AVILA \ 
     44        CONFIG_MACH_CAMBRIA \ 
     45        CONFIG_ARCH_ADI_COYOTE \ 
     46        CONFIG_MACH_GATEWAY7001 \ 
     47        CONFIG_MACH_WG302V1 \ 
     48        CONFIG_MACH_WG302V2 \ 
     49        CONFIG_MACH_PRONGHORN \ 
     50        CONFIG_MACH_PRONGHORNMETRO \ 
     51        CONFIG_MACH_SIDEWINDER \ 
     52        CONFIG_MACH_USR8200 \ 
     53        CONFIG_MACH_COMPEX \ 
     54        CONFIG_MACH_WRT300NV2 \ 
     55        CONFIG_MACH_AP1000 \ 
     56        CONFIG_ARCH_IXDP425 \ 
     57        CONFIG_MACH_IXDPG425 \ 
     58        CONFIG_MACH_IXDP465 \ 
     59        CONFIG_MACH_KIXRP435 \ 
     60        CONFIG_ARCH_PRPMC1100 \ 
     61        CONFIG_MACH_TW5334 \ 
     62        CONFIG_MACH_NAS100D \ 
     63        CONFIG_MACH_DSMG600 \ 
     64        CONFIG_MACH_FSG \ 
     65        CONFIG_MACH_GTWX5715 \ 
     66        CONFIG_MACH_MI424WR 
     67 
    3868define Image/BuildKernel 
    3969        cp $(KDIR)/zImage $(BIN_DIR)/openwrt-$(BOARD)-zImage 
     70        MKBOARDIMG="$(foreach brd,$(IXP4XXBOARDS),$(if $($(brd)),$(brd)))" \ 
     71        BIG_ENDIAN=$(CONFIG_ARCH_SUPPORTS_BIG_ENDIAN) LINUX_DIR=$(LINUX_DIR) \ 
    4072        BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/arm-magic.sh 
    4173endef 
    4274 
     
    5082 
    5183define Image/Build/jffs2-128k 
    5284        dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=131072 conv=sync 
    53         $(call Image/Build/slug,$(1)) 
     85        $(if $(CONFIG_TARGET_ixp4xx_generic_NSLU2),$(call Image/Build/slug,$(1))) 
    5486endef 
    5587 
    5688define Image/Build/squashfs 
    57     $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) 
     89        $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) 
    5890        dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=131072 conv=sync 
    59         $(call Image/Build/slug,$(1)) 
     91        $(if $(CONFIG_TARGET_ixp4xx_generic_NSLU2),$(call Image/Build/slug,$(1))) 
    6092endef 
    6193 
    6294$(eval $(call BuildImage))