#! /bin/bash # This script takes an unpacked s390x Live iso image in the form KIWI-NG currently creates. # # It modifies the tree to match s390x expectations. # # Usage: # # fix_bootconfig.s390x DST_DIR # # iso layout before: # . # ├── LiveOS # │   └── squashfs.img # └── boot # └── s390x # └── loader # ├── initrd # ├── isolinux.cfg # ├── isolinux.msg # └── linux # # # iso layout adjusted: # . # ├── LiveOS # │   └── squashfs.img # ├── boot # │   └── s390x # │ └── loader # │   ├── cd.ikr # │   ├── initrd # │   ├── initrd.off # │   ├── initrd.siz # │   ├── linux # │   ├── parmfile # │   ├── parmfile.hmc # │   ├── sles.exec # │   └── suse.ins # ├── suse.ins # └── susehmc.ins # set -e dst="$1" if [ ! -d "$dst" ] ; then echo "fix_bootconfig.s390x: image dir \"$dst\" not found" exit 1 fi # ---------------- # Note: # # KIWI-NG creates an iso with isolinux boot files in boot/s390x/loader. # # These files are not needed except for kernel and initrd (and kernel params from isolinux.cfg). # # This script removes the isolinux config and adds s390x related config # files. It also moves kernel and initrd to the usual location (in boot/s390x). # boot_dir=$dst/boot/s390x/loader grub_dir=$dst/boot/grub2 # Create parmfile. # # These parameters are taken from a sampel isolinux.cfg; the required parameters will # possibly change according to the KIWI config. # parmfile_content= echo "$parmfile_content" >$boot_dir/parmfile # Note on parmfile: # # Possibly s390 expects parmfile to have a maximal line length of 80 chars - but you can have several lines. # # In contrast the parmfile blob embedded in cd.ikr should have no line breaks but can be longer than 80 chars. # # Create suse.ins & cd.ikr. # # cd.ikr is an image file combining kernel and initrd; suse.ins describes its layout. # # cd.ikr is used as boot image in El-torito style cd booting. # # Offsets used for cd.ikr. initrd_ofs_ofs=0x0001040c initrd_siz_ofs=0x00010414 initrd_ofs=0x01000000 parmfile_ofs=0x00010480 # Create initrd.off (note: 32 bit, stored in big endian). printf "%08x" $((initrd_ofs)) | xxd -r -p - $boot_dir/initrd.off # Create initrd.siz (note: 32 bit, stored in big endian). read initrd_size x < <(du -b $boot_dir/initrd) printf "%08x" $((initrd_size)) | xxd -r -p - $boot_dir/initrd.siz # Create suse.ins. cat >$boot_dir/suse.ins <$dst/suse.ins <$dst/susehmc.ins <$boot_dir/parmfile.hmc # Some rexx script to ipl something... cat >$boot_dir/sles.exec <