Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- s_cpunum=4; BUILD=1; s_pkgext="txz";
- root="/tmp/tmp" ; prefix="${root}/usr/local"
- rm -Rf "${root}" ; mkdir -p "${prefix}/bin" #"${prefix}/sbin"
- s_binonly="";
- for s_target in binonly sun50i_h5_spl32 orangepi_pc2; do
- case "${s_target}" in
- binonly) s_binonly=1; ;;
- orangepi_pc) s_uboot_crossprefix="arm-linux-gnueabihf-"; ;;
- sun50i_h5_spl32) s_uboot_crossprefix="arm-linux-gnueabihf-"; ;;
- orangepi_pc2) s_uboot_crossprefix="aarch64-linux-gnueabihf-"; ;;
- *) echo "Error 9 - wrong target: ${s_target}"; exit -1; ;;
- esac
- if [ "${s_target}" != "binonly" -a "${s_target}" != "s" ]; then
- if true; then
- # echo "Error 9 - not supported..."; exit -1;
- make -j "${s_cpunum}" CROSS_COMPILE=${s_uboot_crossprefix} V=1 distclean
- make -j "${s_cpunum}" CROSS_COMPILE=${s_uboot_crossprefix} V=1 ${s_target}_defconfig;
- make -j "${s_cpunum}" CROSS_COMPILE=${s_uboot_crossprefix} V=1 all;
- case "${s_target}" in
- orangepi_pc2)
- if [ \! -f "${root}/sunxi-spl.bin" ]; then echo "Error 9 - h5 sunxi-spl.bin missing..."; exit -1; fi;
- ${s_uboot_crossprefix}objcopy --gap-fill=0xff -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn -j .efi_runtime -j .efi_runtime_rel -I binary -O binary --pad-to=32768 --gap-fill=0xff \
- "${root}/sunxi-spl.bin" u-boot-sunxi-with-spl.bin && cat u-boot.img >> u-boot-sunxi-with-spl.bin || rm -f u-boot-sunxi-with-spl.bin
- ;;
- esac
- fi
- ( cd tools; install -vpm755 jtagconsole gen_eth_addr img2srec mkimage easylogo/easylogo "${prefix}/bin";
- #cd env; install -vpm755 fw_printenv "${prefix}/sbin"; (cd "${prefix}/sbin"; ln -snf fw_printenv fw_setenv )
- )
- chown -R root.bin "${prefix}";
- case "${s_target}" in
- sun50i_h5_spl32) cp -dpR spl/sunxi-spl.bin "${root}/sunxi-spl.bin"; ;; # dd if="spl/sunxi-spl.bin" of="${root}/sunxi-spl.bin" bs=32768c conv=sync; ;;
- orangepi_pc2)
- if [ \! -f "${root}/sunxi-spl.bin" ]; then echo "Error 9 - h5 sunxi-spl.bin missing..."; exit -1; fi;
- #if [ "$(find "${root}/sunxi-spl.bin" -printf "%s")" -ne 32768 ]; then echo "Error 9 - h5 sunxi-spl.bin wrong size..."; exit -1; fi;
- if [ \! -f "u-boot.bin" ]; then echo "Error 9 - h5 u-boot.bin missing..."; exit -1; fi;
- if [ \! -f "u-boot-sunxi-with-spl.bin" ]; then echo "Error 9 - h5 u-boot-sunxi-with-spl.bin missing..."; exit -1; fi;
- (
- git clone https://github.com/apritzel/arm-trusted-firmware arm-trusted-firmware;#git checkout allwinner -f; git pull origin allwinner;
- cd arm-trusted-firmware;git checkout allwinner -f; git pull origin allwinner;
- make CROSS_COMPILE=${s_uboot_crossprefix} PLAT=sun50iw1p1 DEBUG=1 bl31 V=1
- )
- if [ \! -f "arm-trusted-firmware/build/sun50iw1p1/debug/bl31.bin" ]; then echo "Error 9 - bl31.bin missing..."; exit -1; fi;
- mkdir -p "${prefix}/share/uboot/";
- mv "${root}/sunxi-spl.bin" "${prefix}/share/uboot/${s_target}-sunxi-spl.bin";
- cp -dpR "u-boot-sunxi-with-spl.bin" "${prefix}/share/uboot/${s_target}-u-boot-sunxi-with-spl.bin";
- cp -dpR "arm-trusted-firmware/build/sun50iw1p1/debug/bl31.bin" "${prefix}/share/uboot/";
- chown root.wheel "${prefix}/share/uboot/";
- ;;
- *)
- mkdir -p "${prefix}/share/uboot";
- cp -dpR "u-boot.bin" "${prefix}/share/uboot/${s_target}-u-boot.bin";
- cp -dpR "u-boot-sunxi-with-spl.bin" "${prefix}/share/uboot/${s_target}-u-boot-sunxi-with-spl.bin";
- cp -dpR "u-boot-dtb.bin" "${prefix}/share/uboot/${s_target}-u-boot-dtb.bin";
- chown root.wheel "${prefix}/share/uboot/";
- ;;
- esac
- fi
- done
- mkdir -p "${prefix}/share/man/man1";cp -dpR doc/*.1 "${prefix}/share/man/man1";chown -R man.man "${prefix}/share/man";
- #make install DESTDIR="${root}"
- rm -Rf "${prefix}/info"
- if [ -d "${prefix}/man" ]; then mv "${prefix}/man" "${prefix}/share/man" ; rmdir "${prefix}/man" ; fi
- if [ -d "${prefix}/info" ]; then mv "${prefix}/info" "${prefix}/share/info" ; rmdir "${prefix}/info" ; fi
- ${s_crossprefix}strip ${prefix}/bin/* ${prefix}/lib${LIBDIRSUFFIX}/*.so
- lzma -9 ${prefix}/share/man/man*/* ; chown -R man.man ${prefix}/share/man
- find ${prefix}/share/locale/* -maxdepth 0 -type d \! -name "fr" -a \! -name "en*" | xargs rm -Rf
- rm -Rf "${prefix}/share/info" "${prefix}/share/doc"
- if [ -f "${root}/sunxi-spl.bin" ]; then echo "Error 9 - h5 sunxi-spl.bin not processed..."; exit -1; fi;
- if [ -n "${s_binonly}" ]; then rm -Rf "${prefix}/bin" "${prefix}/share/man"; fi;
- ( nam="../$(cd ${1:-.} ; basename $(pwd))-${ARCH}-${BUILD}${s_pkgext}" ; cd "${root}" ; makepkg -l y -c n "${nam}" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement