OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | # |
2 | # Copyright (C) 2006-2010 OpenWrt.org |
||
3 | # |
||
4 | # This is free software, licensed under the GNU General Public License v2. |
||
5 | # See /LICENSE for more information. |
||
6 | # |
||
7 | include $(TOPDIR)/rules.mk |
||
8 | include $(INCLUDE_DIR)/image.mk |
||
9 | |||
10 | LOADADDR = 0x81000000 # RAM start + 16M |
||
11 | KERNEL_ENTRY = 0x80101000 |
||
12 | RAMSIZE = 0x00100000 # 1MB |
||
13 | IMAGE_COPY = 1 |
||
14 | |||
15 | LOADER_MAKEOPTS= \ |
||
16 | CROSS_COMPILE="$(TARGET_CROSS)" \ |
||
17 | PATH="$(TARGET_PATH)" \ |
||
18 | CC="$(TARGET_CC)" \ |
||
19 | KDIR=$(KDIR) \ |
||
20 | LOADADDR=$(LOADADDR) \ |
||
21 | KERNEL_ENTRY=$(KERNEL_ENTRY) \ |
||
22 | RAMSIZE=$(RAMSIZE) \ |
||
23 | IMAGE_COPY=$(IMAGE_COPY) |
||
24 | |||
25 | |||
26 | LOADER_DIR = $(GENERIC_PLATFORM_DIR)/image/lzma-loader |
||
27 | |||
28 | define Build/lzma-loader-elf |
||
29 | rm -rf $@.loader |
||
30 | mkdir -p $@.loader |
||
31 | $(CP) $(LOADER_DIR)/src/* $@.loader/ |
||
32 | $(CP) $@ $@.loader/vmlinux.lzma |
||
33 | $(MAKE) -C $@.loader $(LOADER_MAKEOPTS) |
||
34 | cp $@.loader/lzma.elf $@ |
||
35 | rm -rf $@.loader |
||
36 | endef |
||
37 | |||
38 | define Device/nand |
||
39 | CMDLINE := ubi.mtd=1 ubi.block=0,rootfs root=/dev/ubiblock0_1 |
||
40 | BOARD_NAME := rb532 |
||
41 | SUPPORTED_DEVICES := rb532 |
||
42 | KERNEL_INITRAMFS := append-kernel | patch-cmdline | lzma | lzma-loader-elf |
||
43 | KERNEL := $$(KERNEL_INITRAMFS) | kernel2minor -s 2048 -i 0 -c |
||
44 | IMAGES := sysupgrade.bin |
||
45 | FILESYSTEMS := squashfs |
||
46 | IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata |
||
47 | endef |
||
48 | |||
49 | TARGET_DEVICES := nand |
||
50 | |||
51 | define Build/Clean |
||
52 | $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean |
||
53 | endef |
||
54 | |||
55 | define Image/Prepare |
||
56 | cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma |
||
57 | $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile |
||
58 | ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) |
||
59 | $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-initramfs '$(strip $(call Image/cmdline/yaffs2)) ' |
||
60 | cat $(KDIR)/vmlinux-initramfs | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma |
||
61 | $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile |
||
62 | $(CP) $(KDIR)/loader.elf $(KDIR)/loader-initramfs.elf |
||
63 | endif |
||
64 | endef |
||
65 | |||
66 | VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux-kernel |
||
67 | |||
68 | define Image/BuildKernel |
||
69 | $(CP) $(KDIR)/loader.elf $(VMLINUX) |
||
70 | ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) |
||
71 | $(CP) $(KDIR)/loader-initramfs.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs |
||
72 | endif |
||
73 | endef |
||
74 | |||
75 | define Image/cmdline/yaffs2 |
||
76 | root=/dev/mtdblock1 rootfstype=yaffs2 |
||
77 | endef |
||
78 | |||
79 | define Image/Build/squashfs |
||
80 | dd if=/dev/zero bs=128k count=1 >> $(KDIR)/root.squashfs |
||
81 | endef |
||
82 | |||
83 | define Image/Build |
||
84 | $(call Image/Build/$(1),$(1)) |
||
85 | $(CP) $(KDIR)/vmlinux.elf $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel |
||
86 | $(STAGING_DIR_HOST)/bin/patch-cmdline $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel 'root=/dev/sda2 ' |
||
87 | ./gen_image.sh $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).bin \ |
||
88 | 6 $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel \ |
||
89 | $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1) \ |
||
90 | 128 |
||
91 | endef |
||
92 | |||
93 | $(eval $(call BuildImage)) |