OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / vendors / Insight / XC2VP7_Microblaze / Makefile
1 #
2 # Makefile -- Build instructions for Insight XC2VP7 board
3 #
4
5 # ROMFSIMG = $(IMAGEDIR)/root.romfs
6 # IMAGE    = $(IMAGEDIR)/image.bin
7 # IMAGEZ         = $(IMAGEDIR)/imagez.bin
8 # ELFIMAGE = $(IMAGEDIR)/linux
9 ROMFSIMG = $(IMAGEDIR)/romfs.img
10 IMAGE    = $(IMAGEDIR)/image.bin
11 IMAGEZ   = $(IMAGEDIR)/imagez.bin
12 ELFIMAGE = $(IMAGEDIR)/image.elf
13
14 DIRS = 
15
16 ROMFS_DIRS = bin dev dev/flash etc home lib mnt proc usr var
17
18 DEVICES =                                                                     \
19         tty,c,5,0      console,c,5,1   mem,c,1,1     kmem,c,1,2    null,c,1,3 \
20                                                                               \
21         ttyS0,c,4,64   ttyS1,c,4,65                                           \
22                                                                               \
23         zero,c,1,5     random,c,1,8    urandom,c,1,9                          \
24                                                                               \
25         ram0,b,1,0      ram1,b,1,1                                            \
26         leds,c,10,169                                                         \
27         gpio,c,10,185                                                         \
28         ppp,c,108,0                                                           \
29                                                                               \
30         ptyp0,c,2,0    ptyp1,c,2,1     ptyp2,c,2,2   ptyp3,c,2,3              \
31         ptyp4,c,2,4    ptyp5,c,2,5     ptyp6,c,2,6   ptyp7,c,2,7              \
32         ptyp8,c,2,8    ptyp9,c,2,9     ptypa,c,2,10  ptypb,c,2,11             \
33         ptypc,c,2,12   ptypd,c,2,13    ptype,c,2,14  ptypf,c,2,15             \
34                                                                               \
35         ttyp0,c,3,0    ttyp1,c,3,1     ttyp2,c,3,2   ttyp3,c,3,3              \
36         ttyp4,c,3,4    ttyp5,c,3,5     ttyp6,c,3,6   ttyp7,c,3,7              \
37         ttyp8,c,3,8    ttyp9,c,3,9     ttypa,c,3,10  ttypb,c,3,11             \
38         ttypc,c,3,12   ttypd,c,3,13    ttype,c,3,14  ttypf,c,3,15          
39
40 DEVICES +=   \
41         mtd0,c,90,0     mtdr0,c,90,1    mtdblock0,b,31,0        \
42         mtd1,c,90,2     mtdr1,c,90,3    mtdblock1,b,31,1        \
43         mdt2,c,90,4     mtdr2,c,90,5    mtdblock2,b,31,2        \
44         mtd3,c,90,6     mtdr3,c,90,7    mtdblock3,b,31,3        \
45         mtd4,c,90,8     mtdr4,c,90,9    mtdblock4,b,31,4        \
46         mtd5,c,90,10    mtdr5,c,90,11   mtdblock5,b,31,5        \
47         mtd6,c,90,12    mtdr6,c,90,13   mtdblock6,b,31,6        \
48         mtd7,c,90,14    mtdr7,c,90,15   mtdblock7,b,31,7
49
50
51 FLASH_DEVICES = \
52         boot,c,90,0     \
53         bootarg,c,90,2  \
54         ethmac,c,90,4   \
55         config,c,90,6   \
56         spare,c,90,8    \
57         image,c,90,10   \
58         jffs2,c,90,12   \
59         all,c,90,14
60
61 all:
62         dirs=$(DIRS) ; \
63         for i in $$dirs ; do  $(MAKE) -C $$i || exit $? ; done
64
65 clean:
66         -dirs=$(DIRS) ; \
67         for i in $$dirs; do [ ! -d $$i ] || $(MAKE) -C $$i clean; done
68
69 romfs:
70         [ -d $(ROMFSDIR)/$$i ] || mkdir -p $(ROMFSDIR)
71         for i in $(ROMFS_DIRS); do \
72                 [ -d $(ROMFSDIR)/$$i ] || mkdir -p $(ROMFSDIR)/$$i; \
73         done
74         for i in $(DEVICES); do \
75                 touch $(ROMFSDIR)/dev/@$$i; \
76         done
77         # these permissions are needed for openpty and family to work
78         # on non-ptmx ptys
79         chmod 620 $(ROMFSDIR)/dev/@[pt]ty[pqrsPQRS][0-9a-f],*
80         for i in $(FLASH_DEVICES); do \
81                 touch $(ROMFSDIR)/dev/flash/@$$i; \
82         done
83         for i in $(DIRS); do $(MAKE) -C $$i romfs || exit $? ; done
84         $(ROMFSINST) -s /var/tmp /tmp
85         #$(ROMFSINST) ../romfs /
86         #$(ROMFSINST) -p 755 ../romfs/etc/default/ip-up /etc/default/ip-up
87         #$(ROMFSINST) -p 755 ../romfs/etc/default/ip-down /etc/default/ip-down
88         #$(ROMFSINST) -p 755 ../romfs/etc/default/dhcpcd-change /etc/default/dhcpcd-change
89         $(ROMFSINST) -s /bin /sbin
90         $(ROMFSINST) /etc/rc
91         $(ROMFSINST) /etc/inittab
92         #for f in $(ROMFSDIR)/etc/default{,-static}/inittab; do  \
93                 #grep -v ^dns: $$f >$(ROMFSDIR)/temp-file;       \
94                 #mv -f $(ROMFSDIR)/temp-file $$f;                        \
95         #done
96         $(ROMFSINST) ../../Generic/romfs/etc/services /etc/services
97         $(ROMFSINST) /etc/motd
98         $(ROMFSINST) /etc/README
99         $(ROMFSINST) $(XILINX_COMMON)/passwd /etc/passwd
100         $(ROMFSINST) $(XILINX_COMMON)/group /etc/group
101         echo "$(VERSIONSTR) -- " `date` > $(ROMFSDIR)/etc/version
102         #touch $(ROMFSDIR)/etc/singleboot
103
104
105 image:
106         [ -d $(IMAGEDIR) ] || mkdir -p $(IMAGEDIR)
107         $(CROSS)flthdr $(ROMFSDIR)/bin/*
108         $(CROSS)flthdr $(ROMFSDIR)/lib/lib[0-9].so
109         for i in $(RAM_FILES) ; do \
110                 [ ! -f $(ROMFSDIR)/$$i ] || $(CROSS)flthdr -r $(ROMFSDIR)/$$i ; \
111         done
112
113         for i in $(ROMFSDIR)/bin/* ; do \
114                 $(CROSS)flthdr -z $$i; \
115         done
116
117         genromfs -v -V "ROMdisk" -f $(ROMFSIMG) -d $(ROMFSDIR)
118         $(CROSS)objcopy -O binary $(ROOTDIR)/$(LINUXDIR)/linux \
119                         $(IMAGEDIR)/linux.bin
120         gzip -9 < $(IMAGEDIR)/linux.bin | dd conv=sync ibs=4 > $(IMAGEDIR)/linuxz.bin
121         @case "$(LINUXDIR)" in \
122         XXXXX*2.4.*XXXXX) \
123                 echo "Building gzip imagez.bin"; \
124                 cat $(IMAGEDIR)/linuxz.bin $(ROMFSIMG) | gzip -9 > $(IMAGEZ); \
125                 ;;\
126         *) \
127                 echo "Building normal imagez.bin"; \
128                 cat $(IMAGEDIR)/linuxz.bin $(ROMFSIMG) > $(IMAGEZ); \
129                 ;;\
130         esac
131         printf '\0%s\0%s\0%s' $(VERSIONPKG) $(CONFIG_VENDOR) $(CONFIG_PRODUCT) >> $(IMAGEZ)
132         $(ROOTDIR)/tools/cksum -b -o 2 $(IMAGEZ) >> $(IMAGEZ)
133         BSS=`$(CROSS)objdump --headers $(ROOTDIR)/$(LINUXDIR)/linux | \
134           grep "\.bss"` ; \
135         ADDR=`set -- $${BSS} ; echo 0x$${4}` ; \
136         mb-objcopy --add-section=.romfs=$(ROMFSIMG) \
137           --adjust-section-vma=.romfs=$${ADDR} --no-adjust-warnings \
138           --set-section-flags=.romfs=alloc,load,data   \
139           $(ROOTDIR)/$(LINUXDIR)/linux $(ELFIMAGE) 
140         mb-objcopy -O binary --remove-section=.stab --remove-section=.stabstr $(ELFIMAGE) $(IMAGE)
141         [ -n "$(NO_BUILD_INTO_TFTPBOOT)" ] || cp $(IMAGE) /tftpboot
142         [ -n "$(NO_BUILD_INTO_TFTPBOOT)" ] || cp $(IMAGEZ) /tftpboot
143
144 vendor_flash:
145         $(ROOTDIR)/bin/make_flash