1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-01 16:25:20 +02:00

move make device stage to project Makefile

use automake in flash-tool
This commit is contained in:
xiangfu 2009-06-09 19:16:39 +00:00
parent e8667bec6e
commit 83515d8092
16 changed files with 47 additions and 105 deletions

View File

@ -42,6 +42,13 @@ GLIBC_PORTS_URL=ftp://ftp.gnu.org/gnu/glibc/$(GLIBC_PORTS_PACKAGE)
KERNEL_HEADERS_PACKAGE=$(KERNEL_HEADERS_VER).tar.bz2 KERNEL_HEADERS_PACKAGE=$(KERNEL_HEADERS_VER).tar.bz2
KERNEL_HEADERS_URL= KERNEL_HEADERS_URL=
# for the device stage
FLASH_TOOL_PATH = ./flash-tool
FLASH_TOOL_BIN_PATH = $(FLASH_TOOL_PATH)/bin
STAGE1_PATH = $(FLASH_TOOL_PATH)/device_stage1
STAGE2_PATH = $(FLASH_TOOL_PATH)/device_stage2
CROSS_COMPILE ?= mipsel-linux-
CFLAGS="-O2" CFLAGS="-O2"
export PATH:=$(PWD)/install/bin:$(PATH) export PATH:=$(PWD)/install/bin:$(PATH)
@ -149,8 +156,20 @@ kernel:
### flash-boot ### flash-boot
.PHONY: flash-tool .PHONY: flash-tool
flash-tool: flash-tool: #stage1 stage2
make -C ./flash-tool mkdir -p $(FLASH_TOOL_BIN_PATH)
cp $(FLASH_TOOL_PATH)/usb_boot.cfg $(FLASH_TOOL_BIN_PATH)
cd $(FLASH_TOOL_PATH) && \
./autogen.sh && \
./configure && \
make
cp $(FLASH_TOOL_PATH)/src/inflash $(FLASH_TOOL_BIN_PATH)
stage1:
make CROSS_COMPILE=$(CROSS_COMPILE) -C $(STAGE1_PATH)
stage2:
make CROSS_COMPILE=$(CROSS_COMPILE) -C $(STAGE2_PATH)
### clean up ### clean up
distclean: clean clean-toolchain distclean: clean clean-toolchain

View File

@ -1,68 +0,0 @@
#
# "Ingenic flash tool" - flash the Ingenic CPU via USB
#
# (C) Copyright 2009
# Author: Marek Lindner <lindner_marek@yahoo.de>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 3 as published by the Free Software Foundation.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA
ifneq ($(findstring $(MAKEFLAGS),s),s)
ifndef V
Q_CC = @echo ' ' CC $@;
Q_LD = @echo ' ' LD $@;
export Q_CC
export Q_LD
endif
endif
STAGE1_PATH = ./device_stage1
STAGE2_PATH = ./device_stage2
CROSS_COMPILE ?= mipsel-linux-
CC = gcc
CFLAGS += -pedantic -Wall -W -O1 -g3 -std=gnu99
LDFLAGS += -lusb -lconfuse
BINARY_NAME = inflash
TARGETS = $(BINARY_NAME) stage1 stage2
SRC_C= main.c ingenic_cfg.c ingenic_usb.c cmd.c command_line.c
SRC_H= ingenic_cfg.h ingenic_usb.h usb_boot_defines.h \
command_line.h cmd.h config.h
SRC_O= $(SRC_C:.c=.o)
default: $(TARGETS)
$(BINARY_NAME): $(SRC_O) $(SRC_H) Makefile
$(Q_LD)$(CC) -o $@ $(SRC_O) $(LDFLAGS)
.c.o:
$(Q_CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MD -c $< -o $@
-include $(SRC_C:.c=.d)
# for the device stage
stage1:
make CROSS_COMPILE=$(CROSS_COMPILE) -C $(STAGE1_PATH)
stage2:
make CROSS_COMPILE=$(CROSS_COMPILE) -C $(STAGE2_PATH)
clean:
make CROSS_COMPILE=$(CROSS_COMPILE) -C $(STAGE1_PATH) clean
make CROSS_COMPILE=$(CROSS_COMPILE) -C $(STAGE2_PATH) clean
rm -f $(BINARY_NAME) *.o *~
rm -f `find . -name '*.d' -print`

View File

@ -1,26 +0,0 @@
/*
* "Ingenic flash tool" - flash the Ingenic CPU via USB
*
* (C) Copyright 2009
* Author: Xiangfu Liu <xiangfu.z@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 3 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*/
#ifndef __CONFIG_H__
#define __CONFIG_H__
#define CURRENT_VERSION "1.0.0"
#endif /* __CONFIG_H__ */

View File

@ -18,13 +18,14 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, # Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA # Boston, MA 02110-1301, USA
FLASH_TOOL_PATH = .. FLASH_TOOL_BIN_PATH = ../bin
FLASH_TOOL_SRC_PATH = ../src
ifeq ($(CROSS_COMPILE),) ifeq ($(CROSS_COMPILE),)
$(error CROSS_COMPILE variable not set) $(error CROSS_COMPILE variable not set)
endif endif
CFLAGS := -O2 -mips32 -fno-pic -mno-abicalls -I.. CFLAGS := -O2 -mips32 -fno-pic -mno-abicalls -I$(FLASH_TOOL_SRC_PATH)
LDFLAGS := -nostdlib -EL -T target.ld LDFLAGS := -nostdlib -EL -T target.ld
OBJS = head.o main.o common.o board_4740.o board_4750.o debug.o OBJS = head.o main.o common.o board_4740.o board_4750.o debug.o
@ -36,7 +37,8 @@ fw.bin: fw.elf
$(CROSS_COMPILE)objdump -D $< > fw.dump $(CROSS_COMPILE)objdump -D $< > fw.dump
$(CROSS_COMPILE)objdump -h $< > fw.map $(CROSS_COMPILE)objdump -h $< > fw.map
$(CROSS_COMPILE)nm -n $< > System.map $(CROSS_COMPILE)nm -n $< > System.map
cp fw.bin $(FLASH_TOOL_PATH) mkdir -p $(FLASH_TOOL_BIN_PATH)
cp fw.bin $(FLASH_TOOL_BIN_PATH)
fw.elf: $(OBJS) fw.elf: $(OBJS)
$(CROSS_COMPILE)ld $(LDFLAGS) $(OBJS) -o $@ $(CROSS_COMPILE)ld $(LDFLAGS) $(OBJS) -o $@

View File

@ -7,7 +7,9 @@
# published by the Free Software Foundation. # published by the Free Software Foundation.
# #
FLASH_TOOL_PATH = .. FLASH_TOOL_BIN_PATH = ../bin
FLASH_TOOL_SRC_PATH = ../src
ifeq ($(CROSS_COMPILE),) ifeq ($(CROSS_COMPILE),)
$(error CROSS_COMPILE variable not set) $(error CROSS_COMPILE variable not set)
@ -48,7 +50,7 @@ HEADS := $(SOCDIR)/head.S
CFLAGS += -I$(SOCDIR)/include -I$(USBBOOTDIR)/usb_boot \ CFLAGS += -I$(SOCDIR)/include -I$(USBBOOTDIR)/usb_boot \
-I$(USBBOOTDIR)/nandflash -I$(USBBOOTDIR)/include \ -I$(USBBOOTDIR)/nandflash -I$(USBBOOTDIR)/include \
-I.. -I$(FLASH_TOOL_SRC_PATH)
OBJS := $(addsuffix .o , $(basename $(notdir $(SOURCES)))) OBJS := $(addsuffix .o , $(basename $(notdir $(SOURCES))))
HEADO := $(addsuffix .o , $(basename $(notdir $(HEADS)))) HEADO := $(addsuffix .o , $(basename $(notdir $(HEADS))))
@ -64,6 +66,7 @@ all: $(APP)
$(OBJDUMP) -D $(APP) > $(TARGET).dump $(OBJDUMP) -D $(APP) > $(TARGET).dump
$(NM) $(APP) | sort > $(TARGET).sym $(NM) $(APP) | sort > $(TARGET).sym
$(OBJDUMP) -h $(APP) > $(TARGET).map $(OBJDUMP) -h $(APP) > $(TARGET).map
mkdir -p $(FLASH_TOOL_BIN_PATH)
cp usb_boot.bin $(FLASH_TOOL_PATH) cp usb_boot.bin $(FLASH_TOOL_PATH)
$(APP): $(HEADO) $(OBJS) $(EXTLIBS) $(APP): $(HEADO) $(OBJS) $(EXTLIBS)

View File

@ -0,0 +1,12 @@
AM_CFLAGS = -pedantic -Wall -W -O1 -g3 -std=gnu99 -lusb -lconfuse
AM_LDFLAGS = -lusb -lconfuse
inflash_version.h:
echo -e '#ifndef INFLASH_VERSION' \
'\n#define INFLASH_VERSION "'`svnversion`'"' \
'\n#endif' > inflash_version.h
BUILT_SOURCES = inflash_version.h
bin_PROGRAMS = inflash
inflash_SOURCES = cmd.c command_line.c ingenic_cfg.c \
ingenic_usb.c main.c

View File

@ -25,7 +25,7 @@
#include "usb_boot_defines.h" #include "usb_boot_defines.h"
#include "ingenic_usb.h" #include "ingenic_usb.h"
#include "cmd.h" #include "cmd.h"
#include "config.h" #include "inflash_version.h"
extern struct nand_in nand_in; extern struct nand_in nand_in;
int com_argc; int com_argc;
@ -94,7 +94,7 @@ static int handle_help(void)
static int handle_version(void) static int handle_version(void)
{ {
printf("\n USB Boot Software current version: %s", CURRENT_VERSION); printf("\n USB Boot Software current version: %s", INFLASH_VERSION);
return 1; return 1;
} }

View File

@ -22,7 +22,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <getopt.h> #include <getopt.h>
#include "config.h" #include "inflash_version.h"
#include "command_line.h" #include "command_line.h"
#include "ingenic_usb.h" #include "ingenic_usb.h"
#include "ingenic_cfg.h" #include "ingenic_cfg.h"
@ -42,7 +42,7 @@ static void help(void)
static void print_version(void) static void print_version(void)
{ {
printf("inflash version: %s\n", CURRENT_VERSION); printf("inflash version: %s\n", INFLASH_VERSION);
} }
static struct option opts[] = { static struct option opts[] = {