close


筆者今天上班時碰上了一個狀況. 就是機房的 SERVER 換顆硬碟, Ubuntu 不能開機, 這怎麼辦呢? 這個問題我後來使用了 UEFI 來解決. 如果 BIOS 有支援 UEFI, 我們可以使用 UEFI 開機. 什麼是 UEFI ? UEFI 是統一可延伸韌體介面(Unified Extensible Firmware Interface, UEFI)的縮寫, 是一種個人電腦系統規格, 用來定義作業系統與系統韌體之間的軟體介面, 作為BIOS的替代方案. 

 

UEFI SHELL


1. 首先 BIOS 設定 UEFI 開機.
 

2. 進入 UEFI SHELL ; 如下圖所示: 


efi.jpg



3. 進入 BOOT PARTITION
 

Shell> FS0:

4. 進入 EFI\ubuntu 資料夾
 

FS0 :\> ls
...
09/04/15   07:07a <DIR>      512   EFI
...
FS0 :\> cd EFI\ubuntu
FS0 :\EFI\ubuntu> ls
...

5. 執行 grubx64.efi
 

FS0 :\EFI\ubuntu> grubx64.efi
...


STARTUP.NSH
 

 /boot/efi/startup.nsh
FS0:
cd EFI\ubuntu
grubx64.efi

 

 /boot/efi/startup.nsh
if exist FS0:\EFI then
  FS0:
  cd EFI\ubuntu
  if exist grubx64.efi then
    grubx64.efi 10
  endif
endif

 

Script for Building LOLLIPOP-SEATTLE ( mk-selinuxtarballs.sh )


下面這個 BUILD SCRIPT 也有用到 UEFI 唷. 
 

#!/bin/bash
# Author+=amit.pundir@linaro.org

#set -e

CWD=`pwd`
if [ -d android ] ; then
    cd android
fi

#export ARCH=arm64
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:/usr/lib/jvm/java-7-openjdk-amd64/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/CodeSourcery/bin:/home/root/android-ndk-r10d:/opt/gcc-linaro-5.1-2015.08-x86_64_aarch64-linux-gnu/bin:/root/android-sdk-linux/tools:/home/root/bin:/root/android-sdk-linux/platform-tools:/root/android-sdk-linux/build-tools
export CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib:.


export MANIFEST_REPO=`echo git://android.git.linaro.org/platform/manifest.git | sed 's/\/\/.*-bot@/\/\/'"${LINARO_ANDROID_ACCESS_ID}"'@/'`
export LOCAL_MANIFEST=`echo git://android.git.linaro.org/platform/manifest.git | sed 's/\/\/.*-bot@/\/\/'"${LINARO_ANDROID_ACCESS_ID}"'@/'`
export MANIFEST_BRANCH=android-5.1.1_r24
export LOCAL_MANIFEST_BRANCH=linaro-lollipop
export MANIFEST_FILENAME=default.xml
export TARGET_PRODUCT=juno
#export PATCHSETS="LOLLIPOP-STABLE-PATCHSET LOLLIPOP-CHROME-PATCHSET"
export PATCHSETS="juno-master-patches juno-m-workarounds LOLLIPOP-STABLE-PATCHSET LOLLIPOP-CHROME-PATCHSET MARSHMALLOW-RLCR-PATCHSET"
export LUNCH=juno-userdebug
export TARGET_SIMULATOR=false
export BUILD_TINY_ANDROID=
export CPUS=`grep -c processor /proc/cpuinfo`
export INCLUDE_PERF=
export TARGET_BUILD_VARIANT=userdebug
export BUILD_FS_IMAGE=1
export DEBUG_NO_STRICT_ALIASING=
export DEBUG_NO_STDCXX11=
export TOOLCHAIN_TRIPLET=
#export ANDROID_64=
export WITH_HOST_DALVIK=true
#export USE_LINARO_TOOLCHAIN=
export TARGET_TOOLS_PREFIX=


make -C kernel/linaro/phoenix ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- distclean
make -C kernel/linaro/wily ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- distclean
make -C kernel/linaro/armlt ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- distclean
rm -rf device/linaro/juno/kernel out/target/product/juno/kernel out/target/product/juno/kernel out/target/product/juno/obj/kernel out/target/product/juno/boot/kernel

mkdir -p out/target/product/juno/obj/kernel/arch/arm64/boot/
mkdir -p out/target/product/juno/boot/
/bin/cp amd-overdrive.dtb out/target/product/juno/obj/kernel/arch/arm64/boot/
/bin/cp amd-overdrive.dtb out/target/product/juno/boot/


#################
mkdir -p out/target/product/juno/system
mkdir -p out/target/product/juno/system/lib
mkdir -p out/target/product/juno/system/lib/egl
mkdir -p out/target/product/juno/system/lib64
mkdir -p out/target/product/juno/system/lib64/egl
/bin/cp my_vendor/arm/mali-t62x_r6p0-02rel0_android-5.1/lib/egl/lib*.so out/target/product/juno/system/lib/egl/
/bin/cp my_vendor/arm/mali-t62x_r6p0-02rel0_android-5.1/lib64/egl/lib*.so out/target/product/juno/system/lib64/egl/


# init=/init rw

echo "fs0:" > out/target/product/juno/boot/startup.nsh
echo -n "kernel initrd=ramdisk.img console=ttyAMA0,115200 no_console_suspend=1 video=radeondrmfb:dev=hdmi,bpp=16 selinux=0 androidboot.hardware=juno" >> out/target/product/juno/boot/startup.nsh

#echo -n "kernel initrd=ramdisk.img console=ttyAMA0,115200 radeon.dpm=1 radeon.agpmode=-1 video=radeondrmfb:dev=hdmi,bpp=32 selinux=0 androidboot.hardware=juno" >> out/target/product/juno/boot/startup.nsh
#echo -n "kernel dtb=amd-overdrive.dtb initrd=ramdisk.img console=ttyAMA0,115200 selinux=0 androidboot.hardware=juno" >> out/target/product/juno/boot/startup.nsh


#[ -f kernel/linaro/wily/arch/arm64/boot/Image ] && cp kernel/linaro/wily/arch/arm64/boot/Image out/target/product/juno/boot/kernel
#rm -rf out/target/product/juno/kernel
#ln -s kernel/linaro/wily/arch/arm64/boot/Image out/target/product/juno/kernel


# build the code
source build/envsetup.sh
lunch ${LUNCH}
#time make -j${CPUS} showcommands selinuxtarballs 2>&1 | tee build_selinuxtarballs.log
time make showcommands selinuxtarballs 2>&1 | tee build_selinuxtarballs.log
#time make -j${CPUS} showcommands droidcore 2>&1 | tee build_selinuxtarballs.log
cd $CWD


unset INCLUDE_PERF
unset DEBUG_NO_STRICT_ALIASING
unset DEBUG_NO_STDCXX11
unset TOOLCHAIN_TRIPLET
unset ANDROID_64
unset WITH_HOST_DALVIK
unset USE_LINARO_TOOLCHAIN
unset TARGET_TOOLS_PREFIX


 


 


 

 

 

 

 

arrow
arrow
    文章標籤
    UEFI
    全站熱搜
    創作者介紹
    創作者 Lexra 的頭像
    Lexra

    Lexra Pixnet

    Lexra 發表在 痞客邦 留言(0) 人氣()