mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-22 13:41:32 +02:00
move make device stage to project Makefile
use automake in flash-tool
This commit is contained in:
parent
e8667bec6e
commit
83515d8092
23
Makefile
23
Makefile
@ -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_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"
|
||||
|
||||
export PATH:=$(PWD)/install/bin:$(PATH)
|
||||
@ -149,8 +156,20 @@ kernel:
|
||||
|
||||
### flash-boot
|
||||
.PHONY: flash-tool
|
||||
flash-tool:
|
||||
make -C ./flash-tool
|
||||
flash-tool: #stage1 stage2
|
||||
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
|
||||
distclean: clean clean-toolchain
|
||||
|
@ -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`
|
@ -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__ */
|
@ -18,13 +18,14 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA
|
||||
|
||||
FLASH_TOOL_PATH = ..
|
||||
FLASH_TOOL_BIN_PATH = ../bin
|
||||
FLASH_TOOL_SRC_PATH = ../src
|
||||
|
||||
ifeq ($(CROSS_COMPILE),)
|
||||
$(error CROSS_COMPILE variable not set)
|
||||
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
|
||||
|
||||
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 -h $< > fw.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)
|
||||
$(CROSS_COMPILE)ld $(LDFLAGS) $(OBJS) -o $@
|
||||
|
@ -7,7 +7,9 @@
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
|
||||
FLASH_TOOL_PATH = ..
|
||||
FLASH_TOOL_BIN_PATH = ../bin
|
||||
FLASH_TOOL_SRC_PATH = ../src
|
||||
|
||||
|
||||
ifeq ($(CROSS_COMPILE),)
|
||||
$(error CROSS_COMPILE variable not set)
|
||||
@ -48,7 +50,7 @@ HEADS := $(SOCDIR)/head.S
|
||||
|
||||
CFLAGS += -I$(SOCDIR)/include -I$(USBBOOTDIR)/usb_boot \
|
||||
-I$(USBBOOTDIR)/nandflash -I$(USBBOOTDIR)/include \
|
||||
-I..
|
||||
-I$(FLASH_TOOL_SRC_PATH)
|
||||
|
||||
OBJS := $(addsuffix .o , $(basename $(notdir $(SOURCES))))
|
||||
HEADO := $(addsuffix .o , $(basename $(notdir $(HEADS))))
|
||||
@ -64,6 +66,7 @@ all: $(APP)
|
||||
$(OBJDUMP) -D $(APP) > $(TARGET).dump
|
||||
$(NM) $(APP) | sort > $(TARGET).sym
|
||||
$(OBJDUMP) -h $(APP) > $(TARGET).map
|
||||
mkdir -p $(FLASH_TOOL_BIN_PATH)
|
||||
cp usb_boot.bin $(FLASH_TOOL_PATH)
|
||||
|
||||
$(APP): $(HEADO) $(OBJS) $(EXTLIBS)
|
||||
|
12
flash-tool/src/Makefile.am
Normal file
12
flash-tool/src/Makefile.am
Normal 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
|
@ -25,7 +25,7 @@
|
||||
#include "usb_boot_defines.h"
|
||||
#include "ingenic_usb.h"
|
||||
#include "cmd.h"
|
||||
#include "config.h"
|
||||
#include "inflash_version.h"
|
||||
|
||||
extern struct nand_in nand_in;
|
||||
int com_argc;
|
||||
@ -94,7 +94,7 @@ static int handle_help(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;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include "config.h"
|
||||
#include "inflash_version.h"
|
||||
#include "command_line.h"
|
||||
#include "ingenic_usb.h"
|
||||
#include "ingenic_cfg.h"
|
||||
@ -42,7 +42,7 @@ static void help(void)
|
||||
|
||||
static void print_version(void)
|
||||
{
|
||||
printf("inflash version: %s\n", CURRENT_VERSION);
|
||||
printf("inflash version: %s\n", INFLASH_VERSION);
|
||||
}
|
||||
|
||||
static struct option opts[] = {
|
Loading…
Reference in New Issue
Block a user