fix logo generator
authorBigfootACA <bigfoot@classfun.cn>
星期天, 17 Jan 2021 15:19:03 +0000 (23:19 +0800)
committerBigfootACA <bigfoot@classfun.cn>
星期五, 2 Jul 2021 08:29:19 +0000 (16:29 +0800)
.github/workflows/main.yml
README.md
assets/generate-logo.py
build.sh
sdm845Pkg/Drivers/LogoDxe/Logo.bmp [deleted file]

index 60f8a4c8a099e6f2d3e8d1e3cfece4d6e04be5ab..0d0fe51e53d8e42bccde73ab82ce7533a513ebe9 100644 (file)
@@ -23,7 +23,7 @@ jobs:
       - uses: actions/checkout@v2
 
       - name: Install requires packages
-        run: sudo apt install build-essential uuid-dev iasl git nasm python3-distutils gcc-aarch64-linux-gnu abootimg
+        run: sudo apt install build-essential uuid-dev iasl git nasm gcc-aarch64-linux-gnu abootimg python3-distutils python3-pil python3-git
 
       - name: Build all devices
         run: ./build.sh -a
index dd30e874ffb6e61fab74ac26d8610ce7501b8312..155a89a334ef2d838eeac282727197ef5a1ec650 100644 (file)
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ Ubuntu 18.04:
 \r
 ```bash\r
 sudo apt update\r
-sudo apt install build-essential uuid-dev iasl git nasm python3-distutils gcc-aarch64-linux-gnu abootimg\r
+sudo apt install build-essential uuid-dev iasl git nasm gcc-aarch64-linux-gnu abootimg python3-distutils python3-pil python3-git\r
 ```\r
 Ubuntu 20.04 is also proved to be fine.\r
 \r
index d2ec0264e48b61fc7db4ae5b612c2f2c2e3cc4e7..fc855af9ee0ff8c8b88e883534d9404bcdd093ad 100644 (file)
@@ -3,7 +3,7 @@
 import time
 ohmydate = str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
 
-import sys 
+import sys
 pwd = sys.path[0]
 
 import PIL
@@ -11,36 +11,34 @@ from PIL import ImageFont
 from PIL import Image
 from PIL import ImageDraw
 from git import Repo
+
 
 imageFile = pwd + "/Logo.bmp"
 file_save_dir = pwd + "/../sdm845Pkg/Drivers/LogoDxe/"
 outputName = "Logo"
 print(ohmydate)
+
 repoPath = pwd + "/.."
 repo = Repo(repoPath)
 gitHead = str(repo.head.commit)
 print(gitHead)
 strs = "head:" + gitHead + "\n Build:" + ohmydate
+
 
 x = 1
 y = 1
 word_size = 11
 word_css  = pwd + "/NotoSerif-Italic.ttf"
+
 #Set font
 font = ImageFont.truetype(word_css,word_size)
 
 im1=Image.open(imageFile)
 draw = ImageDraw.Draw(im1)
 print(font.getsize(strs))
 draw.text((x, y),strs,(255,255,0),font=font)
-        
 
 new_filename = file_save_dir  +outputName.replace(",","-").replace("\n","-")+".bmp"
-im1.save(new_filename) 
+im1.save(new_filename)
 del draw
 im1.close()
index 95c3f54ee0b4261cf09a81cbb3c9870ce1cdd0a2..b4e6dfdc33aa8b0803c377030d147c69958b1c8c 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -32,7 +32,6 @@ function _build(){
        make -C "${_EDK2}/BaseTools" -j "$(nproc)"||exit "$?"
        # based on the instructions from edk2-platform
        rm -f "boot_${DEVICE}.img" uefi_img "uefi-${DEVICE}.img.gz" "uefi-${DEVICE}.img.gz-dtb"
-       python3 assets/generate-logo.py
        build -s -n 0 -a AARCH64 -t GCC5 -p "sdm845Pkg/${DEVICE}.dsc"||return "$?"
        gzip -c < workspace/Build/sdm845Pkg/DEBUG_GCC5/FV/SDM845PKG_UEFI.fd > "uefi-${DEVICE}.img.gz"||return "$?"
        cat "uefi-${DEVICE}.img.gz" "device_specific/${DEVICE}.dtb" > "uefi-${DEVICE}.img.gz-dtb"||return "$?"
@@ -55,11 +54,13 @@ do  case "${1}" in
                *)_help 1;;
        esac
 done
-if ! [ -d ../edk2 ]
-then   echo "Updating submodules"
+if ! [ -f edk2/edksetup.sh ] || ! [ -f ../edk2/edksetup.sh ]
+then   set -e
+       echo "Updating submodules"
        git submodule init&&git submodule update
        pushd edk2&&git submodule init&&git submodule update&&popd
        pushd edk2-platforms&&git submodule init&&git submodule update&&popd
+       set +e
 fi
 for i in "${EDK2}" ./edk2 ../edk2
 do     if [ -n "${i}" ]&&[ -f "${i}/edksetup.sh" ]
@@ -83,6 +84,7 @@ export PACKAGES_PATH="$_EDK2:$_EDK2_PLATFORMS:$PWD"
 export WORKSPACE="${PWD}/workspace"
 echo > ramdisk
 set -e
+python3 assets/generate-logo.py
 if [ -z "${DEVICE}" ]
 then _help 1
 elif [ "${DEVICE}" == "all" ]
diff --git a/sdm845Pkg/Drivers/LogoDxe/Logo.bmp b/sdm845Pkg/Drivers/LogoDxe/Logo.bmp
deleted file mode 100644 (file)
index 31d5761..0000000
Binary files a/sdm845Pkg/Drivers/LogoDxe/Logo.bmp and /dev/null differ