diff --git a/live-build/functions b/live-build/functions index 4bf85af5..53f6c1a9 100644 --- a/live-build/functions +++ b/live-build/functions @@ -767,3 +767,12 @@ is_root_layer () { fi return 1 } + +is_live_layer () { + local pass=$1 + for livepass in $LIVE_PASSES; do + [ "$livepass" != "$pass" ] && continue + return 0 + done + return 1 +} \ No newline at end of file diff --git a/live-build/lb_binary_layered b/live-build/lb_binary_layered index cf1837ed..2cf56dbb 100755 --- a/live-build/lb_binary_layered +++ b/live-build/lb_binary_layered @@ -86,6 +86,12 @@ build_layered_squashfs () { lb_binary_includes $pass ${*} lb binary_hooks ${*} + # Copy initrd and vmlinuz outside of chroot and remove them from the layer squashfs + if $(is_live_layer "$pass"); then + lb binary_linux-image ${*} + rm -f chroot/boot/initrd.img-* chroot/boot/vmlinu{x,z}-* + fi + # Full manifest until that PASS squashfs_f_manifest="${base}.manifest" create_manifest "chroot" "${squashfs_f_manifest}.full" @@ -100,25 +106,19 @@ build_layered_squashfs () { # Prepare initrd + kernel # Main manifest and size files prefix="livecd.$PROJECT${SUBARCH:+-$SUBARCH}" - if [ ! -e "${prefix}.manifest" ]; then - for livepass in $LIVE_PASSES; do - [ "$livepass" != "$pass" ] && continue - lb binary_linux-image ${*} - - totalsize=$(cat ${squashfs_f_size}) - curpass="$pass" - while :; do - curpass=$(get_parent_pass $curpass) - # We climbed up the tree to the root layer, we are done - [ -z "$curpass" ] && break - - totalsize=$(expr $totalsize + $(cat "${PWD}/livecd.${PROJECT}.${curpass}.size")) - done - echo ${totalsize} > "${prefix}.size" - - cp "${squashfs_f_manifest}.full" "${prefix}.manifest" - break + if [ ! -e "${prefix}.manifest" ] && $(is_live_layer "$pass"); then + totalsize=$(cat ${squashfs_f_size}) + curpass="$pass" + while :; do + curpass=$(get_parent_pass $curpass) + # We climbed up the tree to the root layer, we are done + [ -z "$curpass" ] && break + + totalsize=$(expr $totalsize + $(cat "${PWD}/livecd.${PROJECT}.${curpass}.size")) done + echo ${totalsize} > "${prefix}.size" + + cp "${squashfs_f_manifest}.full" "${prefix}.manifest" fi (cd "overlay.${pass}/" &&