Dash:
[t2-trunk.git] / target / share / livecd / build_initrd.sh
blob3bb50219e5279b0210accb2fc5e73400cfb5f419
1 #!/bin/bash
2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # T2 SDE: target/share/livecd/build_initrd.sh
4 # Copyright (C) 2004 - 2021 The T2 SDE Project
5 #
6 # This Copyright note is generated by scripts/Create-CopyPatch,
7 # more information can be found in the files COPYING and README.
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2.
11 # --- T2-COPYRIGHT-NOTE-END ---
13 set -e
15 [ "$boot_title" ] || boot_title="T2 @Live"
17 . $base/misc/target/initrd.in
18 . $base/misc/target/boot.in
20 cd $build_toolchain
22 # Additional initrd overlay
24 rm -rf initramfs
25 mkdir -p initramfs/{bin,sbin}
27 sed '/PANICMARK/Q' $build_root/sbin/initrdinit > initramfs/init
28 cat $base/target/share/install/init >> initramfs/init
29 cp $base/target/share/livecd/init2 initramfs/
30 chmod +x initramfs/{init,init2}
32 # For each available kernel:
34 arch_boot_cd_pre $isofsdir
35 for x in `egrep 'X .* KERNEL .*' $base/config/$config/packages |
36 cut -d ' ' -f 5`; do
37 kernel=${x/_*/}
38 for kernelver in `sed -n "s,.*boot/kconfig.,,p" $build_root/var/adm/flists/$kernel`; do
39 initrd="initrd-$kernelver"
40 kernelimg=`ls $build_root/boot/vmlinu?-$kernelver`
41 kernelimg=${kernelimg##*/}
43 cp $build_root/boot/vmlinu?-$kernelver $isofsdir/boot/
44 cp $build_root/boot/$initrd $isofsdir/boot/
45 extend_initrd $isofsdir/boot/$initrd $build_toolchain/initramfs
47 arch_boot_cd_add $isofsdir $kernelver "$boot_title" \
48 /boot/$kernelimg /boot/$initrd
49 done
50 done
52 arch_boot_cd_post $isofsdir