[Desire 626 Android Development] BigCountry907:
Packing The Kernel Into Boot.img

First lets backup our kernel config files.

mkdir ~/a32e-kernel-build/Device-Files/Configs
cp -f ~/android/device/a32e/.config ~/a32e-kernel-build/Device-Files/Configs
cp -f ~/android/device/a32e/.config.old ~/a32e-kernel-build/Device-Files/Configs
cp -f ~/android/device/a32e/arch/arm/configs/Big-Country_defconfig ~/a32e-kernel-build/Device-Files/Configs

Now lets copy all the modules and kernel z-image we built.

mkdir ~/a32e-kernel-build/Device-Files/zimage
mkdir ~/a32e-kernel-build/Device-Files/modules
cp -f ~/android/device/a32e/arch/arm/boot/zImage ~/a32e-kernel-build/Device-Files/zimage/kernel
cp -f ~/android/device/a32e/arch/arm/boot/zImage-dtb ~/a32e-kernel-build/Device-Files/
shopt -s globstar
cp **/*.ko ~/a32e-kernel-build/Device-Files/modules/

Compare the new kernel version to the original version.

cd ~/a32e-kernel-build/Device-Files/zimage
dd if=kernel bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' kernel | cut -d ':' -f 1) | zgrep -a 'Linux version'

cd ~/a32e-kernel-build/Device-Files/Boot/
dd if=kernel bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' kernel | cut -d ':' -f 1) | zgrep -a 'Linux version'

Output Comparison On My System

bigcountry@bigcountry-G551JW:~/a32e-kernel-build/Device-Files$ cd ~/a32e-kernel-build/Device-Files/zimage

bigcountry@bigcountry-G551JW:~/a32e-kernel-build/Device-Files/zimage$ dd if=kernel bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' kernel | cut -d ':' -f 1) | zgrep -a 'Linux version'

Linux version 3.10.49-perf-g26c2269 (bigcountry@bigcountry-G551JW) (gcc version 4.8 (GCC) ) #1 SMP PREEMPT Sat Oct 1 11:53:51 EDT 2016

7162737+0 records in

7162737+0 records out

7162737 bytes (7.2 MB, 6.8 MiB) copied, 5.16669 s, 1.4 MB/s

bigcountry@bigcountry-G551JW:~/a32e-kernel-build/Device-Files/zimage$ cd ~/a32e-kernel-build/Device-Files/Boot/

bigcountry@bigcountry-G551JW:~/a32e-kernel-build/Device-Files/Boot$ dd if=kernel bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' kernel | cut -d ':' -f 1) | zgrep -a 'Linux version'

Linux version 3.10.49-perf-g26c2269 (and@AABM) (gcc version 4.7 (GCC) ) #2 SMP PREEMPT Sat Oct 31 02:40:46 CST 2015

7202505+0 records in

7202505+0 records out

7202505 bytes (7.2 MB, 6.9 MiB) copied, 4.70855 s, 1.5 MB/s

bigcountry@bigcountry-G551JW:~/a32e-kernel-build/Device-Files/Boot$

Linux version 3.10.49-perf-g26c2269 (bigcountry@bigcountry-G551JW) (gcc version 4.8 (GCC) ) #1 SMP PREEMPT Sat Oct 1 11:53:51 EDT 2016

Linux version 3.10.49-perf-g26c2269 (and@AABM) (gcc version 4.7 (GCC) ) #2 SMP PREEMPT Sat Oct 31 02:40:46 CST 2015

Linux version 3.10.49-perf-g26c2269 MATCHES.

Repack the Boot Image.

For now we are just using the original ramdisk and original dt.img.

Later on we will make some changes and then repack.

Were just making sure things boot first.

We have to do this as root.

sudo

Copy all files needed to AIK Linux for Repacking.

sudo cp -r ~/a32e-kernel-build/Device-Files/Boot/ramdisk ~/a32e-kernel-build/Tools/AIK-Linux/ramdisk
sudo cp -r ~/a32e-kernel-build/Device-Files/Boot/split_img ~/a32e-kernel-build/Tools/AIK-Linux/split_img
sudo cp -f ~/android/device/a32e/arch/arm/boot/zImage ~/a32e-kernel-build/Tools/AIK-Linux/split_img/Boot.img-zImage

Repack the Boot.img.

cd ~/a32e-kernel-build/Tools/AIK-Linux
sudo ./repackimg.sh

Yaaayyyy Now we have a boot.img we can flash. (For Testing / Developing Only)

Copy the boot image to our project.

mkdir ~/a32e-kernel-build/Device-Files/New-Boot
sudo cp -f ~/a32e-kernel-build/Tools/AIK-Linux/image-new.img ~/a32e-kernel-build/Device-Files/New-Boot/image-new.img