OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / vendors / CyberGuard / vendor.mak
1 #
2 # This Makefile fragment incorporates all the declarations and rules
3 # common to products for this vendor.
4 #
5 # It is included by <product>/Makefile 
6 #
7
8 .PHONY: image.clean image.tag image.copy image.dir image.linuz image.arm.zimage image.cramfs
9 .PHONY: image.sh.mot image.sh.abs image.flash image.configs
10 .PHONY: romfs.dirs romfs.symlinks romfs.default romfs.recover romfs.rc romfs.version
11
12 # Note: These must all be used only in romfs.post::
13 .PHONY: romfs.no-ixp400-modules romfs.ixp425-microcode romfs.ixp425-boot
14
15 # Stop dd from being so noisy
16 DD=dd 2>/dev/null
17
18 # Override this if necessary
19 FLASH_DEVICES ?= \
20         boot,c,90,0 \
21         ethmac,c,90,0 \
22         bootarg,c,90,0 \
23         config,c,90,2 \
24         image,c,90,4 \
25         all,c,90,6
26
27 # You probably want to add this to ROMFS_DIRS
28 DEFAULT_ROMFS_DIRS := bin sbin dev/flash dev/pts etc/config lib/modules proc var \
29              home/httpd/cgi-bin usr/bin usr/sbin
30
31 image.clean:
32         rm -f mkcramfs mksquashfs mksquashfs7z
33         rm -f addr.txt
34
35 mkcramfs: $(ROOTDIR)/user/cramfs/mkcramfs.c
36         $(HOSTCC) -o $@ -I$(STAGEDIR)/include $< -lz
37
38 .PHONY: mksquashfs
39 mksquashfs:
40         make -C $(ROOTDIR)/user/squashfs/squashfs-tools mksquashfs
41         ln -fs $(ROOTDIR)/user/squashfs/squashfs-tools/mksquashfs .
42
43 .PHONY: mksquashfs7z
44 mksquashfs7z:
45         make -C $(ROOTDIR)/user/squashfs/squashfs-tools mksquashfs7z
46         ln -fs $(ROOTDIR)/user/squashfs/squashfs-tools/mksquashfs7z .
47
48 # Tags an image with vendor,product,version and adds the checksum
49 image.tag:
50         printf '\0%s\0%s\0%s' $(VERSIONPKG) $(HW_VENDOR) $(HW_PRODUCT) >>$(IMAGE)
51         $(ROOTDIR)/tools/cksum -b -o 2 $(IMAGE) >> $(IMAGE)
52
53 image.copy:
54         @set -e; for i in $(IMAGE) $(KERNELZ) $(IMAGEDIR)/sh.mot $(IMAGEDIR)/sh.abs; do \
55                 [ -n "$(NO_BUILD_INTO_TFTPBOOT)" ] && continue; \
56                 [ -f $$i ] || continue; \
57                 echo cp $$i /tftpboot; \
58                 cp $$i /tftpboot; \
59         done
60         @[ -n "$(NO_BUILD_INTO_TFTPBOOT)" ] || ( echo cp $(IMAGE) /tftpboot/$(CONFIG_PRODUCT).bin; cp $(IMAGE) /tftpboot/$(CONFIG_PRODUCT).bin )
61
62 image.dir:
63         [ -d $(IMAGEDIR) ] || mkdir -p $(IMAGEDIR)
64         rm -rf $(ROMFSDIR)/man[1-9]
65
66 # Create ZIMAGE as vmlinux -> objcopy -> $(ZIMAGE)
67 image.linuz:
68         $(CROSS)objcopy -O binary $(ROOTDIR)/$(LINUXDIR)/vmlinux $(IMAGEDIR)/linux.bin
69         gzip -c -9 < $(IMAGEDIR)/linux.bin >$(ZIMAGE)
70
71 # Create ZIMAGE as arm/arm/boot/zImage
72 image.arm.zimage:
73         cp $(ROOTDIR)/$(LINUXDIR)/arch/arm/boot/zImage $(ZIMAGE)
74
75 image.cramfs: mkcramfs
76         ./mkcramfs -z -r $(ROMFSDIR) $(ROMFSIMG)
77
78 image.squashfs: mksquashfs
79         rm -f $(ROMFSIMG); mksquashfs=`pwd`/mksquashfs; cd $(ROMFSDIR); \
80         $$mksquashfs . $(ROMFSIMG) -all-root -noappend $(SQUASH_ENDIAN)
81
82 image.squashfs7z: mksquashfs7z
83         rm -f $(ROMFSIMG); mksquashfs7z=`pwd`/mksquashfs7z; cd $(ROMFSDIR); \
84         $$mksquashfs7z . $(ROMFSIMG) -all-root -noappend $(SQUASH_ENDIAN)
85
86 # Create (possibly) mbr + cramfs + zimage/linuz
87 image.bin:
88         cat $(MBRIMG) $(ROMFSIMG) $(ZIMAGE) >$(IMAGE)
89
90 addr.txt: $(ROOTDIR)/$(LINUXDIR)/vmlinux
91         $(CROSS)nm $(ROOTDIR)/$(LINUXDIR)/vmlinux | \
92                 grep " __bss_start$$" | \
93                 cut -d' ' -f1 | xargs printf "0x%s\n" >$@
94         @echo ROMFS@`cat $@`
95
96 image.sh.mot: addr.txt
97         @ADDR=`cat addr.txt`; \
98         $(CROSS)objcopy --add-section=.romfs=$(ROMFSIMG) \
99           --adjust-section-vma=.romfs=$${ADDR} --no-adjust-warnings \
100           --set-section-flags=.romfs=alloc,load,data   \
101                   -O srec \
102           $(ROOTDIR)/$(LINUXDIR)/vmlinux $(IMAGEDIR)/sh.mot
103
104 image.sh.abs: addr.txt
105         ADDR=`cat addr.txt`; \
106         $(CROSS)objcopy --add-section=.romfs=$(ROMFSIMG) \
107           --adjust-section-vma=.romfs=$${ADDR} --no-adjust-warnings \
108           --set-section-flags=.romfs=alloc,load,data   \
109           $(ROOTDIR)/$(LINUXDIR)/vmlinux $(IMAGEDIR)/sh.abs
110
111 image.flash:
112         [ ! -f $(ROOTDIR)/boot/boot.bin ] || $(MAKE) vendor_flashbin
113
114 image.configs:
115         @rm -rf configs
116         @mkdir -p configs
117         cp $(ROOTDIR)/.config configs/config.device
118         cp $(ROOTDIR)/config/.config configs/config.vendor-$(patsubst linux-%,%,$(CONFIG_LINUXDIR)) 
119         cp $(ROOTDIR)/$(CONFIG_LINUXDIR)/.config configs/config.$(CONFIG_LINUXDIR)
120         cp $(ROOTDIR)/$(CONFIG_LIBCDIR)/.config configs/config.$(CONFIG_LIBCDIR)
121         tar czf $(IMAGEDIR)/configs.tar.gz configs
122         @rm -rf configs
123         
124 romfs.dirs:
125         mkdir -p $(ROMFSDIR)
126         @for i in $(ROMFS_DIRS); do \
127                 mkdir -p $(ROMFSDIR)/$$i; \
128         done
129
130 romfs.symlinks:
131         $(ROMFSINST) -s /var/tmp /tmp
132         $(ROMFSINST) -s /var/mnt /mnt
133         $(ROMFSINST) -s /var/tmp/log /dev/log
134
135 romfs.default:
136         $(ROMFSINST) ../romfs /
137
138 romfs.recover:
139         $(ROMFSINST) ../romfs.recover /
140
141 romfs.rc:
142         $(ROMFSINST) /etc/rc; \
143         [ ! -f filesystems ] || $(ROMFSINST) /etc/filesystems
144
145 romfs.no-ixp400-modules:
146         rm -f $(ROMFSDIR)/lib/modules/*/kernel/ixp425/ixp400/ixp400_*.o
147
148 romfs.ixp425-microcode:
149         [ ! -f $(ROOTDIR)/modules/ixp425/ixp400-2.0/IxNpeMicrocode.dat ] || $(ROMFSINST) -d $(ROOTDIR)/modules/ixp425/ixp400-2.0/IxNpeMicrocode.dat /etc/IxNpeMicrocode.dat
150         [ ! -f $(ROOTDIR)/modules/ixp425/ixp400-2.1/IxNpeMicrocode.dat ] || $(ROMFSINST) -d $(ROOTDIR)/modules/ixp425/ixp400-2.1/IxNpeMicrocode.dat /etc/IxNpeMicrocode.dat
151         [ ! -f $(ROOTDIR)/modules/ixp425/ixp400-2.4/IxNpeMicrocode.dat ] || $(ROMFSINST) -d $(ROOTDIR)/modules/ixp425/ixp400-2.4/IxNpeMicrocode.dat /etc/IxNpeMicrocode.dat
152
153 romfs.ixp425-boot:
154         -$(ROMFSINST) -d $(ROOTDIR)/boot/ixp425/bios.bin /boot/biosplus.bin
155         -$(ROMFSINST) -d $(ROOTDIR)/boot/ixp425/boot.bin /boot/bootplus.bin
156
157 romfs.version:
158         echo "$(VERSIONSTR) -- " $(BUILD_START_STRING) > $(ROMFSDIR)/etc/version