Commit 1ed01726 authored by Christopher's avatar Christopher
Browse files

docker-build, img-build & recovery-flash

parent 00ecac59
#!/bin/bash
WORKDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/Docker
WORKDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
docker build -t yrzr/hikey970_tools:img ${WORKDIR}
......@@ -26,10 +26,24 @@ docker run --rm \
yrzr/hikey970_tools:img \
bash -c "cd /root/ && ./l-loader/build_uefi.sh hikey970"
# if [ -d ${OUTPUTDIR} ]; then
# rm -rf ${OUTPUTDIR}
# fi
mkdir -p ${OUTPUTDIR}
# sda
cp -v ${WORKDIR}/tools-images-hikey970/sec_usb_xloader.img ${OUTPUTDIR}
# sdb
cp -v ${WORKDIR}/tools-images-hikey970/sec_usb_xloader2.img ${OUTPUTDIR}
# sdc
cp -v ${WORKDIR}/l-loader/l-loader.bin ${OUTPUTDIR}
# partition table of sdd
cp -v ${WORKDIR}/l-loader/prm_ptable.img ${OUTPUTDIR}
# sdd1 vrl
cp -v ${WORKDIR}/tools-images-hikey970/sec_xloader.img ${OUTPUTDIR}
# sdd4 fip
cp -v ${WORKDIR}/edk2/Build/HiKey970/RELEASE_GCC5/FV/fip.bin ${OUTPUTDIR}
docker run --rm \
-v ${WORKDIR}:/root \
yrzr/hikey970_tools:img \
bash -c "rm -r /root/*"
#/bin/bash
DEVICE=$1
WORKDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/out
if [ "${DEVICE}" == "" ]; then
DEVICE=/dev/ttyUSB1
fi
cd ${WORKDIR}
sudo ${WORKDIR}/hikey_idt -c ${WORKDIR}/../config -p ${DEVICE}
echo "Flashing ptable "
# partition table
sudo fastboot flash ptable ${WORKDIR}/prm_ptable.img
# bootloader
sudo fastboot flash xloader ${WORKDIR}/sec_xloader.img
sudo fastboot flash fastboot ${WORKDIR}/l-loader.bin
sudo fastboot flash fip ${WORKDIR}/fip.bin
#boot
sudo fastboot flash boot /Data/hikey970/uefi.img
echo "Flashing rootfs takes over 3 mins, So please be patient..."
#rootfs
sudo fastboot flash system /Data/hikey970/rootfs.btrfs.img
......@@ -2,12 +2,13 @@ FROM debian:stretch
LABEL maintainer="Christopher L.D. SHEN (shenleidi@gmail.com)"
RUN apt-get update -qq \
&& apt-get install -qq -y wget xz-utils fakeroot img2simg simg2img make python gcc uuid-dev g++ libssl-dev \
&& apt-get install -qq -y wget xz-utils fakeroot img2simg simg2img make python gcc uuid-dev g++ libssl-dev abootimg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /var/tmp/*
RUN wget -q https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz -O /tmp/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz \
&& cd /opt/ && tar -axpf /tmp/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz \
&& rm /tmp/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz \
&& mkdir /opt/toolchain/ \
&& rm /tmp/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
RUN mkdir /opt/toolchain/ \
&& ln -s /opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu /opt/toolchain/gcc-linaro-7.1.1-2017.08-x86_64_aarch64-linux-gnu
./sec_usb_xloader.img 0x00022000
./sec_usb_xloader2.img 0x60049000
./l-loader.bin 0x16800000
diff --git a/generate_ptable.sh b/generate_ptable.sh
index 88f1d619..88f82b4a 100755
index 88f1d61..5d89b69 100755
--- a/generate_ptable.sh
+++ b/generate_ptable.sh
@@ -233,11 +233,13 @@ case ${PTABLE} in
#[11: trustfirmware: 417M-419M]
fakeroot ${SGDISK} -n 11:0:+2M -t 11:0700 -u 11:f1e126a6-ceef-45c1-aace-29f33ac9cf13 -c 11:"trustfirmware" ${TEMP_FILE}
#[12: system: 419M-5107M]
@@ -224,20 +224,10 @@ case ${PTABLE} in
hikey970)
#[7: boot: 289M-369M]
fakeroot ${SGDISK} -n 7:0:+80M -t 7:EF00 -u 7:d3340696-9b95-4c64-8df6-e6d4548fba41 -c 7:"boot" ${TEMP_FILE}
- #[8: ramdisk: 369M-385M]
- fakeroot ${SGDISK} -n 8:0:+16M -t 8:EF00 -u 8:d3340696-9b95-4c64-8df6-e6d4548fba14 -c 8:"ramdisk" ${TEMP_FILE}
- #[9: dts: 385M-401M]
- fakeroot ${SGDISK} -n 9:0:+16M -t 9:0700 -u 9:6e53b0bb-fa7e-4206-b607-5ae699e9f066 -c 9:"dts" ${TEMP_FILE}
- #[10: dto: 401M-417M]
- fakeroot ${SGDISK} -n 10:0:+16M -t 10:0700 -u 10:6e53b0bb-fa7e-4206-b607-5ae699e9f099 -c 10:"dto" ${TEMP_FILE}
- #[11: trustfirmware: 417M-419M]
- fakeroot ${SGDISK} -n 11:0:+2M -t 11:0700 -u 11:f1e126a6-ceef-45c1-aace-29f33ac9cf13 -c 11:"trustfirmware" ${TEMP_FILE}
- #[12: system: 419M-5107M]
- fakeroot ${SGDISK} -n 12:0:+4688M -t 12:8300 -u 12:c3e50923-fb85-4153-b925-759614d4dfcd -c 12:"system" ${TEMP_FILE}
+ fakeroot ${SGDISK} -n 12:0:+56G -t 12:8300 -u 12:c3e50923-fb85-4153-b925-759614d4dfcd -c 12:"system" ${TEMP_FILE}
#[13: vendor: 5107M-5891M]
fakeroot ${SGDISK} -n 13:0:+784M -t 13:0700 -u 13:919d7080-d71a-4ae1-9227-e4585210c837 -c 13:"vendor" ${TEMP_FILE}
#[14: reserved: 5891M-5892M]
fakeroot ${SGDISK} -n 14:0:+1M -t 14:0700 -u 14:611eac6b-bc42-4d72-90ac-418569c8e9b8 -c 14:"reserved" ${TEMP_FILE}
+ #[15: swap: 6892M-End]
+ fakeroot ${SGDISK} -n -E -t 15:8300 -u 15:9501eade-20fb-4bc7-83d3-62c1be3ed92d -c 15:"swap" ${TEMP_FILE}
- #[13: vendor: 5107M-5891M]
- fakeroot ${SGDISK} -n 13:0:+784M -t 13:0700 -u 13:919d7080-d71a-4ae1-9227-e4585210c837 -c 13:"vendor" ${TEMP_FILE}
- #[14: reserved: 5891M-5892M]
- fakeroot ${SGDISK} -n 14:0:+1M -t 14:0700 -u 14:611eac6b-bc42-4d72-90ac-418569c8e9b8 -c 14:"reserved" ${TEMP_FILE}
+ #[8: system: 419M-5107M]
+ fakeroot ${SGDISK} -n 8:0:+58G -t 8:8300 -u 8:c3e50923-fb85-4153-b925-759614d4dfcd -c 8:"system" ${TEMP_FILE}
+ #[9: swap: 6892M-End]
+ fakeroot ${SGDISK} -n -E -t 9:8300 -u 9:9501eade-20fb-4bc7-83d3-62c1be3ed92d -c 9:"swap" ${TEMP_FILE}
;;
esac
;;
#!/bin/bash
INPUT=rootfs.btrfs.img
INPUT_DIR=/Data/hikey970
OUTPUT=hikey970.btrfs.simg
OUTPUT_DIR=/home/chris/Downloads
docker run --rm \
--volume ${INPUT_DIR}:/input \
--volume ${OUTPUT_DIR}:/output \
--env INPUT=${INPUT} \
--env OUTPUT=${OUTPUT} \
yrzr/hikey970_tools:img \
img2simg /input/${INPUT} /output/${OUTPUT}
#!/bin/bash
INPUT=leubuntu-16.04.img
INPUT_DIR=/home/chris/Downloads/Hikey970/hikey970-lebuntu-16.04
OUTPUT=lebuntu.img
OUTPUT_DIR=/Data/hikey970
docker run --rm \
--volume ${INPUT_DIR}:/input \
--volume ${OUTPUT_DIR}:/output \
--env INPUT=${INPUT} \
--env OUTPUT=${OUTPUT} \
yrzr/hikey970_tools:img \
simg2img /input/${INPUT} /output/${OUTPUT}
#!/bin/bash
docker run --rm \
-v /home/chris/git/Hikey970/hikey970-lebuntu-16.04:/root \
yrzr/hikey970_tools:img \
simg2img /root/boot-hikey970.uefi.img /root/raw-boot.img
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment