don't modify shim and reco images at all
This commit is contained in:
parent
16000d09e2
commit
f9b3383698
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
. ./common.sh
|
||||
. ./image_utils.sh
|
||||
|
||||
print_help() {
|
||||
echo "Usage: ./build_complete.sh board_name"
|
||||
|
@ -138,6 +139,9 @@ rm -rf $final_image
|
|||
retry_cmd ./build.sh $final_image $shim_bin $rootfs_dir "quiet=$quiet"
|
||||
echo "build complete! the final disk image is located at $final_image"
|
||||
|
||||
echo "cleaning up"
|
||||
clean_loops
|
||||
|
||||
if [ "$compress_img" ]; then
|
||||
image_zip="$data_dir/shimboot_$board.zip"
|
||||
echo "compressing disk image into a zip file"
|
||||
|
|
|
@ -12,11 +12,6 @@ create_loop() {
|
|||
echo $loop_device
|
||||
}
|
||||
|
||||
#original shim rootfses have a non standard ext2 filesystem
|
||||
make_mountable() {
|
||||
printf '\000' | dd of=$1 seek=$((0x464 + 3)) conv=notrunc count=1 bs=1 status=none
|
||||
}
|
||||
|
||||
#set required flags on the kernel partition
|
||||
make_bootable() {
|
||||
cgpt add -i 2 -S 1 -T 5 -P 10 -l kernel $1
|
||||
|
@ -79,7 +74,7 @@ safe_mount() {
|
|||
rm -rf $dest
|
||||
mkdir -p $dest
|
||||
if [ "$opts" ]; then
|
||||
mount $source $dest -o $dest
|
||||
mount $source $dest -o $opts
|
||||
else
|
||||
mount $source $dest
|
||||
fi
|
||||
|
@ -151,4 +146,17 @@ patch_initramfs() {
|
|||
cp -r bootloader/* "${initramfs_path}/"
|
||||
|
||||
find ${initramfs_path}/bin -name "*" -exec chmod +x {} \;
|
||||
}
|
||||
|
||||
#clean up unused loop devices
|
||||
clean_loops() {
|
||||
local loop_devices="$(losetup -a | awk -F':' {'print $1'})"
|
||||
for loop_device in $loop_devices; do
|
||||
local mountpoints="$(cat /proc/mounts | grep "$loop_device")"
|
||||
if [ ! "$mountpoints" ]; then
|
||||
losetup -d $loop_device
|
||||
else
|
||||
echo "warning: not removing $loop_device because it is still mounted"
|
||||
fi
|
||||
done
|
||||
}
|
|
@ -67,13 +67,11 @@ reco_rootfs="/tmp/reco_rootfs"
|
|||
|
||||
echo "mounting shim"
|
||||
shim_loop=$(create_loop "${shim_path}")
|
||||
make_mountable "${shim_loop}p3"
|
||||
safe_mount "${shim_loop}p3" $shim_rootfs
|
||||
safe_mount "${shim_loop}p3" $shim_rootfs ro
|
||||
|
||||
echo "mounting recovery image"
|
||||
reco_loop=$(create_loop "${reco_path}")
|
||||
make_mountable "${reco_loop}p3"
|
||||
safe_mount "${reco_loop}p3" $reco_rootfs
|
||||
safe_mount "${reco_loop}p3" $reco_rootfs ro
|
||||
|
||||
echo "copying modules to rootfs"
|
||||
copy_modules $shim_rootfs $reco_rootfs $target_rootfs
|
||||
|
|
Loading…
Reference in New Issue