tiny-slitaz rev 36

helper: boot bootsector files
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Sep 24 17:55:26 2023 +0000 (7 months ago)
parents 798a84e27cc9
children db2cc84a8917
files README.md helper step1.php step5.php
line diff
     1.1 --- a/README.md	Tue Jul 13 15:37:38 2021 +0000
     1.2 +++ b/README.md	Sun Sep 24 17:55:26 2023 +0000
     1.3 @@ -20,7 +20,7 @@
     1.4  
     1.5  ## How is it built?
     1.6  
     1.7 -Tiny SliTaz uses a Linux Kernel with an embedded filesystem. An extra initramfs
     1.8 +Tiny SliTaz uses a Linux Kernel and a root ram filesystem. An extra initramfs
     1.9  can also be loaded with the configuration files and extra packages.
    1.10  
    1.11  The initramfs is based on [uClibc](http://uclibc.org/) (instead of glibc) and
     2.1 --- a/helper	Tue Jul 13 15:37:38 2021 +0000
     2.2 +++ b/helper	Sun Sep 24 17:55:26 2023 +0000
     2.3 @@ -221,6 +221,7 @@
     2.4  	[ -s $pkg ] || pkg=$TMPDIR/pkgs/$1/receipt
     2.5  	[ -s $pkg ] || pkg=$(get_receipt $@)
     2.6  	SUGGESTED=
     2.7 +	TARGET=i486
     2.8  	. $pkg
     2.9  	SUGG=
    2.10  	for i in $SUGGESTED; do
    2.11 @@ -444,14 +445,16 @@
    2.12  {
    2.13  	n=$(unlzma < $1 | wc -c)
    2.14  	for i in $(seq 1 8); do
    2.15 -		printf '\\\\x%02X' $(($n & 255))
    2.16 -		n=$(($n >> 8))
    2.17 +		printf '\\\\x%02X' $((n & 255))
    2.18 +		n=$((n >> 8))
    2.19  	done | xargs echo -en | dd of=$1 conv=notrunc bs=1 seek=5 2> /dev/null
    2.20  }
    2.21  
    2.22  
    2.23  compressto()
    2.24  {
    2.25 +	[ "$2" == "rootfs" ] && [ -s $tmp/fs/boot/compress_rootfs ] &&
    2.26 +		sh $tmp/fs/boot/compress_rootfs $1 && return
    2.27  	[ "$(which zopfli 2> /dev/null)" ] &&
    2.28  	zopfli --i100 -c /dev/stdin > $1 || gzip -9 > $1
    2.29  	[ "$(which advdef 2> /dev/null)" ] && advdef -z4 $1 > /dev/null
    2.30 @@ -482,21 +485,22 @@
    2.31  	tmp=$2
    2.32  	cd $tmp/fs
    2.33  	[ -s boot/mkrootfs.pre_exec ] && sh boot/mkrootfs.pre_exec
    2.34 -	if [ ! -d boot -a -s ../kernel ]; then # custom kernel
    2.35 +	if [ ! -d boot ] && [ -s ../kernel ]; then # custom kernel
    2.36  		mkdir boot
    2.37  		cp ../kernel boot/bzImage
    2.38  	fi
    2.39 -	find -user bellard -exec chown root.root {} \;
    2.40 -	find | grep -v ^./boot | cpio -o -H newc | compressto ../rootfs.gz
    2.41 +	find . -user bellard -exec chown root.root {} \;
    2.42 +	find . -exec touch {} \;
    2.43 +	find . | grep -v ^./boot | cpio -o -H newc | compressto ../rootfs.gz rootfs
    2.44  fi
    2.45  if [ "x$1" = "x--mkiso" ]; then
    2.46  	tmp=$2
    2.47  	mkdir -p $tmp/iso/boot/isolinux $tmp/iso/data
    2.48 -	cat $tmp/fs/boot/System.map | compressto $tmp/iso/data/sysmap.gz
    2.49 -	cat $tmp/fs/boot/config | compressto $tmp/iso/data/linconf.gz
    2.50 -	cat $tmp/fs/boot/config-busybox | compressto $tmp/iso/data/bbconf.gz
    2.51 +	compressto $tmp/iso/data/sysmap.gz < $tmp/fs/boot/System.map
    2.52 +	compressto $tmp/iso/data/linconf.gz < $tmp/fs/boot/config
    2.53 +	compressto $tmp/iso/data/bbconf.gz < $tmp/fs/boot/config-busybox
    2.54  	cp $tmp/fs/boot/bundle $tmp/iso/data/bundle.sh
    2.55 -	cat $tmp/post_install.log | compressto $tmp/iso/data/log.gz
    2.56 +	compressto $tmp/iso/data/log.gz < $tmp/post_install.log
    2.57  	cp $tmp/config_files $tmp/iso/data/files.cnf
    2.58  	cp $tmp/fs/etc/packages.conf $tmp/iso/data/packages.cnf
    2.59  	[ -s wok/busybox/receipt ] && tar czf $tmp/iso/data/wok.tgz wok/*
    2.60 @@ -514,9 +518,11 @@
    2.61  		keys=${keys#*,}
    2.62  		KEY="$KEY ${keys%%,*}"
    2.63  		cp $tmp/fs/boot/$bin $tmp/iso/boot/$bin
    2.64 +		kernel=kernel
    2.65 +		[ $(stat -c %s $tmp/fs/boot/$bin) -eq 512 ] && kernel=boot
    2.66  		cat >> $tmp/iso/boot/isolinux/isolinux.cfg <<EOT
    2.67  label ${keys//,/ } $bin
    2.68 -	kernel /boot/$bin
    2.69 +	$kernel /boot/$bin
    2.70  
    2.71  EOT
    2.72  	done < $tmp/fs/boot/bootmenu
     3.1 --- a/step1.php	Tue Jul 13 15:37:38 2021 +0000
     3.2 +++ b/step1.php	Sun Sep 24 17:55:26 2023 +0000
     3.3 @@ -111,9 +111,7 @@
     3.4  	}
     3.5  ?>
     3.6  
     3.7 -<p id="kernel">You can upload a custom Kernel or use an official one. Your
     3.8 -Kernel should have an embedded initramfs with busybox like <a
     3.9 -href="dist/rootfs.cpio" title="See CONFIG_INITRAMFS_SOURCE">this</a>.</p>
    3.10 +<p id="kernel">You can upload a custom Kernel or use an official one.</p>
    3.11  
    3.12  <div>
    3.13  	<form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
     4.1 --- a/step5.php	Tue Jul 13 15:37:38 2021 +0000
     4.2 +++ b/step5.php	Sun Sep 24 17:55:26 2023 +0000
     4.3 @@ -53,9 +53,10 @@
     4.4  		<input name="download" value="DOS/EXE" type="submit"
     4.5  		       title="<?php echo $title; ?>" />
     4.6  <?php if (file_exists("/boot/isolinux/isolinux.bin")) {
     4.7 -	  $title="Can be burnt on to a CD-ROM or written on to a USB Key / memory card";
     4.8 +	  $title="Can be burned on to a CD-ROM or written on to a USB Key / memory card";
     4.9  	  if (file_exists("/usr/bin/iso2exe"))
    4.10 -	  	$title .= ", or renamed with the .exe suffix and run with DOS or Windows";
    4.11 +	  	$title .= ", 
    4.12 +or renamed with the .exe suffix and run with DOS or Windows";
    4.13  	   ?>
    4.14  		<input name="download" value="ISO image" type="submit"
    4.15  		       title="<?php echo $title; ?>" />
    4.16 @@ -66,10 +67,9 @@
    4.17  	<tr><td class="first">Files for bootloaders:</td><td>
    4.18  
    4.19  		<input name="download" value="Kernel (<?php echo show_size("fs/boot/bzImage");
    4.20 -			 ?>)" title="A bzImage with a basic embbeded initramfs.
    4.21 -Can boot from floppy or DOS in real mode." type="submit" />
    4.22 +			 ?>)" title="This bzImage can boot from floppy or DOS in real mode." type="submit" />
    4.23  		<input name="download" value="Rootfs (<?php echo show_size("rootfs.gz");
    4.24 -			 ?>)" title="Extra initramfs for the initrd= parameter" type="submit" />
    4.25 +			 ?>)" title="Initramfs for the initrd= parameter" type="submit" />
    4.26  <?php echo shell_exec("sudo ./helper --boot-files ".$_POST['tmp_dir']); ?>
    4.27  	</td></tr>
    4.28