OpenWrt – Blame information for rev 3
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | # |
2 | # Copyright (C) 2006-2015 OpenWrt.org |
||
3 | # Copyright (C) 2016 LEDE project |
||
4 | # |
||
5 | # This is free software, licensed under the GNU General Public License v2. |
||
6 | # See /LICENSE for more information. |
||
7 | # |
||
8 | include $(TOPDIR)/rules.mk |
||
9 | include $(INCLUDE_DIR)/image.mk |
||
10 | |||
11 | LOADADDR = 0x80010000 # RAM start + 64K |
||
12 | KERNEL_ENTRY = $(LOADADDR) # Newer kernels add a jmp to the kernel_entry at the start of the binary |
||
13 | LOADER_ENTRY = 0x80a00000 # RAM start + 10M, for relocate |
||
14 | RAMSIZE = 0x02000000 # 32MB |
||
15 | LZMA_TEXT_START = 0x81800000 # 32MB - 8MB |
||
16 | |||
17 | LOADER_MAKEOPTS= \ |
||
18 | KDIR=$(KDIR) \ |
||
19 | LOADADDR=$(LOADADDR) \ |
||
20 | KERNEL_ENTRY=$(KERNEL_ENTRY) \ |
||
21 | RAMSIZE=$(RAMSIZE) \ |
||
22 | LZMA_TEXT_START=$(LZMA_TEXT_START) \ |
||
23 | |||
24 | RELOCATE_MAKEOPTS= \ |
||
25 | CACHELINE_SIZE=16 \ |
||
26 | KERNEL_ADDR=$(KERNEL_ENTRY) \ |
||
27 | CROSS_COMPILE=$(TARGET_CROSS) \ |
||
28 | LZMA_TEXT_START=$(LOADER_ENTRY) |
||
29 | |||
30 | define Build/Compile |
||
31 | rm -rf $(KDIR)/relocate |
||
32 | $(CP) ../../generic/image/relocate $(KDIR) |
||
33 | $(MAKE) -C $(KDIR)/relocate $(RELOCATE_MAKEOPTS) |
||
34 | endef |
||
35 | |||
36 | ### Kernel scripts ### |
||
37 | define Build/hcs-initramfs |
||
38 | $(STAGING_DIR_HOST)/bin/hcsmakeimage --magic_bytes=$(HCS_MAGIC_BYTES) \ |
||
39 | --rev_maj=$(HCS_REV_MAJ) --rev_min=$(HCS_REV_MIN) --input_file=$@ \ |
||
40 | --output_file=$@.hcs --ldaddress=$(LOADADDR) |
||
41 | mv $@.hcs $@ |
||
42 | endef |
||
43 | |||
44 | define Build/loader-lzma |
||
45 | rm -rf $@.src |
||
46 | $(MAKE) -C lzma-loader \ |
||
47 | $(LOADER_MAKEOPTS) \ |
||
48 | PKG_BUILD_DIR="$@.src" \ |
||
49 | TARGET_DIR="$(dir $@)" \ |
||
50 | LOADER_DATA="$@" \ |
||
51 | LOADER_NAME="$(notdir $@)" \ |
||
52 | compile loader.$(1) |
||
53 | mv "$@.$(1)" "$@" |
||
54 | rm -rf $@.src |
||
55 | endef |
||
56 | |||
57 | define Build/lzma |
||
58 | # CFE is a LZMA nazi! It took me hours to find out the parameters! |
||
59 | # Also I think lzma has a bug cause it generates different output depending on |
||
60 | # if you use stdin / stdout or not. Use files instead of stdio here, cause |
||
61 | # otherwise CFE will complain and not boot the image. |
||
62 | $(STAGING_DIR_HOST)/bin/lzma e $@ -d22 -fb64 -a1 $@.lzma |
||
63 | mv $@.lzma $@ |
||
64 | endef |
||
65 | |||
66 | define Build/lzma-cfe |
||
67 | # Strip out the length, CFE doesn't like this |
||
68 | dd if=$@ of=$@.lzma.cfe bs=5 count=1 |
||
69 | dd if=$@ of=$@.lzma.cfe ibs=13 obs=5 skip=1 seek=1 conv=notrunc |
||
70 | mv $@.lzma.cfe $@ |
||
71 | endef |
||
72 | |||
73 | define Build/relocate-kernel |
||
74 | # CFE only allows ~4 MiB for the uncompressed kernels, but uncompressed |
||
75 | # kernel might get larger than that, so let CFE unpack and load at a |
||
76 | # higher address and make the kernel relocate itself to the expected |
||
77 | # location. |
||
78 | ( \ |
||
79 | dd if=$(KDIR)/relocate/loader.bin bs=32 conv=sync && \ |
||
80 | perl -e '@s = stat("$@"); print pack("N", @s[7])' && \ |
||
81 | cat $@ \ |
||
82 | ) > $@.relocate |
||
83 | mv $@.relocate $@ |
||
84 | endef |
||
85 | |||
86 | ### Image scripts ### |
||
87 | define rootfspad/jffs2-128k |
||
88 | --align-rootfs |
||
89 | endef |
||
90 | define rootfspad/jffs2-64k |
||
91 | --align-rootfs |
||
92 | endef |
||
93 | define rootfspad/squashfs |
||
94 | endef |
||
95 | |||
96 | define Image/LimitName16 |
||
97 | $(shell expr substr "$(1)" 1 16) |
||
98 | endef |
||
99 | |||
100 | define Image/FileSystemStrip |
||
101 | $(firstword $(subst +,$(space),$(subst root.,,$(notdir $(1))))) |
||
102 | endef |
||
103 | |||
104 | define Build/cfe-bin |
||
105 | $(STAGING_DIR_HOST)/bin/imagetag -i $(IMAGE_KERNEL) -f $(IMAGE_ROOTFS) \ |
||
106 | --output $@ --boardid $(CFE_BOARD_ID) --chipid $(CFE_CHIP_ID) \ |
||
107 | --entry $(LOADER_ENTRY) --load-addr $(LOADER_ENTRY) \ |
||
108 | --info1 "$(call Image/LimitName16,$(DEVICE_NAME))" \ |
||
109 | --info2 "$(call Image/FileSystemStrip,$(IMAGE_ROOTFS))" \ |
||
110 | $(call rootfspad/$(call Image/FileSystemStrip,$(IMAGE_ROOTFS))) \ |
||
111 | $(CFE_EXTRAS) $(1) |
||
112 | endef |
||
113 | |||
114 | define Build/cfe-old-bin |
||
115 | $(TOPDIR)/scripts/brcmImage.pl -t -p \ |
||
116 | -o $@ -b $(CFE_BOARD_ID) -c $(CFE_CHIP_ID) \ |
||
117 | -e $(LOADER_ENTRY) -a $(LOADER_ENTRY) \ |
||
118 | -k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) \ |
||
119 | $(CFE_EXTRAS) |
||
120 | endef |
||
121 | |||
122 | define Build/cfe-spw303v-bin |
||
123 | $(STAGING_DIR_HOST)/bin/imagetag -i $(IMAGE_KERNEL) -f $(IMAGE_ROOTFS) \ |
||
124 | --output $@ --boardid $(CFE_BOARD_ID) --chipid $(CFE_CHIP_ID) \ |
||
125 | --entry $(LOADER_ENTRY) --load-addr $(LOADER_ENTRY) \ |
||
126 | $(call rootfspad/$(call Image/FileSystemStrip,$(IMAGE_ROOTFS))) \ |
||
127 | $(CFE_EXTRAS) $(1) |
||
128 | endef |
||
129 | |||
130 | define Build/spw303v-bin |
||
131 | $(STAGING_DIR_HOST)/bin/spw303v -i $@ -o $@.spw303v |
||
132 | mv $@.spw303v $@ |
||
133 | endef |
||
134 | |||
3 | office | 135 | define Build/xor-image |
136 | $(STAGING_DIR_HOST)/bin/xorimage -i $@ -o $@.xor |
||
137 | mv $@.xor $@ |
||
138 | endef |
||
139 | |||
1 | office | 140 | define Build/zyxel-bin |
141 | $(STAGING_DIR_HOST)/bin/zyxbcm -i $@ -o $@.zyxel |
||
142 | mv $@.zyxel $@ |
||
143 | endef |
||
144 | |||
145 | define Build/redboot-bin |
||
146 | # Prepare kernel and rootfs |
||
147 | dd if=$(IMAGE_KERNEL) of=$(BIN_DIR)/$(REDBOOT_PREFIX)-vmlinux.gz bs=65536 conv=sync |
||
148 | dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/$(REDBOOT_PREFIX)-$(notdir $(IMAGE_ROOTFS)) bs=64k conv=sync |
||
149 | echo -ne \\xDE\\xAD\\xC0\\xDE >> $(BIN_DIR)/$(REDBOOT_PREFIX)-$(notdir $(IMAGE_ROOTFS)) |
||
150 | # Generate the scripted image |
||
151 | $(TOPDIR)/scripts/redboot-script.pl \ |
||
152 | -k $(BIN_DIR)/$(REDBOOT_PREFIX)-vmlinux.gz \ |
||
153 | -r $(BIN_DIR)/$(REDBOOT_PREFIX)-$(notdir $(IMAGE_ROOTFS)) \ |
||
154 | -a $(strip $(LOADER_ENTRY)) -f 0xbe430000 -l 0x7c0000 \ |
||
155 | -s 0x1000 -t 20 -o $@.redbootscript |
||
156 | dd if="$@.redbootscript" of="$@.redbootscript.padded" bs=4096 conv=sync |
||
157 | cat \ |
||
158 | "$@.redbootscript.padded" \ |
||
159 | "$(BIN_DIR)/$(REDBOOT_PREFIX)-vmlinux.gz" \ |
||
160 | "$(BIN_DIR)/$(REDBOOT_PREFIX)-$(notdir $(IMAGE_ROOTFS))" \ |
||
161 | > "$@" |
||
162 | endef |
||
163 | |||
164 | define Device/Default |
||
165 | PROFILES = Default $$(DEVICE_NAME) |
||
166 | KERNEL_DEPENDS = $$(wildcard ../dts/$$(DEVICE_DTS).dts) |
||
167 | KERNEL_INITRAMFS_SUFFIX := .elf |
||
168 | DEVICE_DTS_DIR := ../dts |
||
169 | endef |
||
170 | |||
3 | office | 171 | ATH5K_PACKAGES := kmod-ath5k wpad-mini |
172 | ATH9K_PACKAGES := kmod-ath9k wpad-mini |
||
173 | B43_PACKAGES := kmod-b43 wpad-mini |
||
1 | office | 174 | BRCMWL_PACKAGES := kmod-brcm-wl nas wlc |
3 | office | 175 | RT28_PACKAGES := kmod-rt2800-pci wpad-mini |
176 | RT61_PACKAGES := kmod-rt61-pci wpad-mini |
||
1 | office | 177 | USB1_PACKAGES := kmod-usb-ohci kmod-usb-ledtrig-usbport |
178 | USB2_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport |
||
179 | |||
180 | include bcm63xx.mk |
||
181 | |||
182 | $(eval $(call BuildImage)) |