2019-12-04

next64 - tazlito - make_bzImage_hardlink() / alloc_uefi_part()


tazlito - make_bzImage_hardlink() / alloc_uefi_part()

# isolinux/syslinux first tries the '64' suffix with a 64bits cpu.

# mv vmlinuz-4.17.7-slitaz vmlinuz-4.17.7-slitaz64

ls: /mnt/next64/efi/boot/rootfs.gz: No such file or directory



1.
next64 - vmlinuz-4.17.7-slitaz


tux@slitaz:~$ file -k /media/cdrom/boot/vmlinuz-4.17.7-slitaz
/media/cdrom/boot/vmlinuz-4.17.7-slitaz: Linux kernel x86 boot executable bzImage, version 4.17.7-slitaz (root@tank) #2 SMP Sat Jul 21 03:23:55 UTC 2018, RO-rootFS, swap_dev 0x3, Normal VGA12- DOS/MBR boot sector DOS/MBR boot sector PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows12- data


2.
tux@slitaz:~$ grep -A 24 'isolinux\.conf' /usr/bin/tazlito
# isolinux.conf doesn't know the kernel version.
# We name the kernel image 'bzImage'.
# isolinux/syslinux first tries the '64' suffix with a 64bits cpu.

make_bzImage_hardlink() {
    if [   -e ${1:-.}/vmlinuz*slitaz ]; then
        rm -f ${1:-.}/bzImage 2>/dev/null
        ln    ${1:-.}/vmlinuz*slitaz ${1:-.}/bzImage
    fi
    if [   -e ${1:-.}/vmlinuz*slitaz64 ]; then
        rm -f ${1:-.}/bzImage64 2> /dev/null
        ln    ${1:-.}/vmlinuz*slitaz64 ${1:-.}/bzImage64

    fi
}

