mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-25 23:13:54 +01:00
generate-boot-medium.sh: Generate (non-working) initrd
This commit is contained in:
parent
5f3d5dda81
commit
2123f01797
1 changed files with 30 additions and 7 deletions
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
myname=`basename $0`
|
myname=`basename $0`
|
||||||
cwd=`pwd`
|
cwd=`pwd`
|
||||||
boot_dir=`mktemp -d "/tmp/$myname""_XXXXXX"`
|
|
||||||
|
|
||||||
make_initrd()
|
make_initrd()
|
||||||
{
|
{
|
||||||
|
|
@ -35,7 +34,7 @@ make_initrd()
|
||||||
target_path=$dir/target/lib/modules/$uname_r/$mod_relpath
|
target_path=$dir/target/lib/modules/$uname_r/$mod_relpath
|
||||||
echo "copying $mod_name from $mod_relpath to $target_path"
|
echo "copying $mod_name from $mod_relpath to $target_path"
|
||||||
mkdir -p $target_path
|
mkdir -p $target_path
|
||||||
cp $modules_dir/$source_mod $target_path
|
cp -p $modules_dir/$source_mod $target_path
|
||||||
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
@ -68,7 +67,7 @@ name_filter()
|
||||||
|
|
||||||
#make_initrd $template $modules_dir
|
#make_initrd $template $modules_dir
|
||||||
|
|
||||||
set -- `getopt 'f:o:' $*`
|
set -- `getopt 'f:o:d:' $*`
|
||||||
|
|
||||||
while [ "$1" != -- ]; do
|
while [ "$1" != -- ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
|
|
@ -80,6 +79,11 @@ while [ "$1" != -- ]; do
|
||||||
opt_output_file="$2"
|
opt_output_file="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-d)
|
||||||
|
opt_build_dir="$2"
|
||||||
|
boot_dir="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
usage;
|
usage;
|
||||||
esac
|
esac
|
||||||
|
|
@ -87,31 +91,47 @@ while [ "$1" != -- ]; do
|
||||||
done
|
done
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
if [ ! "$opt_build_dir" ]; then
|
||||||
|
boot_dir=`mktemp -d "/tmp/$myname""_XXXXXX"`
|
||||||
|
fi
|
||||||
|
|
||||||
eval `config_section $opt_config_file global`
|
eval `config_section $opt_config_file global`
|
||||||
|
|
||||||
echo DEFAULT menu.c32 > $boot_dir/isolinux.cfg
|
echo DEFAULT menu.c32 > $boot_dir/isolinux.cfg
|
||||||
echo PROMPT 0 >> $boot_dir/isolinux.cfg
|
echo PROMPT 0 >> $boot_dir/isolinux.cfg
|
||||||
|
|
||||||
for sec in `boot_sections $opt_config_file`; do
|
for sec in `boot_sections $opt_config_file`; do
|
||||||
|
|
||||||
echo "+ processing section boot.$sec"
|
echo "+ processing section boot.$sec"
|
||||||
eval `config_section $opt_config_file boot.$sec`
|
eval `config_section $opt_config_file boot.$sec`
|
||||||
|
|
||||||
if [ "$add_boot_dir" ]; then
|
if [ "$add_boot_dir" ]; then
|
||||||
|
|
||||||
echo "+ adding boot directory $add_boot_dir"
|
echo "+ adding boot directory $add_boot_dir"
|
||||||
|
for f in $add_boot_dir/*; do
|
||||||
|
b=`basename $f`
|
||||||
|
n=`name_filter $b`
|
||||||
|
echo "+ copying $f -> $n"
|
||||||
|
cp -p $f $boot_dir/$n
|
||||||
|
done
|
||||||
|
|
||||||
kernels=`file $add_boot_dir/* | grep -ie 'linux.*kernel' | sed 's/:.*//'`
|
kernels=`file $add_boot_dir/* | grep -ie 'linux.*kernel' | sed 's/:.*//'`
|
||||||
for kernel in $kernels; do
|
for kernel in $kernels; do
|
||||||
|
|
||||||
kernel_version=`basename $kernel | sed 's/vmlinuz-//'`
|
kernel_version=`basename $kernel | sed 's/vmlinuz-//'`
|
||||||
|
kernel_version_iso=`name_filter $kernel_version | cut -b1-21`
|
||||||
|
|
||||||
echo "+ processing kernel $kernel (version $kernel_version)"
|
echo "+ processing kernel $kernel (version $kernel_version)"
|
||||||
|
|
||||||
# create initrd
|
# create initrd
|
||||||
if [ "$initrd_template" ]; then
|
if [ "$initrd_template" ]; then
|
||||||
echo "+ creating initial ram disk from template $initrd_template"
|
echo "+ creating initial ram disk from template $initrd_template"
|
||||||
make_initrd $initrd_template $add_modules_basedir/$kernel_version $kernel_version $boot_dir/initrd-$kernel_version
|
make_initrd $initrd_template $add_modules_basedir/$kernel_version $kernel_version $boot_dir/initrd_$kernel_version_iso
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create isolinux.cfg
|
# create isolinux.cfg
|
||||||
kernel_version_iso=`name_filter $kernel_version`
|
|
||||||
echo "LABEL $kernel_version" >> $boot_dir/isolinux.cfg
|
echo "LABEL $kernel_version" >> $boot_dir/isolinux.cfg
|
||||||
echo "KERNEL vmlinuz-$kernel_version_iso" >> $boot_dir/isolinux.cfg
|
echo "KERNEL vmlinuz_$kernel_version_iso" >> $boot_dir/isolinux.cfg
|
||||||
echo "APPEND initrd=initrd_$kernel_version_iso root=$root_dev" >> $boot_dir/isolinux.cfg
|
echo "APPEND initrd=initrd_$kernel_version_iso root=$root_dev" >> $boot_dir/isolinux.cfg
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
@ -124,4 +144,7 @@ mkisofs -l --iso-level 2 -o $opt_output_file \
|
||||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||||
$boot_dir
|
$boot_dir
|
||||||
|
|
||||||
rm -rf $boot_dir
|
if [ ! "$opt_build_dir" ]; then
|
||||||
|
rm -rf $boot_dir
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue