Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BPI-M64: add files for support build uboot & kernel and pack
- Loading branch information
1 parent
567b3d5
commit d6b26bf
Showing
193 changed files
with
49,233 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
BUILD_CHIP :sun50iw1p1 | ||
BUILD_UBOOT :u-boot-sunxi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
.PHONY: all clean help | ||
.PHONY: u-boot kernel kernel-config | ||
.PHONY: linux pack | ||
|
||
include chosen_board.mk | ||
|
||
SUDO=sudo | ||
#CROSS_COMPILE=$(COMPILE_TOOL)/arm-linux-gnueabi- | ||
#CROSS_COMPILE=arm-linux-gnueabi- | ||
CROSS_COMPILE=arm-linux-gnueabihf- | ||
NEW_CROSS_COMPILE=$(NEW_COMPILE_TOOL)/aarch64-openwrt-linux-musl- | ||
#NEW_CROSS_COMPILE=arm-linux-gnueabihf- | ||
U_CROSS_COMPILE=$(CROSS_COMPILE) | ||
#U_CROSS_COMPILE=$(NEW_CROSS_COMPILE) | ||
K_CROSS_COMPILE=$(NEW_CROSS_COMPILE) | ||
|
||
OUTPUT_DIR=$(CURDIR)/output | ||
|
||
U_CONFIG_H=$(U_O_PATH)/include/config.h | ||
K_DOT_CONFIG=$(K_O_PATH)/.config | ||
|
||
LICHEE_KDIR=$(CURDIR)/linux-sunxi | ||
LICHEE_MOD_DIR=$(LICHEE_KDIR)/output/lib/modules/4.4.89-BPI-M64-Kernel | ||
ROOTFS=$(CURDIR)/rootfs/linux/default_linux_rootfs.tar.gz | ||
|
||
Q= | ||
J=$(shell expr `grep ^processor /proc/cpuinfo | wc -l` \* 2) | ||
|
||
all: bsp | ||
bsp: u-boot kernel | ||
|
||
|
||
# u-boot | ||
|
||
u-boot: | ||
# ./build_uboot.sh | ||
./build-uboot.sh config $(MACH) | ||
./build-uboot.sh | ||
|
||
u-boot-clean: | ||
# $(Q)$(MAKE) -C u-boot-sunxi CROSS_COMPILE=$(U_CROSS_COMPILE) -j$J distclean | ||
rm -rf u-boot-sunxi/out | ||
|
||
## linux | ||
$(K_DOT_CONFIG): linux-sunxi | ||
$(Q)$(MAKE) -C linux-sunxi ARCH=arm64 $(KERNEL_CONFIG) | ||
|
||
kernel: $(K_DOT_CONFIG) | ||
$(Q)$(MAKE) -C linux-sunxi ARCH=arm64 CROSS_COMPILE=${K_CROSS_COMPILE} -j$J INSTALL_MOD_PATH=output Image.gz dtbs | ||
$(Q)$(MAKE) -C linux-sunxi ARCH=arm64 CROSS_COMPILE=${K_CROSS_COMPILE} -j$J INSTALL_MOD_PATH=output modules | ||
$(Q)$(MAKE) -C linux-sunxi/modules/gpu/mali-utgard/kernel_mode/driver/src/devicedrv/mali CROSS_COMPILE=$(K_CROSS_COMPILE) ARCH=arm64 TARGET_PLATFORM="" KDIR=${LICHEE_KDIR} LICHEE_KDIR=${LICHEE_KDIR} USING_DT=1 BUILD=release USING_UMP=0 | ||
$(Q)$(MAKE) -C linux-sunxi ARCH=arm64 CROSS_COMPILE=${K_CROSS_COMPILE} -j$J INSTALL_MOD_PATH=output modules_install | ||
# $(Q)$(MAKE) -C linux-sunxi ARCH=arm64 CROSS_COMPILE=${K_CROSS_COMPILE} -j$J headers_install | ||
# $(Q)scripts/install_kernel_headers.sh | ||
|
||
kernel-clean: | ||
$(Q)$(MAKE) -C linux-sunxi/modules/gpu/mali-utgard/kernel_mode/driver/src/devicedrv/mali CROSS_COMPILE=$(K_CROSS_COMPILE) ARCH=arm64 TARGET_PLATFORM="" KDIR=${LICHEE_KDIR} LICHEE_KDIR=${LICHEE_KDIR} USING_DT=1 BUILD=release USING_UMP=0 clean | ||
$(Q)$(MAKE) -C linux-sunxi ARCH=arm64 CROSS_COMPILE=${K_CROSS_COMPILE} -j$J distclean | ||
rm -rf linux-sunxi/output/ | ||
|
||
kernel-config: $(K_DOT_CONFIG) | ||
$(Q)$(MAKE) -C linux-sunxi ARCH=arm64 CROSS_COMPILE=${K_CROSS_COMPILE} -j$J menuconfig | ||
cp linux-sunxi/.config linux-sunxi/arch/arm64/configs/$(KERNEL_CONFIG) | ||
|
||
## clean all build | ||
clean: u-boot-clean kernel-clean | ||
rm -f chosen_board.mk | ||
|
||
## pack download files | ||
pack: sunxi-pack | ||
$(Q)scripts/mk_pack.sh | ||
|
||
## install to bpi image | ||
install: | ||
$(Q)scripts/mk_install_sd.sh | ||
|
||
## linux rootfs | ||
linux: | ||
$(Q)scripts/mk_linux.sh $(ROOTFS) | ||
|
||
help: | ||
@echo "" | ||
@echo "Usage:" | ||
@echo "" | ||
@echo " make bsp - Default 'make'" | ||
@echo " make u-boot - Builds bootloader" | ||
@echo " make kernel - Builds linux kernel" | ||
@echo " make kernel-config - Menuconfig" | ||
@echo "" | ||
@echo " make pack - pack the images and rootfs to bpi tools download package." | ||
@echo " make install - download the build packages to SD device with bpi image flashed." | ||
@echo " make clean - clean all build." | ||
@echo "" | ||
@echo "Optional targets:" | ||
@echo "" | ||
@echo " make linux - Build target for linux platform, as ubuntu, need permisstion confirm during the build process" | ||
@echo " Arguments:" | ||
@echo " ROOTFS= - Source rootfs (ie. rootfs.tar.gz with absolute path)" | ||
@echo "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,259 @@ | ||
#!/bin/bash | ||
# b.sh | ||
# | ||
# (c) Copyright 2013 | ||
# Allwinner Technology Co., Ltd. <www.allwinnertech.com> | ||
# wangwei <wangwei@allwinnertech.com> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
|
||
|
||
BUILD_CHIP="sun8iw7p1" | ||
BUILD_CHIP="sun50iw1p1" | ||
BUILD_UBOOT="u-boot-sunxi" | ||
BUILD_CONFIG_FILE=".config" | ||
set -e | ||
|
||
build_select_chip() | ||
{ | ||
|
||
local count=0 | ||
printf "All valid Sunxi chip:\n" | ||
for chip in $( find "$BUILD_UBOOT/arch/arm/cpu/armv7/" -mindepth 1 -maxdepth 1 -type d -name "sun[0-9]*" |sort); do | ||
chips[$count]=`basename $chip` | ||
printf "$count. ${chips[$count]}\n" | ||
let count=$count+1 | ||
done | ||
|
||
while true; do | ||
read -p "Please select a chip:" | ||
RES=`expr match $REPLY "[0-9][0-9]*$"` | ||
if [ "$RES" -le 0 ]; then | ||
echo "please use index number" | ||
continue | ||
fi | ||
if [ "$REPLY" -ge $count ]; then | ||
echo "too big" | ||
continue | ||
fi | ||
if [ "$REPLY" -lt "0" ]; then | ||
echo "too small" | ||
continue | ||
fi | ||
break | ||
done | ||
BUILD_CHIP=${chips[$REPLY]} | ||
} | ||
|
||
|
||
build_select_build_uboot() | ||
{ | ||
local count=0 | ||
local length=0 | ||
|
||
# build_uboot=(u-boot-2011.09 u-boot-2014.07) | ||
build_uboot=(u-boot-sunxi) | ||
build_uboot=(u-boot-2011.09 u-boot-sunxi) | ||
printf "All valid u-boot version:\n" | ||
|
||
length=`expr ${#build_uboot[@]} - 1` | ||
for count in `seq 0 $length`; do | ||
printf "$count. ${build_uboot[$count]}\n" | ||
done | ||
|
||
let count=$count+1 | ||
|
||
while true; do | ||
read -p "Please select a build type:" | ||
RES=`expr match $REPLY "[0-9][0-9]*$"` | ||
if [ "$RES" -le 0 ]; then | ||
echo "please use index number" | ||
continue | ||
fi | ||
if [ "$REPLY" -ge $count ]; then | ||
echo "too big" | ||
continue | ||
fi | ||
if [ "$REPLY" -lt "0" ]; then | ||
echo "too small" | ||
continue | ||
fi | ||
break | ||
done | ||
|
||
BUILD_UBOOT=${build_uboot[$REPLY]} | ||
|
||
} | ||
|
||
build_get_config_form_user() | ||
{ | ||
build_select_build_uboot | ||
build_select_chip | ||
} | ||
|
||
build_write_config_to_file() | ||
{ | ||
rm -rf $BUILD_CONFIG_FILE | ||
echo "BUILD_CHIP :${BUILD_CHIP}" >> $BUILD_CONFIG_FILE | ||
echo "BUILD_UBOOT :$BUILD_UBOOT" >> $BUILD_CONFIG_FILE | ||
} | ||
|
||
build_get_config_from_file() | ||
{ | ||
BUILD_CHIP=`cat $BUILD_CONFIG_FILE | awk -F"[:|=]" '(NF&&$1~/^[[:space:]]*BUILD_CHIP/) {printf "%s",$2}'` | ||
BUILD_UBOOT=`cat $BUILD_CONFIG_FILE | awk -F"[:|=]" '(NF&&$1~/^[[:space:]]*BUILD_UBOOT/) {printf "%s",$2}'` | ||
} | ||
|
||
build_show_config() | ||
{ | ||
printf "\nconfig information is:\n" | ||
echo -e '\033[0;31;36m' | ||
printf "BUILD_CHIP : ${BUILD_CHIP}\n" | ||
printf "BUILD_UBOOT : ${BUILD_UBOOT}\n" | ||
echo -e '\033[0m' | ||
} | ||
|
||
build_show_help() | ||
{ | ||
printf " | ||
(c) Copyright 2016 | ||
Allwinner Technology Co., Ltd. <www.allwinnertech.com> | ||
wangwei <wangwei@allwinnertech.com> | ||
NAME | ||
build - The top level build script to build Sunxi platform bootloader | ||
OPTIONS | ||
-h display help message | ||
config config the platform which we want to build | ||
clean clean the tmp file | ||
distclean clean the tmp file and configure file | ||
showconfig show the current compile config | ||
uboot build uboot | ||
boot0 build boot0 | ||
fes build fes | ||
sboot build secure boot | ||
spl build boot0 fes sboot in one time | ||
pack pack img | ||
pack_debug pack img,switch uart to card0 | ||
pack_secure pack secure img | ||
" | ||
|
||
} | ||
|
||
|
||
if [ "$1" == "-h" ]; then | ||
build_show_help | ||
exit | ||
fi | ||
|
||
|
||
if [[ "$1" == config ]]; then | ||
if [[ -z "$2" ]]; then | ||
build_get_config_form_user | ||
else | ||
BUILD_CHIP=$2 | ||
fi | ||
build_write_config_to_file | ||
cd $BUILD_UBOOT | ||
make distclean | ||
|
||
if [[ "$BUILD_UBOOT" == "u-boot-2011.09" ]]; then | ||
make ${BUILD_CHIP}p1_config | ||
else | ||
make ${BUILD_CHIP}_config | ||
fi | ||
|
||
cd .. | ||
exit | ||
fi | ||
|
||
if [ -f $BUILD_CONFIG_FILE ]; then | ||
build_get_config_from_file | ||
else | ||
echo -e '\033[0;31;36m' | ||
echo "you should run ./build-uboot.sh config at first" | ||
echo -e '\033[0m' | ||
exit | ||
fi | ||
|
||
# | ||
# Build the u-boot SunxiPlatform code | ||
# | ||
|
||
#build_show_config | ||
|
||
for arg in "$@" | ||
do | ||
if [[ $arg == clean ]]; then | ||
echo "clean the build..." | ||
cd $BUILD_UBOOT; make clean; cd .. | ||
exit | ||
elif [[ $arg == distclean ]]; then | ||
echo "distclean the build..." | ||
cd $BUILD_UBOOT; make distclean; cd .. | ||
rm -rf $BUILD_CONFIG_FILE | ||
exit | ||
elif [[ $arg == showconfig ]]; then | ||
build_show_config | ||
exit | ||
elif [[ $arg == uboot ]]; then | ||
cd $BUILD_UBOOT | ||
make -j | ||
cd .. | ||
exit | ||
elif [[ $arg == boot0 ]]; then | ||
cd $BUILD_UBOOT | ||
make boot0 | ||
cd .. | ||
exit | ||
elif [[ $arg == fes ]]; then | ||
cd $BUILD_UBOOT | ||
make fes | ||
cd .. | ||
exit | ||
elif [[ $arg == sboot ]]; then | ||
cd $BUILD_UBOOT | ||
make sboot | ||
cd .. | ||
exit | ||
elif [[ $arg == spl ]]; then | ||
cd $BUILD_UBOOT | ||
make spl | ||
cd .. | ||
exit | ||
elif [[ $arg == pack ]]; then | ||
cd .. | ||
./build-uboot.sh pack | ||
cd brandy | ||
exit | ||
elif [[ $arg == pack_secure ]]; then | ||
cd .. | ||
./build-uboot.sh pack_secure | ||
cd brandy | ||
exit | ||
elif [[ $arg == pack_debug ]]; then | ||
cd .. | ||
./build-uboot.sh pack_debug | ||
cd brandy | ||
exit | ||
else | ||
echo "invalid paramters" | ||
exit | ||
fi | ||
done | ||
|
||
|
||
# | ||
#if the input paramters is null, just build all. | ||
# | ||
cd $BUILD_UBOOT | ||
#make -j && make spl | ||
make -j | ||
cd .. | ||
|
||
|
Oops, something went wrong.