create_iso() {
    cd $2
    deduplicate

    rm -rf $2/boot/grub*
    make_bzImage_hardlink $2/boot
    alloc_uefi_part $(ls -r $2/boot/vmlinuz*slitaz*)

    cat > /tmp/cdsort$$ <<EOT
tux@slitaz:~$


3.
tux@slitaz:~$ grep -A 20 -B 2 ^alloc_uefi_part /usr/bin/tazlito
# allocate efi.img stub to share EFI files in the EFI boot partition
alloc_uefi_part()
 {
    local basedir=$(dirname "$1")/..
    local clusters=$({
    [ -d $basedir/efi ] &&
        find $basedir/efi -type f -exec stat -c "%s" {} \;
    while [ -s "$1" ]; do
        local efifile
        case "$1" in
        *taz)    efifile=bootia32.efi ;;
        *taz64) efifile=bootx64.efi ;;
        esac
        if [ ! -s $basedir/efi/boot/$efifile ] &&
           [ $(get $((0x82)) "$1") == $((0x4550)) ]; then
            stat -c "%s" "$1"
            mkdir -p $basedir/efi/boot 2> /dev/null
            ln "$1" $basedir/efi/boot/$efifile
        fi
        shift
    done; } | awk '{ n+=int(($1+2047)/2048) } END { print n }')
    [ ${clusters:-0} -eq 0 ] && return
    local dclust=$( (cd $basedir; find efi -type d 2>/dev/null) | awk '
tux@slitaz:~$


4.
vmlinuz-4.17.7-slitaz64


tux@slitaz:/home/slitaz/next64/distro$ ls -l rootcd/boot/vmlinuz*
-rw-r--r-- 2 root root 3879568 Dec 4 08:54 rootcd/boot/vmlinuz-4.17.7-slitaz64

tux@slitaz:/home/slitaz/next64/distro$ sudo tazlito gen-iso

[..]
Image is ready: slitaz-next64-1575471495.iso

tux@slitaz:/home/slitaz/next64/distro$ sudo mount -o loop slitaz-next64-1575471495.iso /mnt/next64
mount: /mnt/next64: WARNING: device write-protected, mounted read-only.

tux@slitaz:/home/slitaz/next64/distro$ ls -lR /mnt/next64
/mnt/next64:
total 12
drwxr-xr-x 3 root root 2048 Dec 4 14:58 boot
drwxr-xr-x 3 root root 2048 Dec 1 00:40 efi
-rw-r--r-- 1 root root 4922 Sep 18 22:14 index.html
-rw-r--r-- 1 root root 1191 Dec 4 14:58 md5sum
-rw-r--r-- 1 root root 811 Sep 18 22:14 README

/mnt/next64/boot:
total 102228
-rw-r--r-- 3 root root 3879568 Dec 4 08:54 bzImage64
-rw-r--r-- 1 root root 344033 Dec 4 08:57 ipxe.exe
drwxr-xr-x 2 root root 2048 Dec 4 14:58 isolinux
-rw-r--r-- 1 root root 3946 Dec 4 08:57 linld.com
-rw-r--r-- 1 root root 44920 Dec 4 08:57 memtest.exe
-rw-r--r-- 1 root root 96525470 Dec 4 08:53 rootfs.gz
-rw-r--r-- 3 root root 3879568 Dec 4 08:54 vmlinuz-4.17.7-slitaz64

/mnt/next64/boot/isolinux:
total 3957
-r--r--r-- 1 root root 2048 Dec 4 14:58 boot.cat
-rw-r--r-- 1 root root 17121 Nov 19 01:43 c32box.c32
-rw-r--r-- 1 root root 3897344 Dec 4 14:58 efi.img
-rw-r--r-- 1 root root 857 Nov 19 01:43 help.en
-rw-r--r-- 1 root root 875 Nov 19 01:43 help.fr
-rw-r--r-- 1 root root 3718 Nov 19 01:43 i18n.cfg
-rw-r--r-- 1 root root 24576 Dec 4 08:59 isolinux.bin
-rw-r--r-- 1 root root 1311 Dec 4 08:52 isolinux.cfg
-rw-r--r-- 1 root root 1436 Nov 19 01:43 kbd
-rw-r--r-- 1 root root 1000 Nov 19 01:43 opts.en
-rw-r--r-- 1 root root 1118 Nov 19 01:43 opts.fr
-rw-r--r-- 1 root root 23795 Mar 4 2018 splash.jpg
-rw-r--r-- 1 root root 74570 Nov 19 01:43 vesamenu.c32

/mnt/next64/efi:
total 2
drwxr-xr-x 2 root root 2048 Dec 4 08:59 boot

/mnt/next64/efi/boot:
total 3790
-rw-r--r-- 3 root root 3879568 Dec 4 08:54 bootx64.efi
-rw-r--r-- 1 root root 51 Dec 1 00:40 linux.cmdline



VS.


vmlinuz-4.17.7-slitaz

tux@slitaz:/home/slitaz/next64/distro$ ls -l rootcd/boot/vmlinuz*
-rw-r--r-- 3 root root 3879568 Dec 4 08:54 rootcd/boot/vmlinuz-4.17.7-slitaz

tux@slitaz:/home/slitaz/next64/distro$ sudo tazlito gen-iso

[..]
Image is ready: slitaz-next64-1575472082.iso

tux@slitaz:/home/slitaz/next64/distro$ sudo mount -o loop slitaz-next64-1575472082.iso /mnt/next64-2
mount: /mnt/next64-2: WARNING: device write-protected, mounted read-only.

tux@slitaz:/home/slitaz/next64/distro$ ls -lR /mnt/next64-2
/mnt/next64-2:
total 12
drwxr-xr-x 3 root root 2048 Dec 4 15:08 boot
drwxr-xr-x 3 root root 2048 Dec 1 00:40 efi
-rw-r--r-- 1 root root 4922 Sep 18 22:14 index.html
-rw-r--r-- 1 root root 1190 Dec 4 15:08 md5sum
-rw-r--r-- 1 root root 811 Sep 18 22:14 README

/mnt/next64-2/boot:
total 102228
-rw-r--r-- 3 root root 3879568 Dec 4 08:54 bzImage
-rw-r--r-- 1 root root 344033 Dec 4 08:57 ipxe.exe
drwxr-xr-x 2 root root 2048 Dec 4 15:08 isolinux
-rw-r--r-- 1 root root 3946 Dec 4 08:57 linld.com
-rw-r--r-- 1 root root 44920 Dec 4 08:57 memtest.exe
-rw-r--r-- 1 root root 96525470 Dec 4 08:53 rootfs.gz
-rw-r--r-- 3 root root 3879568 Dec 4 08:54 vmlinuz-4.17.7-slitaz

/mnt/next64-2/boot/isolinux:
total 3957
-r--r--r-- 1 root root 2048 Dec 4 15:08 boot.cat
-rw-r--r-- 1 root root 17121 Nov 19 01:43 c32box.c32
-rw-r--r-- 1 root root 3897344 Dec 4 15:08 efi.img
-rw-r--r-- 1 root root 857 Nov 19 01:43 help.en
-rw-r--r-- 1 root root 875 Nov 19 01:43 help.fr
-rw-r--r-- 1 root root 3718 Nov 19 01:43 i18n.cfg
-rw-r--r-- 1 root root 24576 Dec 4 15:01 isolinux.bin
-rw-r--r-- 1 root root 1311 Dec 4 08:52 isolinux.cfg
-rw-r--r-- 1 root root 1436 Nov 19 01:43 kbd
-rw-r--r-- 1 root root 1000 Nov 19 01:43 opts.en
-rw-r--r-- 1 root root 1118 Nov 19 01:43 opts.fr
-rw-r--r-- 1 root root 23795 Mar 4 2018 splash.jpg
-rw-r--r-- 1 root root 74570 Nov 19 01:43 vesamenu.c32

/mnt/next64-2/efi:
total 2
drwxr-xr-x 2 root root 2048 Dec 4 15:08 boot

/mnt/next64-2/efi/boot:
total 3790
-rw-r--r-- 3 root root 3879568 Dec 4 08:54 bootia32.efi
-rw-r--r-- 1 root root 51 Dec 1 00:40 linux.cmdline

tux@slitaz:/home/slitaz/next64/distro$


5.
tux@slitaz:/home/slitaz/next64/distro$ tazpkg -l | grep tazlito
tazlito                            492               base-system
 

tux@slitaz:/home/slitaz/next64/distro$ ls -l /mnt/next64/efi/boot/rootfs.gz
ls: /mnt/next64/efi/boot/rootfs.gz: No such file or directory

VS.

slitaz-rolling-core64.iso

tux@slitaz:/home/slitaz/next64/distro$ sudo mount -o loop ~/Downloads/slitaz-rolling-core64.iso /mnt/core64
mount: /mnt/core64: WARNING: device write-protected, mounted read-only.

tux@slitaz:/home/slitaz/next64/distro$ ls -l /mnt/core64/efi/boot
total 50626
-rw-r--r-- 3 root root 3806640 Nov 18 11:29 bootx64.efi
-rw-r--r-- 1 root root 51 Dec 1 00:40 linux.cmdline
-rw-r--r-- 2 root root 48033380 Dec 1 00:40 rootfs.gz

tux@slitaz:/home/slitaz/next64/distro$