#!/bin/sh
TPWD=`pwd`
DO_MODULE=all
DOCLEAN=0
BOOTCLEAN=0
KERNELCLEAN=0
ROOTFSCLEAN=0
REUNZIP=0
BOOTREUNZIP=0
KERNELREUNZIP=0
ROOTFSREUNZIP=0
DORECOVER=0
softwareVersion=1.3.1
bootloaderVersion=b1.3.0
bspomVerison=b1.3.0
fpgaVerison=b1.3.0
linuxVerison=b1.3.0
rootfsVerison=b1.3.0
echo "set env first"
source $TPWD/set_env.sh
echo "if build ok, see image in dir image/release"
while :
do
case $1 in
-m | --module)
DO_MODULE=$2
echo "module is $DO_MODULE"
shift 2
;;
-i | --ci)
softwareVersion=$2
bootloaderVersion=$3
bspomVerison=$4
fpgaVerison=$5
linuxVerison=$6
rootfsVerison=$7
echo "ci version is ok"
shift 7
;;
-c | --clean)
DOCLEAN=1
echo "do clean is $DOCLEAN"
shift
;;
-r | --recover)
DORECOVER=1
echo "do recover is $DORECOVER"
shift
;;
-u | --unzip)
REUNZIP=1
echo "do reunzip is $REUNZIP"
shift
;;
--help)
echo "Make it easier to build ! "
echo "--module = kernel or boot or rootfs or hdf or project or all"
echo "--clean = Do a 'make clean' first"
echo "--unzip = reunzip boot,kernel,rootfs"
echo "--recover = recover code"
exit 0;
;;
-*)
echo "Unknown option '$1', try '--help'"
exit 1
;;
*)
break
;;
esac
done
atag=""
if atag="`git describe --exact-match 2>/dev/null`"; then
echo "current tag: $atag"
else
echo "no tag"
fi
head=`git rev-parse --verify --short HEAD 2>/dev/null`
echo "head: $head"
if [ ! -z "$atag" ] ; then
head="-"${head}
else
echo "tag is null"
fi
localver="\(${atag}${head}\)"
echo "localver: $localver"
jobs=`grep -c ^processor /proc/cpuinfo 2>/dev/null`
echo "jobs $jobs"
build_config()
{
if [ $DOCLEAN -eq 1 ] && [ "$DO_MODULE" = "boot" ]; then
BOOTCLEAN=1
fi
if [ $DOCLEAN -eq 1 ] && [ "$DO_MODULE" = "hdf" ]; then
BOOTCLEAN=1
fi
if [ $DOCLEAN -eq 1 ] && [ "$DO_MODULE" = "xsa" ]; then
BOOTCLEAN=1
fi
if [ $DOCLEAN -eq 1 ] && [ "$DO_MODULE" = "kernel" ]; then
KERNELCLEAN=1
fi
if [ $DOCLEAN -eq 1 ] && [ "$DO_MODULE" = "rootfs" ]; then
ROOTFSCLEAN=1
fi
if [ $DOCLEAN -eq 1 ] && [ "$DO_MODULE" = "all" ]; then
ROOTFSCLEAN=1
BOOTCLEAN=1
KERNELCLEAN=1
fi
if [ $REUNZIP -eq 1 ] && [ "$DO_MODULE" = "boot" ]; then
BOOTREUNZIP=1
fi
if [ $REUNZIP -eq 1 ] && [ "$DO_MODULE" = "xsa" ]; then
BOOTREUNZIP=1
fi
if [ $REUNZIP -eq 1 ] && [ "$DO_MODULE" = "kernel" ]; then
KERNELREUNZIP=1
fi
if [ $REUNZIP -eq 1 ] && [ "$DO_MODULE" = "rootfs" ]; then
ROOTFSREUNZIP=1
fi
if [ $REUNZIP -eq 1 ] && [ "$DO_MODULE" = "all" ]; then
ROOTFSREUNZIP=1
KERNELREUNZIP=1
BOOTREUNZIP=1
fi
}
unzip_boot()
{
if [ ! -d "$ATF_DIR" ]; then
cd $TPWD/arm-trusted-firmware
tar -xf arm-trusted-firmware-xilinx-$XILINX.tar.gz
else
if [ $BOOTREUNZIP -eq 1 ]; then
echo "reunzip atf start"
cd $TPWD/arm-trusted-firmware
rm -rf $ATF_DIR
tar -xf arm-trusted-firmware-xilinx-$XILINX.tar.gz
echo "reunzip atf end"
fi
fi
if [ ! -d "$UBOOT_DIR" ]; then
cd $TPWD/u-boot
tar -xf u-boot-xlnx-xilinx-$XILINX.tar.gz
cp files_zu46cg/* u-boot-xlnx-xilinx-$XILINX/ -rf
else
if [ $BOOTREUNZIP -eq 1 ]; then
echo "reunzip u-boot start"
cd $TPWD/u-boot
rm -rf $UBOOT_DIR
tar -xf u-boot-xlnx-xilinx-$XILINX.tar.gz
cp files_zu46cg/* u-boot-xlnx-xilinx-$XILINX/ -rf
echo "reunzip u-boot ok"
fi
fi
}
unzip_kernel()
{
if [ ! -d "$KERN_DIR" ]; then
cd $TPWD/kernel
tar -xf linux-xlnx-xilinx-$XILINX.tar.gz
cp $TPWD/kernel/files_zu6cg/* $KERN_DIR/ -rf
else
if [ $KERNELREUNZIP -eq 1 ]; then
echo "reunzip kernel start"
cd $TPWD/kernel
rm -rf $KERN_DIR
tar -xf linux-xlnx-xilinx-$XILINX.tar.gz
cp $TPWD/kernel/files_zu46cg/* $KERN_DIR/ -rf
echo "reunzip kernel ok"
fi
fi
}
base_rootfs()
{
echo "rootfs base"
cd $ROOTFS_DIR
ln -sf /sbin/init init
if [ ! -d "$MODULE_INSTALL_PATH" ]; then
mkdir -p $MODULE_INSTALL_PATH
fi
echo "cp bspint lib bin and conf"
cd $TPWD/rootfs
mkdir -p mnt/code
mkdir -p mnt/fpga
mkdir -p mnt/data/verupg/slot0
mkdir -p mnt/data/verupg/slot1
mkdir -p mnt/data/equipment
mkdir -p mnt/data/tmptest
mkdir -p mnt/data/log
mkdir -p mnt/data/conf
cd $ROOTFS_DIR
}
unzip_rootfs()
{
if [ ! -d "$ROOTFS_DIR" ]; then
mkdir -p $ROOTFS_DIR
cd $ROOTFS_DIR
tar -xf ../rootfs.tar.xz -C .
cp -rf ../files_zu46cg/* .
mkdir -p mnt/code
mkdir -p mnt/fpga
mkdir -p mnt/data
mkdir -p lib/firmware
fi
base_rootfs
}
release_xsa()
{
echo "release xsa start, please check vivado setuped "
echo "try: source Vivado/2019.2/settings64.sh"
source /home/code/data/tools/Vivado/2019.2/settings64.sh
cd $TPWD/hw-description
sh build_fsbl_pmu_xsa_zu6cg.sh rru_zu6cg.xsa $TPWD/images
cp -rf build_fsbl_pmu_xsa $TPWD/images/tmp/
#rm -rf build_fsbl_pmu_xsa
cd $TPWD/images
if [ ! -f "fsbl_zu6cg.elf" ]; then
echo "release failed, fsbl_zu6cg.elf not found!!!"
exit 1
fi
if [ ! -f "pmufw_zu6cg.elf" ]; then
echo "release failed, pmufw_zu6cg.elf not found!!!"
exit 1
fi
if [ ! -f "zynq_zu6cg.bif" ]; then
echo "release failed, zynq_zu6cg.bif not found!!!"
exit 1
fi
echo "release xsa ok"
}
release_atf()
{
echo "release bootloader start"
cd $ATF_DIR
if [ $BOOTCLEAN -eq 1 ]; then
echo "make clean arm trusted firmware obj"
make PLAT=zynqmp clean
fi
echo "build atf start"
make PLAT=zynqmp RESET_TO_BL31=1 DEBUG=0
if [ ! -f "build/zynqmp/release/bl31/bl31.elf" ]; then
echo "release bootloader failed,bl31.elf not exist!!!"
exit 1
fi
echo "build atf ok"
cp build/zynqmp/release/bl31/bl31.elf $TPWD/images
}
release_uboot()
{
cd $UBOOT_DIR
if [ $BOOTCLEAN -eq 1 ]; then
echo "make clean uboot obj"
make clean
fi
echo "build uboot start"
make rru_defconfig
make LOCALVERSION="+"${1} -j${2}
if [ ! -f "u-boot.elf" ]; then
echo "release bootloader failed,u-boot.elf not exist!!!"
exit 1
fi
echo "build uboot ok"
cp u-boot.elf $TPWD/images
cd $TPWD/images
if [ ! -f "fsbl_zu6cg.elf" ]; then
echo "release bootloader failed, fsbl_zu6cg.elf not found!!!"
exit 1
fi
if [ ! -f "pmufw_zu6cg.elf" ]; then
echo "release bootloader failed, pmufw_zu6cg.elf not found!!!"
exit 1
fi
if [ ! -f "zynq_zu6cg.bif" ]; then
echo "release bootloader failed, zynq_zu6cg.bif not found!!!"
exit 1
fi
bootgen -arch zynqmp -image zynq_zu6cg.bif -w -o BOOT.bin
if [ ! -f "BOOT.bin" ]; then
echo "release bootloader failed,BOOT.bin not exist!!!"
exit 1
fi
echo "start create bootloader.bin"
if [ ! -f "$TPWD/u-boot-env/u-boot-env_zu46cg.txt" ]; then
echo "release bootloader failed,u-boot-env_zu46cg.txt not exist!!!"
exit 1
fi
cp $TPWD/u-boot-env/u-boot-env_zu46cg.txt .
$TPWD/tools/bin/dos2unix u-boot-env_zu46cg.txt
$TPWD/tools/bin/mkenvimage -s 0x40000 -o bootenv.bin u-boot-env_zu46cg.txt
dd if=BOOT.bin of=release/bootloader.bin bs=2M seek=0 conv=sync
dd if=bootenv.bin of=release/bootloader.bin bs=2M seek=1 count=2 conv=sync
md5sum release/bootloader.bin > tmp/bootloader.md5
dd if=tmp/bootloader.md5 of=release/bootloader.img bs=32 count=1 seek=1
dd if=release/bootloader.bin of=release/bootloader.img bs=64 count=65536 seek=1
echo $bootloaderVersion > tmp/bootloaderversion
dd if=tmp/bootloaderversion of=release/bootloader.img bs=64 count=1 seek=65535
dd if=release/bootloader.bin of=release/rru_norflash_image.bin bs=4M seek=0 count=1 conv=sync
dd if=tmp/bootloaderversion of=release/rru_norflash_image.bin bs=64 seek=65534 count=1
cp fsbl_zu6cg.elf release/
cp release/bootloader.bin tmp/
echo "release bootloader ok"
mv BOOT.bin tmp/
mv bootenv.bin tmp/
mv u-boot-env_zu46cg.txt tmp/
mv u-boot.elf tmp/
mv bl31.elf tmp/
cp fsbl_zu6cg.elf tmp/
cp pmufw_zu6cg.elf tmp/
cp zynq_zu6cg.bif tmp/
}
release_kernel()
{
echo "release linux start"
cd $KERN_DIR
make rru_defconfig
if [ $KERNELCLEAN -eq 1 ]; then
echo "make clean kernel obj"
make clean
fi
echo "build Image start"
make -j${2} Image
if [ ! -f "vmlinux" ]; then
echo "build Image failed,vmlinux not exist!!!"
exit 1
fi
echo "build Image ok"
echo "build dtbs start"
make dtbs
if [ ! -f "arch/arm64/boot/dts/xilinx/zynqmp-zcu102-rev1.0.dtb" ]; then
echo "build dtbs failed,zynqmp-zcu102-rev1.0.dtb not exist!!!"
exit 1
fi
echo "build dtbs ok"
cp vmlinux $TPWD/images
cp arch/arm64/boot/dts/xilinx/zynqmp-zcu102-rev1.0.dtb $TPWD/images
cd $TPWD/images
aarch64-linux-gnu-objcopy -O binary -R .note -R .comment -S vmlinux linux.bin
gzip -9 linux.bin
mv linux.bin.gz linux.bin
mkimage -f linux.its tmp/linux.ub
md5sum tmp/linux.ub > tmp/linux.md5
dd if=tmp/linux.md5 of=release/linux.img bs=32 count=1 seek=1
dd if=tmp/linux.ub of=release/linux.img bs=64 count=98304 seek=1
echo $linuxVerison > tmp/linuxversion
dd if=tmp/linuxversion of=release/linux.img bs=64 count=1 seek=98303
dd if=tmp/linux.ub of=tmp/linux_image.bin bs=6M seek=0 count=1 conv=sync
dd if=tmp/linux_image.bin of=release/rru_norflash_image.bin bs=2M seek=2 count=3 conv=sync
dd if=tmp/linuxversion of=release/rru_norflash_image.bin bs=64 seek=163838 count=1
if [ ! -f "release/linux.img" ]; then
echo "release kernel failed, linux.ub not exist!!!"
exit 1
fi
echo "release kernel ok"
mv vmlinux tmp/
mv linux.bin tmp/
mv zynqmp-zcu102-rev1.0.dtb tmp/
}
build_kernelmodule()
{
echo "buiid adr_map module start"
cd $MODULE_PATH/adr_map/drv
if [ $ROOTFSCLEAN -eq 1 ]; then
echo "make clean adr_map obj"
make clean
fi
make
cp addr_map_dev.ko $MODULE_INSTALL_PATH/
echo "build adr_map module ok"
echo "buiid cpri link module start"
cd $MODULE_PATH/cpri_link
if [ $ROOTFSCLEAN -eq 1 ]; then
echo "make clean cpri_link obj"
make clean
fi
make
cp cl.ko $MODULE_INSTALL_PATH/
echo "buiid cpri link module ok"
echo "build adc module start"
cd $MODULE_PATH/adc
if [ $ROOTFSCLEAN -eq 1 ]; then
echo "make clean adc obj"
make clean
fi
make
cp adrv9009_driver.ko $MODULE_INSTALL_PATH/
echo "build adc module ok"
echo "build rtwp_10ms module start"
cd $MODULE_PATH/rtwp_10ms/driver
if [ $ROOTFSCLEAN -eq 1 ]; then
echo "make clean adc obj"
make clean
fi
make
cp rtwp_fpga.ko $MODULE_INSTALL_PATH/
echo "build rtwp_10ms module ok"
echo "build LM75 module start"
cd $MODULE_PATH/lm75
if [ $ROOTFSCLEAN -eq 1 ]; then
echo "make clean lm75 obj"
make clean
fi
make
cp lm75.ko $MODULE_INSTALL_PATH/
echo "build LM75 module ok"
echo "build tmp401 module start"
cd $MODULE_PATH/tmp401
if [ $ROOTFSCLEAN -eq 1 ]; then
echo "make clean tmp401 obj"
make clean
fi
make
cp tmp401.ko $MODULE_INSTALL_PATH/
echo "build tmp401 module ok"
}
build_libbsp()
{
echo "build lib bsp start"
cd $TPWD/misc/libbsp/build
sh libbspbuild.sh product $softwareVersion
cp -rf $TPWD/misc/bspinit $CODE_DIR
cp -rf $TPWD/images/release/version $CODE_DIR
echo "build lib bsp ok"
}
build_bspapp()
{
echo "build dpd app 10.0"
cd $TPWD/misc/dpd-app
make clean
make
cp libdpd.so $DPDLIB_DIR
cp bin/dpd-smp $TPWD/misc/bspinit/conf/ -rf
echo "build dpd app 10.0 end"
echo "build ssh log start"
cd $TPWD/misc/user/ssh_log
make clean
make
cp ssh_log $TPWD/misc/bspinit/bin/ -rf
echo "build ssh log ok"
}
build_fpga()
{
echo "build fpga start"
cp -rf $TPWD/hw-description/fpga_6cg_2tr.bin $FPGA_DIR/fpga.bit
cp -rf $TPWD/hw-description/fpga_6cg_mini.bin $FPGA_DIR/fpga_mini.bit
cp -rf $TPWD/hw-description/fpga_6cg_4tr.bin $FPGA_DIR/fpga_four_line.bit
cp -rf $TPWD/images/release/version $FPGA_DIR
echo "build fpga ok"
}
build_data()
{
echo "build data start"
echo "build equipment"
echo "build memtest"
cd $TPWD/misc/user/test_driver/memtester
make clean
make
cp memtester $EQUIPMENT_DIR/
echo "build memtest ok"
echo "build equipment ok"
echo "cp ini and xml to conf"
cp $CODE_DIR/bspinit/conf/RruCfg.xml $DATA_DIR/conf
cp $CODE_DIR/bspinit/conf/config.ini $DATA_DIR/conf
cd $TPWD/misc/user/test_driver/bin
cp equipment_test.sh $EQUIPMENT_DIR/
cd $TPWD/misc/user/test_driver/sfp_test
make clean
make
cp sff_test $EQUIPMENT_DIR/
echo "build data ok"
}
packet_oam()
{
oampacketname=om-install-arm-ru.tar.gz
cp -rf $TPWD/misc/oam/$oampacketname $CODE_DIR
cd $CODE_DIR
tar -xf $oampacketname
rm -f $oampacketname
cd -
}
release_rootfs()
{
echo "release rootfs start"
echo "build rootfs module"
build_kernelmodule
build_bspapp
build_libbsp
build_fpga
build_data
packet_oam
cd $TPWD/rootfs
sudo chown root:root -R rootfs
sudo chown root:root -R mnt/code
sudo chown root:root -R mnt/fpga
sudo $TPWD/tools/bin/mksquashfs mnt/code bspom.img -b 64K -comp xz -no-xattrs
sudo chown $USER:$USER bspom.img
sudo $TPWD/tools/bin/mksquashfs mnt/fpga fpga.img -b 64K -comp xz -no-xattrs
sudo chown $USER:$USER fpga.img
sudo $TPWD/tools/bin/mksquashfs rootfs rootfs.img -b 64K -comp xz -no-xattrs
sudo chown $USER:$USER rootfs.img
mv rootfs.img $TPWD/images/tmp/
mv bspom.img $TPWD/images/tmp/
mv fpga.img $TPWD/images/tmp/
cd $TPWD/images
echo $rootfsVerison > tmp/rootfsversion
echo $bspomVerison > tmp/bspomversion
echo $fpgaVerison > tmp/fpgaversion
dd if=tmp/rootfs.img of=tmp/rootfs_image.bin bs=6M seek=0 count=1 conv=sync
dd if=tmp/rootfs_image.bin of=release/rru_norflash_image.bin bs=1M seek=10 count=6 conv=sync
dd if=tmp/rootfsversion of=release/rru_norflash_image.bin bs=64 seek=262142 count=1
dd if=tmp/fpga.img of=tmp/fpga_image.bin bs=10M seek=0 count=1 conv=sync
dd if=tmp/fpga_image.bin of=release/rru_norflash_image.bin bs=1M seek=16 count=10 conv=sync
dd if=tmp/fpgaversion of=release/rru_norflash_image.bin bs=64 seek=425982 count=1
dd if=tmp/bspom.img of=tmp/bspom_image.bin bs=6M seek=0 count=1 conv=sync
dd if=tmp/bspom_image.bin of=release/rru_norflash_image.bin bs=1M seek=26 count=6 conv=sync
dd if=tmp/bspomversion of=release/rru_norflash_image.bin bs=64 seek=524286 count=1
cp release/rru_norflash_image.bin tmp/rru_norflash_imageB.bin
dd if=tmp/rru_norflash_imageB.bin of=release/rru_norflash_image.bin bs=1M seek=32 count=32 conv=sync
md5sum tmp/rootfs.img > tmp/rootfs.md5
dd if=tmp/rootfs.md5 of=release/rootfs.img bs=32 count=1 seek=1
dd if=tmp/rootfs.img of=release/rootfs.img bs=64 count=98304 seek=1
dd if=tmp/rootfsversion of=release/rootfs.img bs=64 count=1 seek=98303
md5sum tmp/bspom.img > tmp/bspom.md5
dd if=tmp/bspom.md5 of=release/bspom.img bs=32 count=1 seek=1
dd if=tmp/bspom.img of=release/bspom.img bs=64 count=98304 seek=1
dd if=tmp/bspomversion of=release/bspom.img bs=64 count=1 seek=98303
md5sum tmp/fpga.img > tmp/fpga.md5
dd if=tmp/fpga.md5 of=release/fpga.img bs=32 count=1 seek=1
dd if=tmp/fpga.img of=release/fpga.img bs=64 count=163840 seek=1
dd if=tmp/fpgaversion of=release/fpga.img bs=64 count=1 seek=163839
cd $TPWD/rootfs
sudo chown root:root -R mnt/data
sudo cp $TPWD/images/release/bootloader.img mnt/data/verupg/slot0/ -rf
sudo cp $TPWD/images/release/linux.img mnt/data/verupg/slot0/ -rf
sudo cp $TPWD/images/release/rootfs.img mnt/data/verupg/slot0/ -rf
sudo cp $TPWD/images/release/bspom.img mnt/data/verupg/slot0/ -rf
sudo cp $TPWD/images/release/fpga.img mnt/data/verupg/slot0/ -rf
sudo cp $TPWD/images/release/ver.ini mnt/data/verupg/slot0/ -rf
sudo $TPWD/tools/bin/mkfs.jffs2 -r mnt/data -o data.img -e 0x10000 --pad=0x4000000
sudo chown $USER:$USER data.img
mv data.img $TPWD/images/release/
cd $TPWD/images
dd if=release/data.img of=tmp/data_image.bin bs=64M seek=0 count=1 conv=sync
dd if=tmp/data_image.bin of=release/rru_norflash_image.bin bs=1M seek=64 count=64 conv=sync
echo "release rootfs ok"
sudo cp -rf $TPWD/rootfs/rootfs $TPWD/images/tmp/
sudo cp -rf $CODE_DIR $TPWD/images/tmp/
sudo cp -rf $FPGA_DIR $TPWD/images/tmp/
sudo cp -rf $DATA_DIR $TPWD/images/tmp/
sudo rm -rf $TPWD/rootfs/rootfs
sudo rm -rf $CODE_DIR
sudo rm -rf $FPGA_DIR
sudo rm -rf $DATA_DIR
}
release_tmp()
{
cd $TPWD/images
sudo rm -rf tmp
if [ ! -d "tmp" ]; then
mkdir tmp
fi
}
recover()
{
cd $MODULE_PATH/adr_map/drv
make clean
cd $MODULE_PATH/cpri_link
make clean
cd $MODULE_PATH/adc
make clean
cd $MODULE_PATH/rtwp_10ms/driver
make clean
cd $MODULE_PATH/lm75
make clean
cd $MODULE_PATH/tmp401
make clean
cd $TPWD/misc/dpd-app
make clean
rm -rf $TPWD/misc/libbsp/lib/dpd/libdpd.so
rm -rf $TPWD/misc/bspinit/conf/dpd-smp
cd $TPWD/misc/user/test_driver/memtester
make clean
cd $TPWD/misc/user/test_driver/sfp_test
make clean
cd $TPWD/misc/user/ssh_log
make clean
cd $TPWD/misc/libbsp/build
sh bspbuildCleanAll.sh
rm -rf $TPWD/misc/libbsp/src/commlib/version.c
rm -rf $TPWD/images/release
sudo rm -rf $TPWD/images/tmp
rm -rf $KERN_DIR
rm -rf $ATF_DIR
rm -rf $UBOOT_DIR
rm -rf $ROOTFS_DIR
rm -rf $TPWD/dirtyfile
exit 0
}
create_update_rootfs_project()
{
echo "create_update_rootfs_project start"
cd $TPWD/images/
mkdir rru_rootfs_project
cd rru_rootfs_project
sudo rm -rf *
sudo cp -rf $TPWD/images/tmp/rootfs .
sudo cp -rf $TPWD/images/tmp/code .
sudo cp -rf $TPWD/images/tmp/fpga .
sudo cp -rf $TPWD/images/tmp/data .
cp $TPWD/tools/bin/mksquashfs .
cp $TPWD/tools/bin/mkfs.jffs2 .
echo '#!/bin/bash' >> build.sh
echo 'set -ex' >> build.sh
echo 'sudo rm -rf bspom.img fpga.img rootfs.img data.img' >> build.sh
echo 'sudo chown root:root -R code' >> build.sh
echo 'sudo ./mksquashfs code bspom.img -b 64K -comp xz -no-xattrs' >> build.sh
echo 'sudo chown $USER:$USER bspom.img' >> build.sh
echo 'sudo chown root:root -R fpga' >> build.sh
echo 'sudo ./mksquashfs fpga fpga.img -b 64K -comp xz -no-xattrs' >> build.sh
echo 'sudo chown $USER:$USER fpga.img' >> build.sh
echo 'sudo chown root:root -R rootfs' >> build.sh
echo 'sudo ./mksquashfs rootfs rootfs.img -b 64K -comp xz -no-xattrs' >> build.sh
echo 'sudo chown $USER:$USER rootfs.img' >> build.sh
echo 'sudo chown root:root -R data' >> build.sh
echo 'sudo ./mkfs.jffs2 -r data -o data.img -e 0x10000 --pad=0x4000000' >> build.sh
echo 'sudo chown $USER:$USER data.img' >> build.sh
echo 'mkdir -p tmp' >> build.sh
echo 'md5sum rootfs.img > tmp/rootfs.md5' >> build.sh
echo 'dd if=tmp/rootfs.md5 of=tmp/rootfs.img bs=32 count=1 seek=1' >> build.sh
echo 'dd if=rootfs.img of=tmp/rootfs.img bs=64 count=98304 seek=1' >> build.sh
echo 'md5sum bspom.img > tmp/bspom.md5' >> build.sh
echo 'dd if=tmp/bspom.md5 of=tmp/bspom.img bs=32 count=1 seek=1' >> build.sh
echo 'dd if=bspom.img of=tmp/bspom.img bs=64 count=98304 seek=1' >> build.sh
echo 'md5sum fpga.img > tmp/fpga.md5' >> build.sh
echo 'dd if=tmp/fpga.md5 of=tmp/fpga.img bs=32 count=1 seek=1' >> build.sh
echo 'dd if=fpga.img of=tmp/fpga.img bs=64 count=163840 seek=1' >> build.sh
echo 'cp tmp/* ./ -rf' >>build.sh
echo 'rm -rf tmp/' >>build.sh
echo 'sudo chmod +x build.sh' >> build.sh
echo 'sudo chown $USER:$USER -R fpga' >> build.sh
echo 'sudo chown $USER:$USER -R code' >> build.sh
echo 'sudo chown $USER:$USER -R data' >> build.sh
cd ..
sudo tar -cvf release/rru_rootfs_project$atag.tar.gz rru_rootfs_project
sudo rm -rf rru_rootfs_project
echo "create_update_rootfs_project start ok"
}
if [ $DORECOVER -eq 1 ]; then
recover
fi
build_config
release_tmp
if [ ! -d "$TPWD/images/release" ]; then
mkdir $TPWD/images/release
fi
cp $TPWD/images/*.tcl $TPWD/images/release
cp $TPWD/images/*.doc $TPWD/images/release
unzip_boot
unzip_kernel
unzip_rootfs
echo "software "= $softwareVersion > $TPWD/images/release/ver.ini
echo "bootloader "= $bootloaderVersion >> $TPWD/images/release/ver.ini
echo "bspom "= $bspomVerison >> $TPWD/images/release/ver.ini
echo "fpga "= $fpgaVerison >> $TPWD/images/release/ver.ini
echo "linux "= $linuxVerison >> $TPWD/images/release/ver.ini
echo "rootfs "= $rootfsVerison >> $TPWD/images/release/ver.ini
echo "do module is $DO_MODULE"
if [ "$DO_MODULE" = "boot" ]; then
release_atf
release_uboot $localver $jobs
fi
if [ "$DO_MODULE" = "kernel" ]; then
release_kernel $localver $jobs
fi
if [ "$DO_MODULE" = "rootfs" ]; then
release_rootfs
fi
if [ "$DO_MODULE" = "all" ]; then
release_atf
release_uboot $localver $jobs
release_kernel $localver $jobs
release_rootfs
fi
if [ "$DO_MODULE" = "xsa" ]; then
release_xsa
release_atf
release_uboot $localver $jobs
fi
if [ "$DO_MODULE" = "project" ]; then
release_atf
release_uboot $localver $jobs
release_kernel $localver $jobs
release_rootfs
create_update_rootfs_project
cd $TPWD/images/
tar -cvf release-$head-$atag.tar.gz release
fi