Bug#818916: live-build: Wrong version extracted from os-release in binary-syslinux

2016-03-21 Thread adrian15

Package: live-build
Version: 5.0~a11-1
Severity: minor

Dear Maintainer,

   * What led up to the situation?

I was trying to use @VERSION@ string in splash.svg.

   * What exactly did you do (or not do) that was effective (or
 ineffective)?
I used @VERSION@ string in splash.svg.
   * What was the outcome of this action?
@VERSION@ was replaced by: 5.0~a11-1 which it's the live-build package 
version.

   * What outcome did you expect instead?
@VERSION@ should have been replaced by: 8 (The version read from 
os-release for

my build) which it's the distro, in this case Debian, version.

Additional information. I attach a trivial patch which solves the problem.


-- System Information:
Debian Release: 8.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
>From b516d2defaeda72a03400dbd1a17b91d6bca7e31 Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Mon, 21 Mar 2016 18:44:38 +0100
Subject: [PATCH] @VERSION@ now its equal to VERSION_ID variable. Fixes a typo.

---
 scripts/build/binary_syslinux | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/build/binary_syslinux b/scripts/build/binary_syslinux
index 024b563..66c14a0 100755
--- a/scripts/build/binary_syslinux
+++ b/scripts/build/binary_syslinux
@@ -248,7 +248,7 @@ then
 	_VERSION="$(. chroot/etc/os-release && echo ${VERSION_ID})"
 fi
 
-_VERSION="${VERSION:-none}"
+_VERSION="${_VERSION:-none}"
 
 _DISTRIBUTION="${LB_DISTRIBUTION}"
 _ARCHITECTURE="${LB_ARCHITECTURES}"
-- 
2.1.4



Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-03-21 Thread adrian15

This is my updated set of patches.

Changes since last set of patches:

* Renamed primary and secondary to first and extra terms.
* Forced insmod all_video command in grub.cfg to avoid problems in UEFI 
mode.

* Minor changes

Rescatux 0.40b6 which I will release soon will feature this branch which 
include these changes:


https://github.com/rescatux/live-build/tree/rescatux-0.40b6

.

The branch which include specifically the commits I attach here as 
patches is:


https://github.com/rescatux/live-build/tree/efi_support_based_on_debian_cd_rebased_5

.

About the variable names issue: I think the new terms: first and extra 
are ok because they are not implying some sort of rank while explaining 
what's the difference between them. Also, notice, that these are 
internal variables which final user of live-build does not see. I think 
we should focus on other aspects of my patch if there are more problems 
for it.


If you think that the way bootloaders is currently managed by live-build 
is wrong please file up a new bug and send there your patch with your 
improvements so that it's get discussed.


Then, if it gets approved I can improve my patch over yours.

My patch tries to make the minimum improvements so that other live-build 
functionality does not get affected by it.


Let's please focus on getting this set of patches accepted. Don't get me 
wrong I'm not asking for a carte blanche but, let's focus on other 
aspects from the patch. (E.g. please test it on actual hardware, in your 
distro builds, even if you don't use UEFI does the ISO boot as always in 
BIOS mode?) And give us feedback on it.


Thank you.

adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/
>From ff8206aea1985760dfea9ec94b93686a242f137e Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Mon, 18 Jan 2016 03:04:00 +
Subject: [PATCH 01/10] functions/default.sh : Define LB_PRIMARY_BOOTLOADER at
 the Set_defaults function which it's the right place where to do it

---
 functions/defaults.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/functions/defaults.sh b/functions/defaults.sh
index ddf4b19..334984f 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -537,6 +537,8 @@ Set_defaults ()
 		esac
 	fi
 
+	LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
+
 	# Setting checksums
 	case "${LB_MODE}" in
 		progress-linux)
@@ -845,9 +847,6 @@ Check_defaults ()
 		fi
 	fi
 
-
-	LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 	if [ "${LB_PRIMARY_BOOTLOADER}" = "syslinux" ]
 	then
 		# syslinux + fat or ntfs, or extlinux + ext[234] or btrfs
-- 
2.1.4

>From f895f653dffb614639fa37a318e62c51104a4b2d Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Wed, 20 Jan 2016 00:53:53 +0100
Subject: [PATCH 02/10] Remove repeated LB_PRIMARY_BOOTLOADER definition

---
 scripts/build/binary_hdd | 2 --
 scripts/build/binary_iso | 2 --
 2 files changed, 4 deletions(-)

diff --git a/scripts/build/binary_hdd b/scripts/build/binary_hdd
index d0db382..0c9c5af 100755
--- a/scripts/build/binary_hdd
+++ b/scripts/build/binary_hdd
@@ -67,8 +67,6 @@ do
 	esac
 done
 
-LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 case ${LB_PRIMARY_BOOTLOADER} in
 		syslinux)
 			case ${LB_BINARY_FILESYSTEM} in
diff --git a/scripts/build/binary_iso b/scripts/build/binary_iso
index d8b1553..67dfc85 100755
--- a/scripts/build/binary_iso
+++ b/scripts/build/binary_iso
@@ -107,8 +107,6 @@ then
 	XORRISO_OPTIONS="${XORRISO_OPTIONS} -V \"${LB_ISO_VOLUME}\""
 fi
 
-LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 # Handle xorriso architecture specific options
 case "${LB_PRIMARY_BOOTLOADER}" in
 	grub)
-- 
2.1.4

>From 9175a624b7d88bfea80448a5a1e6ac1b11d651aa Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Mon, 18 Jan 2016 03:07:48 +
Subject: [PATCH 03/10] * Added: functions/bootloaders.sh . It has new
 bootloader functions that are heavily used in efi scenarios where a
 bootloader can act as a primary or a secondary bootloader.

Since the introduction of the new switch:

--bootloaders

you can setup it like this:

--bootloaders=syslinux,grub-efi

.

This means that syslinux is the primary bootloader and grub-efi is the secondary bootloader.

* Added new bootloader functions: Check_Non_Primary_Bootloader and Check_Non_Secondary_Bootloader.

These functions let each one of the bootloaders abort the build because
they cannot perform a role either as a primary bootloader or as a secondary bootloader.

* Added bootloader functions: Check_Primary_Bootloader_Role, Check_Secondary_Bootloader_Role and Check_Any_Bootloader_Role

Thes

Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-03-21 Thread adrian15

El 21/03/16 a las 22:19, Michal Suchanek escribió:

Hello,

On 21 March 2016 at 21:09, adrian15  wrote:



The branch which include specifically the commits I attach here as patches
is:

https://github.com/rescatux/live-build/tree/efi_support_based_on_debian_cd_rebased_5

.

About the variable names issue: I think the new terms: first and extra are
ok because they are not implying some sort of rank while explaining what's
the difference between them. Also, notice, that these are internal variables
which final user of live-build does not see. I think we should focus on
other aspects of my patch if there are more problems for it.


The problem is not with the name of the variable.

The problem is that you use it at all. In most places when you check
for primary or secondary bootloader you should just loop all
bootloaders and check each. In fact, in the previous batch of patches
I found no place where checking for primary or secondary bootloader
made any sense.



If you think that the way bootloaders is currently managed by live-build is
wrong please file up a new bug and send there your patch with your
improvements so that it's get discussed.


The bootloader support in live-build is limited. With your patches it
becomes wrong. eg. compatibility of bootloader with selected
filesystem and image type is only checked for first bootloader and EFI
support is added only when grub-efi extra bootloader but not when it
is the first bootloader.

This is not fixed by renaming the variables.


Ok. So I recognise that my patch:

* Adds a limited support of UEFI only available when it's used as an 
extra bootloader
* Does not check compatibility with selected filesystem in the extra 
bootloader because it blindly relies on selected filesystem selected in 
first bootloader being compatible with the extra bootloader too.

* It does not work for hdd binaries (only iso binaries)

and it does in addition to what live-build already did.

I also think that my patch does not remove the current live-build 
functionality and if that happens I want to know about it.


Yes, my patch does not bring UEFI complete support, but a minimal one. 
So according to you the many changes I make on the bootloader functions 
do not compensate the minimal UEFI support I add to live-build?


Thank you.

adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/




Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-03-21 Thread adrian15

El 21/03/16 a las 22:19, Michal Suchanek escribió:

Hello,

On 21 March 2016 at 21:09, adrian15  wrote:



The branch which include specifically the commits I attach here as patches
is:

https://github.com/rescatux/live-build/tree/efi_support_based_on_debian_cd_rebased_5

.

About the variable names issue: I think the new terms: first and extra are
ok because they are not implying some sort of rank while explaining what's
the difference between them. Also, notice, that these are internal variables
which final user of live-build does not see. I think we should focus on
other aspects of my patch if there are more problems for it.


The problem is not with the name of the variable.

The problem is that you use it at all. In most places when you check
for primary or secondary bootloader you should just loop all
bootloaders and check each. In fact, in the previous batch of patches
I found no place where checking for primary or secondary bootloader
made any sense.



If you think that the way bootloaders is currently managed by live-build is
wrong please file up a new bug and send there your patch with your
improvements so that it's get discussed.


The bootloader support in live-build is limited. With your patches it
becomes wrong. eg. compatibility of bootloader with selected
filesystem and image type is only checked for first bootloader and EFI
support is added only when grub-efi extra bootloader but not when it
is the first bootloader.

This is not fixed by renaming the variables.

Thanks

Michal


Ok, what about now? Actually from my former email I only added one 
additional patch (0011) with some sort of modular support for bootloaders.


There probably needs some work to be done on binary_hdd but I first 
wanted to gather information on what to improve on this last patch.



https://github.com/rescatux/live-build/tree/efi_support_based_on_debian_cd_rebased_6


adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/
>From ff8206aea1985760dfea9ec94b93686a242f137e Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Mon, 18 Jan 2016 03:04:00 +
Subject: [PATCH 01/11] functions/default.sh : Define LB_PRIMARY_BOOTLOADER at
 the Set_defaults function which it's the right place where to do it

---
 functions/defaults.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/functions/defaults.sh b/functions/defaults.sh
index ddf4b19..334984f 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -537,6 +537,8 @@ Set_defaults ()
 		esac
 	fi
 
+	LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
+
 	# Setting checksums
 	case "${LB_MODE}" in
 		progress-linux)
@@ -845,9 +847,6 @@ Check_defaults ()
 		fi
 	fi
 
-
-	LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 	if [ "${LB_PRIMARY_BOOTLOADER}" = "syslinux" ]
 	then
 		# syslinux + fat or ntfs, or extlinux + ext[234] or btrfs
-- 
2.1.4

>From f895f653dffb614639fa37a318e62c51104a4b2d Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Wed, 20 Jan 2016 00:53:53 +0100
Subject: [PATCH 02/11] Remove repeated LB_PRIMARY_BOOTLOADER definition

---
 scripts/build/binary_hdd | 2 --
 scripts/build/binary_iso | 2 --
 2 files changed, 4 deletions(-)

diff --git a/scripts/build/binary_hdd b/scripts/build/binary_hdd
index d0db382..0c9c5af 100755
--- a/scripts/build/binary_hdd
+++ b/scripts/build/binary_hdd
@@ -67,8 +67,6 @@ do
 	esac
 done
 
-LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 case ${LB_PRIMARY_BOOTLOADER} in
 		syslinux)
 			case ${LB_BINARY_FILESYSTEM} in
diff --git a/scripts/build/binary_iso b/scripts/build/binary_iso
index d8b1553..67dfc85 100755
--- a/scripts/build/binary_iso
+++ b/scripts/build/binary_iso
@@ -107,8 +107,6 @@ then
 	XORRISO_OPTIONS="${XORRISO_OPTIONS} -V \"${LB_ISO_VOLUME}\""
 fi
 
-LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 # Handle xorriso architecture specific options
 case "${LB_PRIMARY_BOOTLOADER}" in
 	grub)
-- 
2.1.4

>From 9175a624b7d88bfea80448a5a1e6ac1b11d651aa Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Mon, 18 Jan 2016 03:07:48 +
Subject: [PATCH 03/11] * Added: functions/bootloaders.sh . It has new
 bootloader functions that are heavily used in efi scenarios where a
 bootloader can act as a primary or a secondary bootloader.

Since the introduction of the new switch:

--bootloaders

you can setup it like this:

--bootloaders=syslinux,grub-efi

.

This means that syslinux is the primary bootloader and grub-efi is the secondary bootloader.

* Added new bootloader functions: Check_Non_Primary_Bootloader and Check_Non_Secondary_Bootloader.

These functions let each one of the bootloaders abort th

Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-07-31 Thread adrian15
This new update tries to implement actual support for multiple 
bootloaders. It only enforces grub-legacy not to be an extra bootloader 
because it's current implementation in binary-iso is not compatible 
(without hacking) with multiple bootloaders.



* Branch were I added these last improvement / fixes: 
https://github.com/rescatux/live-build/tree/efi_support_based_on_debian_cd_michal
* Final rebased branched: 
https://github.com/rescatux/live-build/tree/efi_support_based_on_debian_cd_rebased_7



Rescatux 0.40 beta 7 has been built with 
efi_support_based_on_debian_cd_rebased_7 branch
and can be found here: 
http://www.supergrubdisk.org/2016/07/31/rescatux-0-40-beta-7-released/ .


As always feedback is welcome.

El 22/03/16 a las 07:18, Michal Suchanek escribió:

On 21 March 2016 at 23:06, adrian15  wrote:

El 21/03/16 a las 22:19, Michal Suchanek escribió:

So please consider either

1) fixing your current patch so there is no primary or first
bootloader and all installed bootloaders are equal

2) don't pretend you add support for multiple bootloaders when you are
not wiling to do so and just and some option like --bolt-on-grub-efi
which installs grub-efi if image type and filesystem is compatible
with grub-efi and fails the build otherwise

BTW it has been pointed out already that -eltorito-alt-boot is just
separator that starts new boot entry so there are no special
secondary/extra bootloader options. Any bootloader can be
first/second/third/whatever.

Thanks

Michal



--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/
>From 723661c38b48d0617c5c660ea140edfaef4699ce Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Mon, 18 Jan 2016 03:04:00 +
Subject: [PATCH 01/13] functions/default.sh : Define LB_PRIMARY_BOOTLOADER at
 the Set_defaults function which it's the right place where to do it

---
 functions/defaults.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/functions/defaults.sh b/functions/defaults.sh
index ddf4b19..334984f 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -537,6 +537,8 @@ Set_defaults ()
 		esac
 	fi
 
+	LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
+
 	# Setting checksums
 	case "${LB_MODE}" in
 		progress-linux)
@@ -845,9 +847,6 @@ Check_defaults ()
 		fi
 	fi
 
-
-	LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 	if [ "${LB_PRIMARY_BOOTLOADER}" = "syslinux" ]
 	then
 		# syslinux + fat or ntfs, or extlinux + ext[234] or btrfs
-- 
2.1.4

>From a506c9c03d61f9c09d816a9e24285c599c9bacdf Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Wed, 20 Jan 2016 00:53:53 +0100
Subject: [PATCH 02/13] Remove repeated LB_PRIMARY_BOOTLOADER definition

---
 scripts/build/binary_hdd | 2 --
 scripts/build/binary_iso | 2 --
 2 files changed, 4 deletions(-)

diff --git a/scripts/build/binary_hdd b/scripts/build/binary_hdd
index 407901a..b45b2a9 100755
--- a/scripts/build/binary_hdd
+++ b/scripts/build/binary_hdd
@@ -67,8 +67,6 @@ do
 	esac
 done
 
-LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 case ${LB_PRIMARY_BOOTLOADER} in
 		syslinux)
 			case ${LB_BINARY_FILESYSTEM} in
diff --git a/scripts/build/binary_iso b/scripts/build/binary_iso
index d8b1553..67dfc85 100755
--- a/scripts/build/binary_iso
+++ b/scripts/build/binary_iso
@@ -107,8 +107,6 @@ then
 	XORRISO_OPTIONS="${XORRISO_OPTIONS} -V \"${LB_ISO_VOLUME}\""
 fi
 
-LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 # Handle xorriso architecture specific options
 case "${LB_PRIMARY_BOOTLOADER}" in
 	grub)
-- 
2.1.4

>From 06ad8acdc81e6bc2b460954bae57191ddb7d238a Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Mon, 18 Jan 2016 03:07:48 +
Subject: [PATCH 03/13] * Added: functions/bootloaders.sh . It has new
 bootloader functions that are heavily used in efi scenarios where a
 bootloader can act as a primary or a secondary bootloader.

Since the introduction of the new switch:

--bootloaders

you can setup it like this:

--bootloaders=syslinux,grub-efi

.

This means that syslinux is the primary bootloader and grub-efi is the secondary bootloader.

* Added new bootloader functions: Check_Non_Primary_Bootloader and Check_Non_Secondary_Bootloader.

These functions let each one of the bootloaders abort the build because
they cannot perform a role either as a primary bootloader or as a secondary bootloader.

* Added bootloader functions: Check_Primary_Bootloader_Role, Check_Secondary_Bootloader_Role and Check_Any_Bootloader_Role

These functions let bootloaders to force their default role in a single line.
---
 functions/bootloaders.sh | 128 +++
 1 file changed,

Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-07-31 Thread adrian15
1) I'm glad Michal finally agrees with the overall implementation of 
multi bootloaders support.


2)

I have squashed some commits were it made sense.
I have fixed some commits descriptions.
I have removed a whitespace.

Here's the new rebased branch:

https://github.com/rescatux/live-build/tree/efi_support_based_on_debian_cd_rebased_9

git diff betweenefi_support_based_on_debian_cd_rebased_7 and 
efi_support_based_on_debian_cd_rebased_9 shows only a whitespace as a 
difference, so I have not even bothered to test this new branch.


3) wCPO from debian-live irc is willing to pull it.

Is there anyone else than can provide feedback on this patch / branch?

Either by:

* Installing live-build with this applied patch
* Building your iso and check if it boots in both BIOS and UEFI mode.
* Check non usual UEFI machines.

I suspect it's fine to wait for one week for feedback.
After that time I'll try to request a proper pull / insertion into 
Debian's live-build repo and probably into live-build package binaries.


adrian15

El 31/07/16 a las 10:12, Michal Suchanek escribió:

Hello,

On 31 July 2016 at 09:35, adrian15  wrote:

This new update tries to implement actual support for multiple bootloaders.
It only enforces grub-legacy not to be an extra bootloader because it's
current implementation in binary-iso is not compatible (without hacking)
with multiple bootloaders.


* Branch were I added these last improvement / fixes:
https://github.com/rescatux/live-build/tree/efi_support_based_on_debian_cd_michal
* Final rebased branched:
https://github.com/rescatux/live-build/tree/efi_support_based_on_debian_cd_rebased_7


I skimmed through this final rebased branch and it looks generally good.

I would suggest removing the unrelated whitespace changes and
squashing commits that
rewrite new code with commits introducing said code.

I have no idea who can pull this so it can be released in Debian.

Thanks

Michal



--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/
>From 01a9df8ce325c5df9762f0db86128614b4d3476c Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Mon, 18 Jan 2016 03:04:00 +
Subject: [PATCH 01/10] functions/default.sh : Define LB_PRIMARY_BOOTLOADER at
 the Set_defaults function which it's the right place where to do it

---
 functions/defaults.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/functions/defaults.sh b/functions/defaults.sh
index ddf4b19..334984f 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -537,6 +537,8 @@ Set_defaults ()
 		esac
 	fi
 
+	LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
+
 	# Setting checksums
 	case "${LB_MODE}" in
 		progress-linux)
@@ -845,9 +847,6 @@ Check_defaults ()
 		fi
 	fi
 
-
-	LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 	if [ "${LB_PRIMARY_BOOTLOADER}" = "syslinux" ]
 	then
 		# syslinux + fat or ntfs, or extlinux + ext[234] or btrfs
-- 
2.1.4

>From 0624064d44ed811aec5c43fabfd7b928688ed8e1 Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Wed, 20 Jan 2016 00:53:53 +0100
Subject: [PATCH 02/10] Remove repeated LB_PRIMARY_BOOTLOADER definition

---
 scripts/build/binary_hdd | 2 --
 scripts/build/binary_iso | 2 --
 2 files changed, 4 deletions(-)

diff --git a/scripts/build/binary_hdd b/scripts/build/binary_hdd
index 407901a..b45b2a9 100755
--- a/scripts/build/binary_hdd
+++ b/scripts/build/binary_hdd
@@ -67,8 +67,6 @@ do
 	esac
 done
 
-LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 case ${LB_PRIMARY_BOOTLOADER} in
 		syslinux)
 			case ${LB_BINARY_FILESYSTEM} in
diff --git a/scripts/build/binary_iso b/scripts/build/binary_iso
index d8b1553..67dfc85 100755
--- a/scripts/build/binary_iso
+++ b/scripts/build/binary_iso
@@ -107,8 +107,6 @@ then
 	XORRISO_OPTIONS="${XORRISO_OPTIONS} -V \"${LB_ISO_VOLUME}\""
 fi
 
-LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 # Handle xorriso architecture specific options
 case "${LB_PRIMARY_BOOTLOADER}" in
 	grub)
-- 
2.1.4

>From 9d1a983cc8fe12966d1a2c24a6ee0cfb419b3ce5 Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Mon, 18 Jan 2016 03:07:48 +
Subject: [PATCH 03/10] Added new multi bootloader helper functions * Added:
 functions/bootloaders.sh . This file adds bootloader functions that are
 heavily used in efi scenarios where a bootloader can act as a first or an
 extra bootloader.

Since the introduction of the new switch:

--bootloaders

you can setup it like this:

--bootloaders=syslinux,grub-efi

.

This means that syslinux is the first bootloader and grub-efi is the extra bootloader.

* Added new bootloader functions: Check_Non_First_Bootloader an

Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-08-08 Thread adrian15

El 04/08/16 a las 14:51, Raphael Hertzog escribió:

Hi,

On Sun, 31 Jul 2016, adrian15 wrote:

Is there anyone else than can provide feedback on this patch / branch?

Either by:

* Installing live-build with this applied patch
* Building your iso and check if it boots in both BIOS and UEFI mode.
* Check non usual UEFI machines.

I suspect it's fine to wait for one week for feedback.
After that time I'll try to request a proper pull / insertion into Debian's
live-build repo and probably into live-build package binaries.


I can give a try to your patchset but I'm currently in vacation so it
would not be before the third week of August.

This is just FYI but you don't have to wait on my feedback to get your
work merged if people are happy with it.

Cheers,


I have CCed Kristian Klausen whom it's willing to pull/push my patches.

By the way my patches are aimed at master branch. Not sure if the 
current protocol allows to add new changes to master branch. But, well, 
if I'm not mistaken this is the Jessie branch and we need these changes 
for Jessie.


If it makes sense from the Debian release team point of view of course. 
Maybe the Jessie's live-build package cannot have any more updates. Can 
anyone shed light on this concern of mine?


The branch to merge would be: 
https://github.com/rescatux/live-build/tree/efi_support_based_on_debian_cd_rebased_9 
.


I forward to Kristian Klausen the decision on whether to wait for 
Raphael Hertzog feedback or not.



adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/




Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-08-16 Thread adrian15

El 04/08/16 a las 14:51, Raphael Hertzog escribió:

Hi,

On Sun, 31 Jul 2016, adrian15 wrote:

Is there anyone else than can provide feedback on this patch / branch?

Either by:

* Installing live-build with this applied patch
* Building your iso and check if it boots in both BIOS and UEFI mode.
* Check non usual UEFI machines.

I suspect it's fine to wait for one week for feedback.
After that time I'll try to request a proper pull / insertion into Debian's
live-build repo and probably into live-build package binaries.


I can give a try to your patchset but I'm currently in vacation so it
would not be before the third week of August.

This is just FYI but you don't have to wait on my feedback to get your
work merged if people are happy with it.

Cheers,



Hi Raphael,

  Kristian Klausen thinks is a good idea to wait for your tests.

So your feedback is welcome.

  Thank you.


adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/




Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-08-25 Thread adrian15

El 25/08/16 a las 15:36, Raphael Hertzog escribió:

Hello Adrian,

On Tue, 16 Aug 2016, adrian15 wrote:

Kristian Klausen thinks is a good idea to wait for your tests.
So your feedback is welcome.


I just built a test Kali image with your patch applied. It works:
I can boot the live system in UEFI mode.


Great!

> But I also saw a few problems:

- the grub menu looks ugly (see attached picture), it's in plain
   text mode and the background is not even uniform (sometimes blue,
   sometimes black)

That's how the grub-pc menu (BIOS) shows currently in live-build.


- there are no menu entries to start debian-installer even though
   I built my image with "--debian-installer live"


There were not such entries in the isolinux menu (BIOS). I already 
commented such incongruence when I submitted my loopback patch but 
Daniel (or irl maybe?. It was around the time dba quitted the project) 
agreed to merge my code.


In my commit:
https://anonscm.debian.org/cgit/debian-live/live-build.git/commit/?id=b6771e736022d31b0cb53c552a0f7a42a1028a09

I already said:

Compared to binary_grub2 script I have removed the installation
entries because I did not see any of them in binary_syslinux.

Can you explain to me why such Installation entries are not available in 
binary_syslinux?

Maybe they should be put there also?


- the menu entries hardcode "Debian GNU/Linux" as name of the project,
   in the default syslinux configuration the entries are agnostic as in
   "Live (@FLAVOUR@)".

That @FLAVOUR@ is from Debian's live-build?

That was not the case for grub2 (BIOS) files.

You have:

https://anonscm.debian.org/cgit/debian-live/live-build.git/tree/share/bootloaders/grub-pc/grub.cfg?id=489a09ba92328cef846598a15329e9ff91519e3c

LINUX_LIVE
and
LINUX_INSTALL

strings which get replaced by the grub-pc script.

https://anonscm.debian.org/cgit/debian-live/live-build.git/tree/scripts/build/binary_grub-pc?id=489a09ba92328cef846598a15329e9ff91519e3c

In that case 'Debian Live' is hardcoded.



I guess that some of those issues are not due to your changes, they
are probably longstanding issues in the generic grub code but still
it would be nice to have this fixed to have a more consistent experience
between grub and syslinux.


Well, there are some possible solutions to this problem:

1. Try to reuse some code from jnqnfe. He did quite some work on 
improving bootloaders design which I don't think got into GIT: 
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=775322 .


2. Try to reuse the debian-cd scripts which try to convert syslinux cfg 
files into grub ones (including the design).


Here:

https://anonscm.debian.org/cgit/debian-cd/debian-cd.git/tree/tools/boot/jessie/parse_isolinux

Not sure if this is the correct version to use but be warned that Sledge 
himself warns us that it's not pretty.


3. Commit the patch as is and later on add more patches on the minimal 
set needed for prettyfing this.


I advocate for commiting the patch as soon as possible so that I can ask 
new commits such as the Suchanek's '
"support multiple kernel versions with same flavour" to be reworked on 
over my uefi support.


adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/




Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-08-26 Thread adrian15



El 26/08/16 a las 09:52, Raphael Hertzog escribió:

On Thu, 25 Aug 2016, adrian15 wrote:

That's how the grub-pc menu (BIOS) shows currently in live-build.


Well, it sucks compared to the default visual appearance of
isolinux/syslinux in live-build.
I know, but the purpose of my patch is to add UEFI support. Not to 
improve visual appearance of grub2 so that it matches the 
isolinux/syslinux one.




- there are no menu entries to start debian-installer even though
I built my image with "--debian-installer live"


There were not such entries in the isolinux menu (BIOS). I already commented
such incongruence when I submitted my loopback patch but Daniel (or irl
maybe?. It was around the time dba quitted the project) agreed to merge my
code.

Compared to binary_grub2 script I have removed the installation
entries because I did not see any of them in binary_syslinux.

Can you explain to me why such Installation entries are not available in
binary_syslinux?
Maybe they should be put there also?


Well, the menu entries are there by default:
$ cat share/bootloaders/isolinux/menu.cfg
menu hshift 0
menu width 82

menu title Boot menu
include stdmenu.cfg
include live.cfg
include install.cfg
menu begin advanced
menu title Advanced options
include stdmenu.cfg
label mainmenu
menu label ^Back..
menu exit
include advanced.cfg
menu end

menu clear
$ cat share/bootloaders/isolinux/install.cfg
label install
menu label ^Install
linux /install/vmlinuz
initrd /install/initrd.gz
append vga=788 @APPEND_INSTALL@ --- quiet

label installgui
menu label ^Graphical install
linux /install/gtk/vmlinuz
initrd /install/gtk/initrd.gz
append video=vesa:ywrap,mtrr vga=788 @APPEND_INSTALL@ --- quiet

In fact I have not found any code to drop those entries when you don't
want debian-installer in your live image... so I would rather see the opposite
problem.

So please add those entries in the grub menu.

These: /install/vmlinuz and /install/initrd.gz strings seem to be 
hardcoded. That explains why I did not see them in binary_syslinux .
What does happen if you request both x86 and amd64 in your Debian Live? 
The first kernel gets into the /install/vmlinuz and the second kernel 
gets discarded?



- the menu entries hardcode "Debian GNU/Linux" as name of the project,
in the default syslinux configuration the entries are agnostic as in
"Live (@FLAVOUR@)".

That @FLAVOUR@ is from Debian's live-build?


Yes:

$ cat share/bootloaders/isolinux/live.cfg.in
label live-@FLAVOUR@
menu label ^Live (@FLAVOUR@)
menu default
linux @LINUX@
initrd @INITRD@
append @APPEND_LIVE@

label live-@FLAVOUR@-failsafe
menu label ^Live (@FLAVOUR@ failsafe)
linux @LINUX@
initrd @INITRD@
append @APPEND_LIVE_FAILSAFE@


I see.

I guess that some of those issues are not due to your changes, they
are probably longstanding issues in the generic grub code but still
it would be nice to have this fixed to have a more consistent experience
between grub and syslinux.


Well, there are some possible solutions to this problem:

1. Try to reuse some code from jnqnfe. He did quite some work on improving
bootloaders design which I don't think got into GIT:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=775322 .


His patch set is massive... but yes we should probably review them
and merge what's appropriate.

Yeah, probably.



2. Try to reuse the debian-cd scripts which try to convert syslinux cfg
files into grub ones (including the design).

Here:

https://anonscm.debian.org/cgit/debian-cd/debian-cd.git/tree/tools/boot/jessie/parse_isolinux

Not sure if this is the correct version to use but be warned that Sledge
himself warns us that it's not pretty.


Yeah, I looked that code in the past and I would not want to rely on this even 
though
the principle would be nice...

:)



3. Commit the patch as is and later on add more patches on the minimal set
needed for prettyfing this.


I'm ok for this but I would still like you to re-add the installer entries 
first.


Although I do not like those hardcoded /install/vmlinuz strings I think 
I can do that.


I will apply those patches as an addendum to my current changes. I don't 
think it's worth the rebased needed for applying first the changes into 
the grub-pc code.




Cheers,


Thank you for your feedback.

adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/




Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-08-26 Thread adrian15

El 26/08/16 a las 13:34, Raphael Hertzog escribió:

On Fri, 26 Aug 2016, adrian15 wrote:

Well, it sucks compared to the default visual appearance of
isolinux/syslinux in live-build.

I know, but the purpose of my patch is to add UEFI support. Not to improve
visual appearance of grub2 so that it matches the isolinux/syslinux one.


Well, my initial patch added EFI support on top of syslinux-efi and it
thus had a nice visual appearance by default. So for me it's a
regression...
I consider myself syslinux to be a regression in terms of functionality 
compared to grub2 but I stick to syslinux because I don't want delta 
between Rescatux and Debian Live to be too large.


I compare this new grub2 appearance to be the same one had the debian-cd 
when it started to support UEFI back in the day.



But I assume it's not a regression in terms of computers supported because
I believe that syslinux-efi works for less cases than grub-efi and hence
why I did not commit my own patch in the first place. Also I expect that
secure boot will be easier to add on top of grub than on top of syslinux.


That's true. There does not seem to be a secure boot support in the 
works in the syslinux side of things.


So I agree to apply your patch but I hope that you will stick around to
help improve the visual appearance.
I will try to check what jnqnfe did but I don't promise anything. I 
commited myself to work on this bug one year ago and I went silent on 
this bug for 3 or 4 months.



These: /install/vmlinuz and /install/initrd.gz strings seem to be hardcoded.
That explains why I did not see them in binary_syslinux .
What does happen if you request both x86 and amd64 in your Debian Live? The
first kernel gets into the /install/vmlinuz and the second kernel gets
discarded?


I don't know, I never tried to build images for multiple architectures.
It's not a need for me.

I see.



I will apply those patches as an addendum to my current changes. I don't
think it's worth the rebased needed for applying first the changes into the
grub-pc code.


Fine for me.

Ok.


Cheers,



adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/




Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-08-26 Thread adrian15

El 26/08/16 a las 09:52, Raphael Hertzog escribió:

(...)

Can you explain to me why such Installation entries are not available in
binary_syslinux?
Maybe they should be put there also?


Well, the menu entries are there by default:
$ cat share/bootloaders/isolinux/menu.cfg
menu hshift 0
menu width 82

menu title Boot menu
include stdmenu.cfg
include live.cfg
include install.cfg
menu begin advanced
menu title Advanced options
include stdmenu.cfg
label mainmenu
menu label ^Back..
menu exit
include advanced.cfg
menu end

menu clear
$ cat share/bootloaders/isolinux/install.cfg
label install
menu label ^Install
linux /install/vmlinuz
initrd /install/initrd.gz
append vga=788 @APPEND_INSTALL@ --- quiet

label installgui
menu label ^Graphical install
linux /install/gtk/vmlinuz
initrd /install/gtk/initrd.gz
append video=vesa:ywrap,mtrr vga=788 @APPEND_INSTALL@ --- quiet

In fact I have not found any code to drop those entries when you don't
want debian-installer in your live image... so I would rather see the opposite
problem.

So please add those entries in the grub menu.

(...)

I guess that some of those issues are not due to your changes, they
are probably longstanding issues in the generic grub code but still
it would be nice to have this fixed to have a more consistent experience
between grub and syslinux.


Well, there are some possible solutions to this problem:

(...)


3. Commit the patch as is and later on add more patches on the minimal set
needed for prettyfing this.


I'm ok for this but I would still like you to re-add the installer entries 
first.

Cheers,



So, here's my current uefi patch + the installation boot entries.

This recycled code from old binary_grub-pc does drop the installation 
entries if LB_DEBIAN_INSTALLER is false.


I don't know how to add Debian Installer to a Debian Live so I have not 
been able to test it.


So your feedback as user of the Debian Installer is welcome.

https://github.com/rescatux/live-build/tree/efi_support_based_on_debian_cd_rebased_10

adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/
>From 01a9df8ce325c5df9762f0db86128614b4d3476c Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Mon, 18 Jan 2016 03:04:00 +
Subject: [PATCH 01/11] functions/default.sh : Define LB_PRIMARY_BOOTLOADER at
 the Set_defaults function which it's the right place where to do it

---
 functions/defaults.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/functions/defaults.sh b/functions/defaults.sh
index ddf4b19..334984f 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -537,6 +537,8 @@ Set_defaults ()
 		esac
 	fi
 
+	LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
+
 	# Setting checksums
 	case "${LB_MODE}" in
 		progress-linux)
@@ -845,9 +847,6 @@ Check_defaults ()
 		fi
 	fi
 
-
-	LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 	if [ "${LB_PRIMARY_BOOTLOADER}" = "syslinux" ]
 	then
 		# syslinux + fat or ntfs, or extlinux + ext[234] or btrfs
-- 
2.1.4

>From 0624064d44ed811aec5c43fabfd7b928688ed8e1 Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Wed, 20 Jan 2016 00:53:53 +0100
Subject: [PATCH 02/11] Remove repeated LB_PRIMARY_BOOTLOADER definition

---
 scripts/build/binary_hdd | 2 --
 scripts/build/binary_iso | 2 --
 2 files changed, 4 deletions(-)

diff --git a/scripts/build/binary_hdd b/scripts/build/binary_hdd
index 407901a..b45b2a9 100755
--- a/scripts/build/binary_hdd
+++ b/scripts/build/binary_hdd
@@ -67,8 +67,6 @@ do
 	esac
 done
 
-LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 case ${LB_PRIMARY_BOOTLOADER} in
 		syslinux)
 			case ${LB_BINARY_FILESYSTEM} in
diff --git a/scripts/build/binary_iso b/scripts/build/binary_iso
index d8b1553..67dfc85 100755
--- a/scripts/build/binary_iso
+++ b/scripts/build/binary_iso
@@ -107,8 +107,6 @@ then
 	XORRISO_OPTIONS="${XORRISO_OPTIONS} -V \"${LB_ISO_VOLUME}\""
 fi
 
-LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 # Handle xorriso architecture specific options
 case "${LB_PRIMARY_BOOTLOADER}" in
 	grub)
-- 
2.1.4

>From 9d1a983cc8fe12966d1a2c24a6ee0cfb419b3ce5 Mon Sep 17 00:00:00 2001
From: Adrian Gibanel Lopez 
Date: Mon, 18 Jan 2016 03:07:48 +
Subject: [PATCH 03/11] Added new multi bootloader helper functions * Added:
 functions/bootloaders.sh . This file adds bootloader functions that are
 heavily used in efi scenarios where a bootloader can act as a first or an
 extra bootloader.

Since the introduction of the new switch:

--bootloaders

you can set

Bug#731709: Updated EFI patch

2016-01-16 Thread adrian15
I attach a patch based on your work (which I have not tested so feedback 
is welcome).


You can find the specific modifications to your original commit/patch 
(which I had to cherry-pick) on branch:


https://github.com/adrian15/live-build/tree/efi_support_based_on_debian_cd

Now I'm going to work on grub-efi support based on debian-cd / Lernstick 
work so that we can probably have also Secure Boot by default.


So, to make it clear, after my changes you would need to add or modify 
live config parametres to have:


--bootloaders="syslinux,syslinux-efi"

in order for it to work.



Do not expect me not to improve this patch even more because I'm going 
to add 'grub-efi' which it's going to be based on debian-cd. And that 
means some conflicts in the way of doing the final ISO.


And, well, then the final idea is to have the syslinux-efi as a backup 
method and the grub-efi would be the default one. I will make an 
specific commit for it.



So, yes, feedback is welcome for this patch and for my other ideas.


El 11/12/14 a las 10:58, Raphael Hertzog escribió:

Attached is an updated patch that works on top of 4.0.4 (change needed
to replace LIVE_IMAGE_ARCHITECTURE with LB_ARCHITECTURES).

Cheers,



adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/
diff --git a/manpages/en/lb_config.1 b/manpages/en/lb_config.1
index 8e1f4f7..e3482b2 100644
--- a/manpages/en/lb_config.1
+++ b/manpages/en/lb_config.1
@@ -39,7 +39,7 @@
 .br
 	[\fB\-\-bootappend\-live\fR \fIPARAMETER\fR|\fI"PARAMETERS"\fR]
 .br
-	[\fB\-\-bootloader\fR grub|grub2|syslinux]
+	[\fB\-\-bootloader\fR grub|grub2|syslinux|syslinux-efi]
 .br
 	[\fB\-\-cache\fR true|false]
 .br
@@ -263,7 +263,7 @@ defines the filesystem to be used in the image type. This only has an effect if
 sets boot parameters specific to debian\-installer, if included.
 .IP "\fB\-\-bootappend\-live\fR \fIPARAMETER\fR|""\fIPARAMETERS\fR""" 4
 sets boot parameters specific to debian\-live. A complete list of boot parameters can be found in the \fIlive\-boot\fR(7) and \fIlive\-config\fR(7) manual pages.
-.IP "\fB\-\-bootloader\fR grub|grub2|syslinux" 4
+.IP "\fB\-\-bootloader\fR grub|grub2|syslinux|syslinux-efi" 4
 defines which bootloader is being used in the generated image. This has only an effect if the selected binary image type does allow to choose the bootloader. For example, if you build a iso, always syslinux (or more precise, isolinux) is being used. Also note that some combinations of binary images types and bootloaders may be possible but live\-build does not support them yet. \fBlb config\fR will fail to create such a not yet supported configuration and give a explanation about it. For hdd images on amd64 and i386, the default is syslinux.
 .IP "\fB\-\-cache\fR true|false" 4
 defines globally if any cache should be used at all. Different caches can be controlled through the their own options.
diff --git a/scripts/build/binary b/scripts/build/binary
index 56c7bf8..1668b8c 100755
--- a/scripts/build/binary
+++ b/scripts/build/binary
@@ -69,6 +69,9 @@ lb binary_loadlin ${@}
 lb binary_win32-loader ${@}
 lb binary_includes ${@}
 lb binary_hooks ${@}
+lb binary_syslinux-efi ${@} # After includes/hooks because it copies in efi.img
+		   # files that can be overriden by binary_includes and
+		   # modified by binary_hooks
 lb binary_checksums ${@}
 
 if [ "${LB_BUILD_WITH_CHROOT}" != "true" ]
diff --git a/scripts/build/binary_iso b/scripts/build/binary_iso
index d8b1553..2b52938 100755
--- a/scripts/build/binary_iso
+++ b/scripts/build/binary_iso
@@ -140,12 +140,25 @@ case "${LB_PRIMARY_BOOTLOADER}" in
 		;;
 
 	*)
-		Echo_warning "Bootloader on your architecture not yet supported by live-build."
+		Echo_warning "Bootloader on your architecture not yet supported by live-build as the primary bootloader."
 		Echo_warning "This will produce a most likely not bootable image (Continuing in 5 seconds)."
 		sleep 5
 		;;
 esac
 
+if [ -e binary/boot/efi.img ]; then
+	Echo "Using older EFI command line for xorriso $XORRISO_VER"
+	# Tell xorriso to create a secondary ElTorito boot record for the
+	# EFI bootloader
+	XORRISO_OPTIONS="${XORRISO_OPTIONS} -eltorito-alt-boot --efi-boot boot/efi.img"
+	# Add the efi image as a FAT partition too, so our CD image will
+	# also boot on a USB key (like isohybrid, just implemented
+	# differently)
+	XORRISO_OPTIONS="${XORRISO_OPTIONS} -append_partition 2 0x01 binary/boot/efi.img"
+else
+	Echo "No EFI boot code to include in the ISO"
+fi
+
 #if [ "${LB_DEBIAN_INSTALLER}" != "live" ]
 #then
 #	XORRISO_OPTIONS="${XORRISO_OPTIONS} -m ${XORRISO_EXCLUDE}"
diff --git a/scripts/build/binary_syslinux-efi b/scripts/

Bug#731709: grub-efi UEFI support based on debian-cd work complete

2016-01-17 Thread adrian15

These patches apply to current live-build master branch.

Each of one the patches have their own explanation based on a git commit.

Maybe I have missed to say that the grub-efi UEFI support which it's 
based on Debian-CD work not only supports to boot from UEFI 64 bit 
systems but also from UEFI 32 bit systems.


I have not tested myself if UEFI 32 bit boots or not but I don't know 
why it should not. Feedback is welcome.


As most email programs would show the attached text ready for you to 
quote I don't think I need to explain too much more about them.


The reason why I have up to 7 patches is because either each one of them 
focus in one task or I have thought you might want to use it or not 
(Well, it's mainly: 007-syslinux-grub-efi-default-bootloaders.diff which 
enforces every ISO to have UEFI support).


Finally loopback_cfg which renders grub.cfg shows us a blue raw grub 
menu which it's not fun but it's functional.


Maybe we could reuse some work from jnqnfe from #775322 but I'm not 
going to do that. Maybe in the future for using in Rescatux but not in 
the short term.


The other option is trying to reuse debian-cd or debian-installer 
scripts which let you translate syslinux configuration files into grub 
configuration files.


Feedback is welcome!

P.S.: I am going to release soon: Rescatux 0.40b3 which will be based on 
these commits so you will be able to see how it would perform the final 
product.


adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/
commit 40d86ad27d48a0d00318b7f3ec088704778c67ad
Author: Adrian Gibanel Lopez 
Date:   Mon Jan 18 03:01:15 2016 +

Stolen efi-image and grub-cpmodules from src:live-installer

These two scripts simplify the creation of efi images based on grub-efi.
I have decided to simply steal them. If I had to include them thanks to a 
source package that would have mean that an src repo would have to be defined 
by default.
TODO: Ask in a bug a RFE so that these two scripts are put into a binary 
that could be consumed by both live-installer and live-build packages.

diff --git a/scripts/build/efi-image b/scripts/build/efi-image
new file mode 100644
index 000..724095f
--- /dev/null
+++ b/scripts/build/efi-image
@@ -0,0 +1,85 @@
+#! /bin/sh
+set -e
+
+# Copyright (C) 2010, 2011 Canonical Ltd.
+# Author: Colin Watson 
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Make an EFI boot image.
+
+if [ -z "$1" ] || [ -z "$2" ]; then
+   echo "usage: $0 OUTPUT-DIRECTORY GRUB-PLATFORM EFI-NAME NETBOOT-PREFIX"
+   exit 1
+fi
+
+outdir="$1"
+platform="$2"
+efi_name="$3"
+netboot_prefix="$4"
+
+memdisk_img=
+workdir=
+
+cleanup () {
+   [ -z "$memdisk_img" ] || rm -f "$memdisk_img"
+   [ -z "$workdir" ] || rm -rf "$workdir"
+}
+trap cleanup EXIT HUP INT QUIT TERM
+
+rm -rf "$outdir"
+mkdir -p "$outdir"
+
+memdisk_img="$(mktemp efi-image.XX)"
+workdir="$(mktemp -d efi-image.XX)"
+
+# Skeleton configuration file which finds the real boot disk.
+mkdir -p "$workdir/boot/grub"
+cat >"$workdir/boot/grub/grub.cfg" <"$outdir/boot/grub/$platform/grub.cfg"
+
+# Build the core image.
+(cd "$workdir"; tar -cf - boot) >"$memdisk_img"
+grub-mkimage -O "$platform" -m "$memdisk_img" \
+   -o "$workdir/boot$efi_name.efi" -p '(memdisk)/boot/grub' \
+   search iso9660 configfile normal memdisk tar part_msdos part_gpt fat
+
+grub-mkimage -O "$platform" \
+   -o "$outdir/bootnet$efi_name.efi" -p "$netboot_prefix/grub" \
+   search configfile normal efinet tftp net
+
+# Stuff it into a FAT filesystem, making it as small as possible.  24KiB
+# headroom seems to be enough; (x+31)/32*32 rounds up to multiple of 32.
+mkfs.msdos -C "$outdir/efi.img" \
+   $(( ($(stat -c %s "$workdir/boot$efi_name.efi") / 1024 + 55) \
+   / 32 * 32 ))
+mmd -i "$outdir/efi.img" ::efi
+mmd -i "$outdir/efi.img" ::efi/boot
+mcopy -i "$out

Bug#731709: binary_syslinux-efi based on latest work on live-build master branch for grub-efi support

2016-01-17 Thread adrian15
So this is the patch from Raphael Hertzog that you all know but adapted 
to be used from my last work.


Unfortunately it does not seem to boot in my virtual machine test.

Raphael can you take a look at it just in case it's a minor problem?

I'm also interested in being able to make cdroms with syslinux-efi.

The quick and dirty branch where I worked on both grub-efi and 
syslinux-efi is here:


https://github.com/adrian15/live-build/tree/efi_support_based_on_debian_cd

That branch is handy to understand the changes between Raphael's 
original patch and what I present here.


adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/
commit 1397b6fc3dbf7d7f1e6a077a37b9f2e6ee7d7f39
Author: Adrian Gibanel Lopez 
Date:   Mon Jan 18 03:37:01 2016 +

Initial implementation of: binary_syslinux-efi
based on latest work on live-build master branch
for grub-efi support.

In order to test this new script you need to specify at

lb config:

--bootloaders=syslinux,syslinux-efi

.

This work is based on this original patch:


https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=103;bug=731709;att=1;filename=Add-support-for-EFI-boot-with-syslinux-efi.patch

This is currently not working in my EFI test virtual machine.
Let's hope the original author of the patch can take a look
and, maybe fix a minor bug.

diff --git a/manpages/en/lb_config.1 b/manpages/en/lb_config.1
index 7e3c956..830965d 100644
--- a/manpages/en/lb_config.1
+++ b/manpages/en/lb_config.1
@@ -39,7 +39,7 @@
 .br
[\fB\-\-bootappend\-live\fR \fIPARAMETER\fR|\fI"PARAMETERS"\fR]
 .br
-   [\fB\-\-bootloader\fR grub|grub2|syslinux|grub-efi]
+   [\fB\-\-bootloader\fR grub|grub2|syslinux|grub-efi|syslinux-efi]
 .br
[\fB\-\-cache\fR true|false]
 .br
@@ -263,7 +263,7 @@ defines the filesystem to be used in the image type. This 
only has an effect if
 sets boot parameters specific to debian\-installer, if included.
 .IP "\fB\-\-bootappend\-live\fR \fIPARAMETER\fR|""\fIPARAMETERS\fR""" 4
 sets boot parameters specific to debian\-live. A complete list of boot 
parameters can be found in the \fIlive\-boot\fR(7) and \fIlive\-config\fR(7) 
manual pages.
-.IP "\fB\-\-bootloader\fR grub|grub2|syslinux|grub-efi" 4
+.IP "\fB\-\-bootloader\fR grub|grub2|syslinux|syslinux-efi" 4
 defines which bootloader is being used in the generated image. This has only 
an effect if the selected binary image type does allow to choose the 
bootloader. For example, if you build a iso, always syslinux (or more precise, 
isolinux) is being used. Also note that some combinations of binary images 
types and bootloaders may be possible but live\-build does not support them 
yet. \fBlb config\fR will fail to create such a not yet supported configuration 
and give a explanation about it. For hdd images on amd64 and i386, the default 
is syslinux.
 .IP "\fB\-\-cache\fR true|false" 4
 defines globally if any cache should be used at all. Different caches can be 
controlled through the their own options.
diff --git a/scripts/build/binary b/scripts/build/binary
index 7b0d743..7e30f27 100755
--- a/scripts/build/binary
+++ b/scripts/build/binary
@@ -70,6 +70,7 @@ lb binary_win32-loader ${@}
 lb binary_includes ${@}
 lb binary_hooks ${@}
 lb binary_grub-efi ${@}
+lb binary_syslinux-efi ${@}
 lb binary_checksums ${@}
 
 if [ "${LB_BUILD_WITH_CHROOT}" != "true" ]
diff --git a/scripts/build/binary_iso b/scripts/build/binary_iso
index 5d612b5..41331a1 100755
--- a/scripts/build/binary_iso
+++ b/scripts/build/binary_iso
@@ -157,6 +157,23 @@ then
fi
 fi
 
+if Is_Secondary_Bootloader "syslinux-efi"
+then
+   if [ -e binary/boot/efi.img ]
+   then
+   Echo "Using older EFI command line for xorriso $XORRISO_VER"
+   # Tell xorriso to create a secondary ElTorito boot record for 
the
+   # EFI bootloader
+   XORRISO_OPTIONS="${XORRISO_OPTIONS} -eltorito-alt-boot 
--efi-boot boot/efi.img"
+   # Add the efi image as a FAT partition too, so our CD image will
+   # also boot on a USB key (like isohybrid, just implemented
+   # differently)
+   XORRISO_OPTIONS="${XORRISO_OPTIONS} -append_partition 2 0x01 
binary/boot/efi.img"
+   else
+   Echo "No EFI boot code to include in the ISO"
+   fi
+fi
+
 #if [ "${LB_DEBIAN_INSTALLER}" != "live" ]
 #then
 #  XORRISO_OPTIONS="${XORRISO_OPTIONS} -m ${XORRISO_EXCLUDE}"
diff --git a/scripts/build/binary_syslinux-efi 
b/scripts/build/binary_syslinux-efi
new file mode 100644
index 000..d70e0fd
--- /dev/null
+++ b/scripts/build/binary_syslinux-efi
@@ -0,0 +1,284 @@
+

Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-01-17 Thread adrian15
In my last message I forgot to CC many people who are involved in this 
bug so I'm going to refer to my former message, CC some people and 
finally point you to my repo/branches where you might find interesting 
commits.



1) My original message with attached patches (which you can download to 
your email program and reply from there) can be found at:


https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731709#153


2) Repo / Branches:

* efi_support_based_on_debian_cd  ( 
https://github.com/adrian15/live-build/tree/efi_support_based_on_debian_cd 
) : Original dirty branch where I worked in both syslinux-efi and 
grub-efi bootloaders at the same time


* efi_support_based_on_debian_cd_rebased ( 
https://github.com/adrian15/live-build/tree/efi_support_based_on_debian_cd_rebased 
) : The same branch rebased to have minimal useful commits. syslinux-efi 
was removed from it because it did not boot.


* syslinux-efi-2016 ( 
https://github.com/adrian15/live-build/tree/syslinux-efi-2016 ) : This 
branch adds and enables the latest version of syslinux-efi (rebased) but 
it does not boot.



adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/




Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-01-18 Thread adrian15

El 18/01/16 a las 07:31, Michal Suchanek escribió:

Hello,

thanks for working on this.

On 18 January 2016 at 05:24, adrian15  wrote:

In my last message I forgot to CC many people who are involved in this bug
so I'm going to refer to my former message, CC some people and finally point
you to my repo/branches where you might find interesting commits.


1) My original message with attached patches (which you can download to your
email program and reply from there) can be found at:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731709#153


2) Repo / Branches:

* efi_support_based_on_debian_cd  (
https://github.com/adrian15/live-build/tree/efi_support_based_on_debian_cd )
: Original dirty branch where I worked in both syslinux-efi and grub-efi
bootloaders at the same time

* efi_support_based_on_debian_cd_rebased (
https://github.com/adrian15/live-build/tree/efi_support_based_on_debian_cd_rebased
) : The same branch rebased to have minimal useful commits. syslinux-efi was
removed from it because it did not boot.


I have checked what EFI platforms I have and it seems neither would be
bootable with this.

1) a Windows tablet that needs signed bootloader - signed grub is
available as non-free package (because it cannot be modified to not
break the signature) and presumably allows booting on such systems
without going through the unlocking stuff which may break your windows
installation.
Yeah, that's the Microsoft Secure Boot. debian-cd people are working on 
bringing it into official Debian CDs. There is not a fixed date for that 
but everything points that it will be finished within 2016. Once they 
manage to do so I'll see how easy it is to port into this work.


You can always try virtual systems. This is how I currently test this:

kdesudo "kvm -bios /usr/share/ovmf/OVMF.fd -cdrom rescatux-0.40b3.iso 
-boot d -m 512"


.


2) a mac mini which probably needs a GPT and the bootloader stored on
a HFS+ volume or something. Also the bootloader needs to be 'blessed'.
Command for that exists in grub and crashes. Never got this working on
an USB stick.
Well, I have not mentioned that this implementation (based on debian-cd 
team work) also would support intel based mac systems because it has an 
additional HFS+ volume.


I also have a mac book pro myself and the 'hybrid' version of Super 
Grub2 Disk 2.02s3 works for me (when using ALT key at boot). I don't 
remember having blessed it so... I'm unsure about the need (or not) to 
bless it.


So, the 'hybrid' Super Grub2 Disk 2.02s3 also has an additional HFS+ 
partition (as our current implementation here in these patches) put in 
place for mac book compatibility so I guess that this build will also 
boot in my system but I still need to test it.




As to the primary and secondary bootloader - how is the efi bootloader
secondary? It boots the same as the legacy bootloader. You probably
want a concept of compatible bootloaders - that is pairs of
bootloaders that can be installed alongside on the same medium.

* What is it a secondary bootloader?

It's what happens when you request mkisofs that your bootloader to be 
boot in second place or as a second partition. I don't know how it 
actually works.


So in grub-efi we just add to the xorriso options:

-eltorito-alt-boot \
 -e boot/grub/efi.img \
 -no-emul-boot \
 -isohybrid-gpt-basdat \
 -isohybrid-apm-hfsplus

And in syslinux-efi (currently) we add:

-eltorito-alt-boot \
 --efi-boot boot/efi.img \
 -append_partition 2 0x01 \
 binary/boot/efi.img

.

So, I guess the -eltorito-alt-boot does the magic but I'm not sure. 
Maybe someone else can explain it better than me.



* About current compatible bootloaders.
The technology is there. I mean. This is what it's currently available:

binary_grub-efi : Secondary bootloader
binary_grub-legacy : Primary bootloader
binary_grub-pc : Primary bootloader
binary_syslinux : Primary bootloader
binary_syslinux-efi : Secondary bootloader

so that means, in theory you can request one of these 9 combinations:

grub-legacy
grub-pc
syslinux

grub-legacy,grub-efi
grub-pc,grub-efi
syslinux,grub-efi

grub-legacy,syslinux-efi
grub-pc,syslinux-efi
syslinux,syslinux-efi


Why can't you request:

grub-efi
or
grub-efi,syslinux-efi

?

Because nobody has coded grub-efi installed as a primary bootloader yet. 
But the 'framework' is there.


You either need to improve binary_grub-efi or create another script file 
that does its job when ' Is_Primary_Bootloader "grub-efi" ' is true.




Unless
the user requests two bootloaders that are incompatible the medium can
be created.

Ignoring bootloaders is not a good idea. If the user requested
something that is not possible the build should report an error and
stop.
Yeah, that it's hard to implement from the perspective of a single 
bootloader script. So I decided not to implement it.


You could add an additional scrip

Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-01-18 Thread adrian15

A quick update on my grub-efi work:

1) I have noticed I have missed to give execution permissions to many 
files when I rebased.


These are:
scripts/build/binary_grub-efi
scripts/build/binary_syslinux-efi
scripts/build/efi-image
scripts/build/grub-cpmodules

You can find additional commits to fix this situation on:
https://github.com/adrian15/live-build/tree/efi_support_based_on_debian_cd_rebased
and
https://github.com/adrian15/live-build/commits/syslinux-efi-2016
.

(I will probably do another rebase in another branch in the future with 
other of your suggestions and these fixes.)



2) I have released Rescatux 0.40 beta 5 based on: 
https://github.com/adrian15/live-build/tree/rescatux-0.40b5 (The patches 
you have already seen + execution permissions fixed) . It is built by using:

--bootloaders="syslinux,grub-efi" .

You can find more information about it and download links on:

http://www.supergrubdisk.org/2016/01/18/rescatux-0-40-beta-5-released/

Remember that if you want to test it into a USB drive you need to do the 
'dd' if you want it to work ok and that means DESTROYING your data in 
the USB drive.



adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/




Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-01-20 Thread adrian15

El 18/01/16 a las 12:57, Michal Suchanek escribió:


Unless
the user requests two bootloaders that are incompatible the medium can
be created.

Ignoring bootloaders is not a good idea. If the user requested
something that is not possible the build should report an error and
stop.


Yeah, that it's hard to implement from the perspective of a single
bootloader script. So I decided not to implement it.

You could add an additional script or function named:
check_compatible_bootable_pairs (as you propose) but then you need to
maintain that fictional database each time a new bootloader gets in.

That's why I decide to avoid it using it.

What it's straight-forward to implement is one of the only-secondary
bootloaders finding themselves as a primary bootloader and outputting a
warning message. But, I'm not sure what to put there as a warning. Any
suggestion?


Unsupported bootloader combination or whatever.

It should not be a warning however. The script should avoid making
unbootable medium.

Thanks

Michal


I have implemented: Check_Primary_Bootloader_Role, 
Check_Secondary_Bootloader_Role functions for avoiding non supported 
bootloader combinations on:


https://github.com/adrian15/live-build/tree/efi_support_based_on_debian_cd_rebased

So that part is solved.

(I'll send a proper rebased set of patches in the future).

adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/




Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-01-20 Thread adrian15

El 18/01/16 a las 14:00, Thomas Schmitt escribió:

So any bootloader is made primary by leaving out -eltorito-alt-boot.


There is no "primary" or "secondary" on the level of boot images
and loaders. (Of course you may call them this way in your project.)

There are first, second, third ... El Torito boot images or MBR, GPT,
APM partition entries.
The sequence is just needed because not all can be first in the list.

The boot firmware inspects the medium for its known lures,
picks a tasty one, and follows it to the boot loader or kernel.


So, yes, I'm the one who invented the term primary for live-build. 
Actually, it was not meant for alt El Torito boot entries (or non first 
entries as you clarify).


The first idea was to add both syslinux and grub-pc in the same image. 
Grub-pc would be the one installed to be boot but syslinux files would 
be there for Multi-USB tools to know how to understand the iso and put 
it into an USB.


The Grub-pc bits were thought in first place for Super Grub2 Disk (which 
it is Grub2 cfg files mainly).


(Now that I think of the current 'check primary bootloader role' 
functions unable me to perform that Super Grub2 Disk Debian Live that 
included the Syslinux bits too. Anyways I'll find a workaround for that 
in the future. Not a priority right now.)


Now primary means: "First lure" and secondary means "Second lure" by 
your definition.


Currently there's no way to stop you from requesting:

--bootloaders="syslinux,grub-efi,syslinux-efi"

Given the way that both grub-efi and syslinux-efi use:

/efi/boot/bootia32.efi
and
/efi/boot/bootx64.efi

the last one to be run would overwrite the first one efi files.



You can probably use only one legacy bootloader but syslinux-efi and
grub-efi use different files so it should be possible to install both.
I am not sure how selecting one or the other would work, though.


You can offer several EL Torito boot images for BIOS, indeed.
It will depend on your BIOS what it does in this case.

Interesting.


There can be only one MBR, though. So you would have to hop
by MBR x86 code to a standalone program which chooses among
the BIOS suitable El Torito boot images.

With EFI it makes few sense to offer more than one El Torito
boot image or EFI System Partition. UEFI 2.4 rather prescribes to
handle all alternatives inside the FAT filesystem. The firmware
will start the \EFI\BOOT\BOOT*.EFI binary which it deems suitable
for its processor type.
This binary is quite free in its further proceedings.

So... How would you go about for a:

--bootloaders="syslinux,grub-efi,syslinux-efi"

to make sense if, as I have stated earlier (although I might have missed 
something there) they would overwrite their /efi/boot/boot*efi files ?




adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/




Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-01-20 Thread adrian15

El 18/01/16 a las 13:38, Thomas Schmitt escribió:

Hi,

adrian15 wrote:

* What is it a secondary bootloader?
It's what happens when you request mkisofs that your bootloader to be
boot in second place or as a second partition. I don't know how it
actually works.


An ISO may contain several lures for boot firmware.

If it is booted from CD/DVD/BD, then the lures are in the El Torito
boot catalog. In case of debian-cd it contains two entries which
point to boot images. One entry is marked as suitable for BIOS and
one marked as suitable for EFI. The boot firmware then picks what
it deems right and starts it, or offers it to the user for starting.

Interesting.


If the ISO is presented on USB stick or alike, then BIOS looks
for the magic number of an MBR and if so, mindlessly executes
the x86 machine code that starts at byte 0 of the ISO.
This code then hops onto the same boot code that is advertised
by El Torito (because xorriso or isohybrid patched its block
address into the MBR code).

Aha.


EFI looks on USB stick for an MBR partition of type 0xef or
for a single partition of type 0xee. In the latter case it assumes
the presence of GPT and looks for a GPT partition with type GUID
28732ac11ff8d211ba4b00a0c93ec93b.
Inside the found partition it expects a FAT filesystem and
particular binaries for each supported processor archictecture.
E.g. \EFI\BOOT\BOOTX64.EFI

The El Torito EFI boot image has the same content specification
as the EFI System Partition. Therefore both boot paths can share
the same data.

My cheat sheet is at
   
http://bazaar.launchpad.net/~libburnia-team/libisofs/scdbackup/view/head:/doc/boot_sectors.txt


Great! I want to document the different ways of how BIOS boot, UEFI boot 
and Secure Boot work and that might be helpful.




-


So, I guess the -eltorito-alt-boot does the magic but I'm not sure.
Maybe someone else can explain it better than me.


-eltorito-alt-boot is simply a separator between the options of
El Torito boot images.
I assume your first boot image is announced by -b and gets
the usual options
-no-emul-boot -boot-load-size 4 -boot-info-table

Before the announcement of the EFI boot image begins, option
-eltorito-alt-boot is needed to protect your -b and its helpers
from being overwritten.


That it's quite interesting. Do you mean if you have:

xorriso bunch-of-options-1 -eltorito-alt-boot bunch-of-options-2

you could just re-arrange them as:

xorriso bunch-of-options-2 -eltorito-alt-boot bunch-of-options-1

and it would be fine?

So that it's not strictly necessary for syslinux or grub-pc to be a 
primary bootloader (or first lure in your definition) ?


That would also simplify my contributed code to live-build by not 
needing to handle if a bootloader is primary/secondary or not.





So in grub-efi we just add to the xorriso options:
-eltorito-alt-boot \
  -e boot/grub/efi.img \
  -no-emul-boot \
  -isohybrid-gpt-basdat \
  -isohybrid-apm-hfsplus


Here a second boot image gets announced by -e and the next three
options apply to it.

Ok.




And in syslinux-efi (currently) we add:
-eltorito-alt-boot \
--efi-boot boot/efi.img \


Option --efi-boot is a shortcut for
   -eltorito-alt-boot -e ... -no-emul-boot -eltorito-alt-boot
normally used by grub-mkrescue. The SYSLINUX community prefers -e.
Knowing that I will probably expand that so that the syslinux-efi and 
grub-efi options are more similar and we can compare them in a more easy 
manner.




-append_partition 2 0x01 \
  binary/boot/efi.img


I wonder what EFI firmware would hop on an MBR partition of type 0x01.
An EFI System Partition in MBR should have type 0xef to be recognized.

That needs to be asked to Hertzog. I just tried to use his original work.


It looks like this variant will not get GPT. That's fully compliant
to UEFI 2.4. Just the MBR partition type should be 0xef.

(Does "syslinux-efi" mean that you can boot from ISO via EFI
and SYSLINUX stuff to an operating system ? That would be new.)
I don't know what you mean by 'SYLINUX stuff to an operating system. I 
understand that Hertzog work let's you boot into the cd booting by the 
means of EFI. The EFI image needs to include the configuration file (as 
opossed to the grub-efi implementation which only stores its 
configuration file in the CD/DVD/BD media).


---

Above options do not produce HFS+ with blessing.
Option -isohybrid-apm-hfsplus causes an Apple Partition Map entry
which points to the data content of boot/grub/efi.img.


If I'm not mistaken Hertzog removed that option because you suggested to 
remove it on:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731709#66

Are you requesting to put this option back ?



There are two ways known to me how to get a boot path via HFS+:
Fedora Live CD as of Matthew Garrett
or grub-mkrescue as of Vladimir Ser

Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-01-22 Thread adrian15

El 21/01/16 a las 10:13, Thomas Schmitt escribió:

Hi,

For the nomenclature: "USB" alone is misleading because there are
also optical drives attachable to USB. Better distinguish the boot
media families CDROM (CD, DVD, BD) and HDD (hard disk, USB stick,
memory card, ...).

Sorry. I was refering to USB stick then.



adrian15 wrote:

Grub-pc would be the one installed to be boot but syslinux files would be
there for Multi-USB tools to know how to understand the iso and put it into
an USB.


You mean the capability to boot the ISO via BIOS from USB stick ?
(Known with SYSLINUX as "isohybrid".)

grub-pc is supposed to be bootable that way too. Have a look at the
result of grub-mkrescue.
When running xorriso -as mkisofs, the decisive trick of grub-mkrescue
for BIOS bootability from HDD is:

   --grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img

(It is obvious that only one bootloader can put its MBR at the
start of the ISO. So additional -isohybrid-mbr for SYSLINUX
would conflict.)

CDROM bootability via BIOS is caused by

-b boot/grub/i386-pc/eltorito.img \
  -no-emul-boot -boot-load-size 4 -boot-info-table \
  --grub2-boot-info

(Options learned from grub-mkrescue tests on Debian Sid.)
Well, yes, I know that you can use grub-pc to be able to boot a single 
image that boots from either a hard disk / USB stick / CDROM media in a 
BIOS system.


I did use that setup for building earlier versions of Rescatux (which 
included native Super Grub2 Disk in them).


My first will on putting both syslinux and grub-pc in the same media had 
not the purpose of making it bootable with two methods but rather to:

* Default boot into Grub2 (so that Super Grub2 Disk could be used natively).
* Confuse multi usb stick tools such as yumi to think that the iso was 
actually isolinux based. That way they can easily extract iso contents 
and put it into a multi usb stick device.


As I said before this was the original idea that made me add the primary 
and secondary bootloaders concept to live-build.




--bootloaders="syslinux,grub-efi,syslinux-efi"


Here i wonder whether (or how) your syslinux-efi boots out of an
ISO 9660 filesystem. My current knowledge is that SYSLINUX cannot
do this.
Yeah, you are right. You can take a look at what I have left from 
Hertzog patch here:


https://github.com/adrian15/live-build/commit/1397b6fc3dbf7d7f1e6a077a37b9f2e6ee7d7f39

His workaround for syslinux-efi not being able to boot out of an ISO 
9660 filesystem is to put the bootloader files, kernel and initrd on the 
efi image.


That way the efi image should be able to load the initrd in the ram so 
that the rest of the system can be found.


(Back in the day in some old systems you had to do this trick, e.g., add 
these files to the old IDE attached disk because BIOS was unable to boot 
the SATA attached disk. But the initrd, yes, knew how to handle it.)




Now primary means: "First lure" and secondary means "Second lure" by your
definition.


There are normally two lures per firmware-hardware combination.
Depending on the medium, the lures are recognized in El Torito,
or in MBR, or in partition tables.

In general we have theses dimensions
   {Medium: CDROM, HDD} x
   {Firmware: BIOS, EFI, ... exotic others ...} x
   {Hardware: i386, amd64, ... exotic others ...}

Not all tuples chosen from these sets are valid and not all
valid tuples can be combined in one ISO filesystem.
But the 8 main combinations for PC hardware are valid and
combinable.

I would avoid ranking terms like "first" or "primary".
Job descriptions for bootloaders could rather look like
   (CDROM + HDD, BIOS, i386 + amd64)
   (HDD, EFI, i386)
   (HDD, EFI, amd64)

Some of them can hardly be separated from each other.
E.g. (HDD, BIOS, i386) and (HDD, BIOS, amd64) have identical
technical properties.
I am sorry. I agree with you but I'm not going to change my current 
naming without further input. I would need a patch from you or a 
concrete new naming system with examples that replace the current names.


It seems you are proposing to add like three tags: Medium?, Firmware?, 
Architecture? but I don't get how that would transform into options that 
the final user can use.


And, well, how would you go into enabling or not a given bootloader 
given a Medium?, Firmware?, Architecture? combination.


I mean, don't get me wrong, I want to code this right but I'm not sure I 
understand why we need this. I mean, I know that the medium already 
choosing by either binary_hdd or binary_iso . And, the architectures can 
also be choosen if needed (LB_ARCHITECTURES if I'm not mistaken). Not 
sure why you want to question of all that out of a sudden.


Anyway, as I said, maybe giving me concrete examples might make me 
change my mind. If we are going to implement UEFI support into 
live-build let's do it right.



Given the way that both grub-efi and syslinux-efi use:
/efi/

Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-01-22 Thread adrian15

El 21/01/16 a las 12:57, Thomas Schmitt escribió:



adrian15 wrote:

Do you mean if you have:
xorriso bunch-of-options-1 -eltorito-alt-boot bunch-of-options-2
you could just re-arrange them as:
xorriso bunch-of-options-2 -eltorito-alt-boot bunch-of-options-1
and it would be fine?



From the view of xorriso and El Torito specs this is ok.

You have to keep the modifier options (e.g. -boot-info-table) in
the same -eltorito-alt-boot department as their main options (e.g. -b).

The program isohybrid of SYSLINUX expects BIOS in El Torito catalog
entry 1, EFI in entry 2, and HFS+ in entry 3.
So with genisoimage + isohybrid, you'd have to keep the sequence.

One never knows what firmware does with such changes. Normally
it should accept any sequence. But tradition is: BIOS first, EFI second.


I see. So when using syslinux it's better for it to be the primary 
bootloader. Ok.


And, if I'm not mistaken doing a:

--bootloaders="grub-efi" should be quite easy.

That way people that want EFI only images would be able to make them. In 
order to do that I would just need to implement the primary bootloader 
behaviour of grub-efi and, well, remove the current grub-efi as a 
secondary bootloader role enforcement.


I might finally do that.


I wonder what EFI firmware would hop on an MBR partition of type 0x01.
An EFI System Partition in MBR should have type 0xef to be recognized.

That needs to be asked to Hertzog. I just tried to use his original work.


Did you try whether it boots via EFI if no BIOS boot equipment
is in the ISO ?

Well, I tried: kvm -bios /usr/share/ovmf/OVMF.fd -boot d -cdrom file.iso .

I probably need to do more tests later.


If I'm not mistaken Hertzog removed that option because you suggested to
remove it on:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731709#66
Are you requesting to put this option back ?


Only if you augment the boot equipment by a third boot image that
contains a small HFS+ filesystem. (See Fedora Live CD.)
As long as there is no HFS+, the option -isohybrid-apm-hfsplus
is inappropriate but seems to do no harm. (See Debian amd64 netinst.)


I see. So the Fedora Live CD would seem even better. I wonder why the 
debian-cd team did not consider adding this third boot image with a 
small HFS+ filesystem. I'll probably ask them in the irc.



There are two ways known to me how to get a boot path via HFS+:

The debian-cd method is one of them? Or is it not?


debian-cd has no HFS+ boot image. This makes it different from
Fedora Live CD.

Understood.


The xorriso run could be easily adapted to include a HFS+ image.
But i do not know how Matthew Garrett produced this image.
I was doing some research on SElinux support and I found these set of 
tools for creating the Fedora Live CDs:


https://github.com/rhinstaller/livecd-tools

It's quite nice learning how other build their own live cd systems. 
Anyways, back to the main subject, I have no idea if Matthew Garrett 
used this tool or not.



One would have to investigate its content and find some Mac
filesystem tool to produce such content.

Probably.


The current debian-cd ( debian-8.2.0-amd64-i386-netinst.iso ) xorriso
options are: [well known from file /.disk/mkisofs in the ISO]
where you can see they use:
-isohybrid-apm-hfsplus
So... this is not useful for creating an HFS+ image file?


No. It just announces the EFI boot image in an Apple Partition Map.
This might be of use for GRUB2 if no other partition table points
to that image. But debian-cd has an MBR partition 0xef and a GPT
partition which point to that EFI boot image. (The GPT is to be
ignored by all sane EFI implementations.)

Ok. Did you mean "NOT to be ignored"?




What does this option do instead then?


It is surplus, currently.



Maybe I'm just repeating
what you are going to saying later in this email about how Grub2 handles
boot in Mac systems.


Regreattably i can only forward the rumor that Some (TM) Macs
do not boot without HFS+ and its blessed files.

They are in the time window between Apple Inc. giving up PowerPC
and Apple Inc. adopting EFI.
I have one of them in that window. I'm not sure about the blessing being 
needed though. Maybe I have disabled it. Not sure.




A) Are you complaining about syslinux-efi on:
-append_partition 2 0x01
that should be:
-append_partition 2 0xef
instead?


Yes. UEFI 2.4 5.2.2 says about booting from MBR partitions:
"* 0xEF (i.e., UEFI System Partition) defines a UEFI system partition."

The presence of GPT would have to be announced by a "protective MBR"
partition of type 0xee with start at LBA 1. Any MBR partition type other
than 0x00 and 0xee prevents the recognition of GPT.
Maybe that's why the syslinux-efi does not boot. I could give it a try 
changing the partition type and see what happens.



grub-mkrescue -o output.iso minimal_dir

Last time I checked it did not work ok in Debian because the commit
the grub package

Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-01-22 Thread adrian15
Despite of being discussing how to implement all of these properly. I 
feel it's right to show you my current work so that you can comment on it.


I attach my updated patches.

1) The main differences from my original patches are:

* I use more additional bootloader functions
* The code ensures that each bootloader can be used in its role, being 
it a primary bootloader o a secondary bootloader. That way we avoid the 
user being able to generate non bootable isos.


2) For the time being I am not maintaining the syslinux-efi branch till 
we manage to get a consensus on this one. Then I will rebase it, change 
the partition type and re-test it.


3) As I have mentioned in another message I plan to work on giving the 
user the ability of creating isos using:

--bootloaders="grub-efi" thus using grub-efi as a primary bootloader.

4) The patches can be found as a git branch (based on live-build master 
branch) here:


https://github.com/adrian15/live-build/tree/efi_support_based_on_debian_cd_rebased_4


adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/
commit ff8206aea1985760dfea9ec94b93686a242f137e
Author: Adrian Gibanel Lopez 
Date:   Mon Jan 18 03:04:00 2016 +

functions/default.sh : Define LB_PRIMARY_BOOTLOADER at the Set_defaults 
function which it's the right place where to do it

diff --git a/functions/defaults.sh b/functions/defaults.sh
index ddf4b19..334984f 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -537,6 +537,8 @@ Set_defaults ()
esac
fi
 
+   LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 
}')
+
# Setting checksums
case "${LB_MODE}" in
progress-linux)
@@ -845,9 +847,6 @@ Check_defaults ()
fi
fi
 
-
-   LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 
}')
-
if [ "${LB_PRIMARY_BOOTLOADER}" = "syslinux" ]
then
# syslinux + fat or ntfs, or extlinux + ext[234] or btrfs
commit b3ec155600f79b6ac078ae8003e806735044a372
Author: Adrian Gibanel Lopez 
Date:   Wed Jan 20 00:53:53 2016 +0100

Remove repeated LB_PRIMARY_BOOTLOADER definition

diff --git a/scripts/build/binary_hdd b/scripts/build/binary_hdd
index d0db382..0c9c5af 100755
--- a/scripts/build/binary_hdd
+++ b/scripts/build/binary_hdd
@@ -67,8 +67,6 @@ do
esac
 done
 
-LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 case ${LB_PRIMARY_BOOTLOADER} in
syslinux)
case ${LB_BINARY_FILESYSTEM} in
diff --git a/scripts/build/binary_iso b/scripts/build/binary_iso
index d8b1553..67dfc85 100755
--- a/scripts/build/binary_iso
+++ b/scripts/build/binary_iso
@@ -107,8 +107,6 @@ then
XORRISO_OPTIONS="${XORRISO_OPTIONS} -V \"${LB_ISO_VOLUME}\""
 fi
 
-LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
-
 # Handle xorriso architecture specific options
 case "${LB_PRIMARY_BOOTLOADER}" in
grub)
commit e0abb8214b9ff71630220a24564a8770cea8658e
Author: Adrian Gibanel Lopez 
Date:   Mon Jan 18 03:07:48 2016 +

* Added: functions/bootloaders.sh . It has new bootloader functions that 
are heavily used in efi scenarios where a bootloader can act as a primary or a 
secondary bootloader.

Since the introduction of the new switch:

--bootloaders

you can setup it like this:

--bootloaders=syslinux,grub-efi

.

This means that syslinux is the primary bootloader and grub-efi is the 
secondary bootloader.

* Added new bootloader functions: Check_Non_Primary_Bootloader and 
Check_Non_Secondary_Bootloader.

These functions let each one of the bootloaders abort the build because
they cannot perform a role either as a primary bootloader or as a secondary 
bootloader.

* Added bootloader functions: Check_Primary_Bootloader_Role, 
Check_Secondary_Bootloader_Role and Check_Any_Bootloader_Role

These functions let bootloaders to force their default role in a single 
line.

diff --git a/functions/bootloaders.sh b/functions/bootloaders.sh
new file mode 100644
index 000..0829903
--- /dev/null
+++ b/functions/bootloaders.sh
@@ -0,0 +1,128 @@
+#!/bin/sh
+
+## live-build(7) - System Build Scripts
+## Copyright (C) 2016 Adrian Gibanel Lopez 
+##
+## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see COPYING for details.
+
+Is_Primary_Bootloader ()
+{
+   EVAL_PRIMARY_BOOTLOADER="${1}"
+
+   if [ "${LB_PRIMARY_BOOTLOADER}" = "${EVAL_PRIMARY_BOOTLOADER}" ]
+   then
+ 

Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-01-22 Thread adrian15

El 21/01/16 a las 10:13, Thomas Schmitt escribió:


Now primary means: "First lure" and secondary means "Second lure" by your
definition.


There are normally two lures per firmware-hardware combination.
Depending on the medium, the lures are recognized in El Torito,
or in MBR, or in partition tables.

In general we have theses dimensions
   {Medium: CDROM, HDD} x
   {Firmware: BIOS, EFI, ... exotic others ...} x
   {Hardware: i386, amd64, ... exotic others ...}

Not all tuples chosen from these sets are valid and not all
valid tuples can be combined in one ISO filesystem.
But the 8 main combinations for PC hardware are valid and
combinable.

I would avoid ranking terms like "first" or "primary".
Job descriptions for bootloaders could rather look like
   (CDROM + HDD, BIOS, i386 + amd64)
   (HDD, EFI, i386)
   (HDD, EFI, amd64)

Some of them can hardly be separated from each other.
E.g. (HDD, BIOS, i386) and (HDD, BIOS, amd64) have identical
technical properties.


I was thinking on this. So... what if there is a fourth dimension for 
choosing if the job description goes first or second in the mkisofs command?


E.g.:
xorriso bunch-of-options-1 -eltorito-alt-boot bunch-of-options-2
versus
xorriso bunch-of-options-2 -eltorito-alt-boot bunch-of-options-1

So you don't like the primary or secondary terms.

How does xorriso name them?

Given that man xorrisofs talks about:

-eltorito-alt-boot

maybe we can just name them as:

"Main bootloader"
and
"Alternate bootloader".

Or maybe even better:

"Main eltorito entry"
and
"Alternate eltorito entry"
?

So that we can force a given bootloader to be used only as a "Main 
eltorito entry" ?



What do you think about this idea?


adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/




Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-01-23 Thread adrian15

El 23/01/16 a las 09:21, Thomas Schmitt escribió:

There is a fourth dimension to be expressed: Bootloader.
Then there is the dimension of ISO filesystem objects.
A user wish would contain at least
   ISO-Object, Bootloader, Medium, Firmware, Architecture

E.g.

   Appended Partition, with GRUB2 content, for CDROM and HDD, via EFI, on i386

   ISO Data File, with SYSLINUX content, for HDD, via BIOS, on i386 and amd64

I am not sure whether this list of more or less combinable
dimensions is complete yet.

Further one will want to express whether the gaps between partitions
should be filled, which kinds of partition tables shall emerge, ...
These properties are global to the ISO, not specific to a single
boot image. Some are combinable, some are mutally exclusive.

(Maybe it is time to break out an UML editor.)


I propose you to send these concerns to live-wrapper project which has 
just begun and it's advertised as highly modular by Iain. It would be 
quite nice if all these concerns were properly addressed by Iain's tool.


  I am not saying that they are not welcomed to live-build but, right 
now, I think we should focus on making UEFI to boot and not re-thinking 
all the bootloader handling.



grub-mkrescue layout is rarely used for distro ISOs.
I blame this on the existing SYSLINUX based production software
for distro ISOs. In principle, a pure GRUB2 or a pure SYSLINUX
equipment appears to be the more reasonable choice.


I once asked in a Debconf why the people were so stubborn to use 
syslinux instead of using grub2 (which seems technically superior to 
me). It would seem that the same people that maintain syslinux happen to 
maintain the kernel boot stack (or whatever it is called, I mean what 
happens just after the bootloader handling the execution to the kernel). 
So, that means, it's far easier to them to debug why the kernel is 
refusing to boot.


I am personally in a favour of GRUB2-only Live CDs so that it's much 
easier to have native Super Grub2 Disk in them :) .



Maybe we can just name them as:
"Main bootloader"
and
"Alternate bootloader".


The model does not imply any ranking. "First", "Second", "Third"
could be justified, because there are lists in El Torito and
partition tables where the boot entries have to line up in sequence.

For my taste, "Main" or "Primary" too much implies a rank.


So... what about using:

FIRST_BOOTLOADER
and
SECOND_BOOTLOADER

instead of my current:

PRIMARY_BOOTLOADER
and
SECONDARY_BOOTLOADER

?

I could even add a third bootloader if needed. And, well, I have some 
ideas on how to add some special functions to binary_bootloader files so 
that we have some sort of Object-Oriented / Hook programming when 
defining what goes into the mkisofs options.


If you check current: binary_iso file it just relies on existing 
binary_bootloaders without having an agnostic bootloader approach.


Here it's what I'm talking about:

https://github.com/adrian15/live-build/blob/5eba3dff5a16a34c3c1eb5d54e3767339654e2d0/scripts/build/binary_iso#L111-L145

case "${LB_PRIMARY_BOOTLOADER}" in
grub)
(...)
grub-pc)
(...)

esac


We could just invent the:

grub-pc-xorriso-options()
or
syslinux-xorriso-options()

functions which would be defined in:

binary_grub-pc
or
binary_syslinux
files

and handle all of these with only 3 or 4 lines of code.

E.g. binary_iso would add '-eltorito-alt-boot' just before a second 
bootloader so that the bootloader only needs to take care of their own 
boot options.



Is there anyone opposed to such a big change on live-build handling of 
bootloaders?



adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/




Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-01-24 Thread adrian15

El 24/01/16 a las 16:51, Michal Suchanek escribió:

The model does not imply any ranking. "First", "Second", "Third"
could be justified, because there are lists in El Torito and
partition tables where the boot entries have to line up in sequence.

For my taste, "Main" or "Primary" too much implies a rank.



So... what about using:

FIRST_BOOTLOADER
and
SECOND_BOOTLOADER

instead of my current:

PRIMARY_BOOTLOADER
and
SECONDARY_BOOTLOADER




why not BOOTLOADERS?

The concept of being primary or secondary is just broken.

You can store 64 el-torito catalog entries on a CD. The different
entries are separated by -eltorito-alt-boot option. When you put the
CD with a BIOS and EFI entry in a machine that prefers UEFI the efi
entry is primary even when there is a CSM. When you put the CD into a
machine with legacy BIOS the BIOS entry is primary in the EFI one
useless.

There are some technical details like it is desirable to put the BIOS
entry before the EFI entry. This may be either enforced by reordering
the bootloader list automagically or just by setting the default to
syslinux,grub-efi and explaining in the docs that this is the usual
order and changing the order may potentially cause issues.

There are more technical details like the bootloader for i386 and
amd64 BIOS is the same one and on EFI it's two different binaries. Or
that when there is an EFI bootloader it's desirable to create another
e-torito entry for it as APM to boot on Macs. The technical details of
creating multiple partitions, boot entries, and whatnot are
implementation details. It's nice to document these details somewhere
for people who want to further butcher the created medium, add support
for more bootloaders, etc.

So basically what we have is support for two PC firmware types:

BIOS
EFI

and two bootloader alternatives for each firmware type

syslinux
grub

and for simlicity only one bootloader for one firmware type is
supported on single medium. Since booting on BIOS platform is well
supported with syslinux and booting on EFI platform is well-supported
with grub it is desirable to have the option to specify different
bootloader type for each supported platform and make it the default.
So rather than

BOOTLOADER=syslinux
BOOT_FIRMWARE=bios,efi

we have

BOOTLOADERS=syslinux,grub-efi

That is the bootloader name encodes the whole bootloader-firmware
pair. There is no need to specify more. It is well possible to specify
to not include 32bit efi binaries when building a 64bit CD build but
that's *-efi installation option and not a separate bootloader type.

This means the user can have 1-2 bootloaders on a single medium. And
if coreboot or whatnot support is added in the future there is
potential to have more.


Thanks

Michal



What you are describing here is what it's actually implemented in my 
patch (Well, actually the first patch version because the current one 
enforces bootloader roles). So what about primary and secondary terms? 
Or first or second terms?


These terms are used in two places:
* Internal variables and functions to handle bootloaders
* Information shown to the final user

I'm most convinced to use the first and non-first notation. So that the 
old code that referred to LB_BOOTLOADER can just refer to: 
LB_FIRST_BOOTLOADER.


Later on, if we want to improve this old code we can modify it so that 
it handles LB_BOOTLOADERS thanks to the bootloader functions directly.


I agree with you that a good approach would be to document the different 
supported or suggested bootloader combinations rather than trying to 
enforce it by code.


That would match my last thoughts which I quote here:


And, well, I have some ideas on how to add some special functions to 
binary_bootloader files so that we have some sort of Object-Oriented / Hook 
programming when defining what goes into the mkisofs options.

If you check current: binary_iso file it just relies on existing 
binary_bootloaders without having an agnostic bootloader approach.

Here it's what I'm talking about:

https://github.com/adrian15/live-build/blob/5eba3dff5a16a34c3c1eb5d54e3767339654e2d0/scripts/build/binary_iso#L111-L145

case "${LB_PRIMARY_BOOTLOADER}" in
grub)
(...)
grub-pc)
(...)

esac


We could just invent the:

grub-pc-xorriso-options()
or
syslinux-xorriso-options()

functions which would be defined in:

binary_grub-pc
or
binary_syslinux
files

and handle all of these with only 3 or 4 lines of code.

E.g. binary_iso would add '-eltorito-alt-boot' just before a second bootloader 
so that the bootloader only needs to take care of their own boot options.


Is there anyone opposed to such a big change on live-build handling of 
bootloaders?



adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/




Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-01-25 Thread adrian15



El 25/01/16 a las 16:12, Michal Suchanek escribió:

On 25 January 2016 at 03:05, adrian15  wrote:

El 24/01/16 a las 16:51, Michal Suchanek escribió:



What you are describing here is what it's actually implemented in my patch
(Well, actually the first patch version because the current one enforces
bootloader roles).


Actually, no.

Nowhere in the description is any bootloader designated primary or
secondary or first or second. On purpose.
Neither it is on my patch (initial implementation). Yes, the term 
PRIMARY_BOOTLOADER is used there for reusing old code. But using:


--bootloaders=syslinux,grub-efi

did not enforce syslinux to be in the first place or grub-efi to be in 
the second place.


That's the specific part I meant.




So what about primary and secondary terms? Or first or
second terms?


Both are broken and confusing.

Ok...


These terms are used in two places:
* Internal variables and functions to handle bootloaders
* Information shown to the final user

I'm most convinced to use the first and non-first notation. So that the old
code that referred to LB_BOOTLOADER can just refer to: LB_FIRST_BOOTLOADER.


For what piece of code we have does it make sense to reference
LB_FIRST_BOOTLOADER when not also referencing LB_SECOND_BOOTLOADER?
Will that be extended to LB_THIRD_BOOTLOADER once x86 grows support
for coreboot or l-b grows support for some other platform with many
firmware variants?

If you set bootloaders like

LB_BOOTLOADERS="syslinux grub-efi"

then you can just do

for bootloader in $LB_BOOTLOADERS ; do some $bootloader foo

Mostly what current path does but with commas instead.


after you check that you have at most two bootloaders and if you have
more than one then only the latter one ends with -efi.


This is not a good approach. You are requesting the bootloaders to end 
in "-efi". The current approach is to name them based on the Debian 
package name. These packages do not need to end in "-efi".


My use case is the following one. The final user requests:

--bootloaders=grub-efi,syslinux

so I show him:

"Warning. You are using: syslinux as a non first bootloader. This might 
work but it is not advised."


How do I know that I have to output this message?

Because I compare the internal variable:

LB_FIRST_BOOTLOADER="grub-efi"

with the bootloader name "syslinux" and I see they are not the same one.

So, as you see I need to use:

"non first bootloader" term
and
LB_FIRST_BOOTLOADER variable.

So...

1) I don't mind renaming "non first bootloader" or LB_FIRST_BOOTLOADER 
to another terminology which makes more technical sense.
2) I prefer this approach over yours (Michal) because it's the own 
bootloader which decides if it is more suited for "first bootloader" or 
not. Let's not repeat the current binary_iso design which has many 
references to the different available binary_bootloaders available.




Thanks

Michal


adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/




Bug#731709: grub-efi UEFI support based on debian-cd work complete (repos)

2016-01-26 Thread adrian15
or
10th el-torito record. The only reason we want BIOS record first is


Inside the binary_bootloader file by running a function that shows that 
warning. The author of the binary_bootloader it's who decides where it's 
advised to go.


The final place where it goes depends on the order here:

--bootloaders="syslinux,grub-efi"

I mean, the final user can decide the order but if it's not optimal he 
gets a warning.



1) some tools for butchering bootable CDs expect it to be first.

2) it's the traditional place for it (since it was the only record for
a long time) and some ancient BIOSes might potentially break if it's
not first because somebody missed there *can* be multiple entries when
coding them.


So it only has to do with the fact that syslinux is our only well
supported BIOS loader that syslinux should go first. If grub-pc was
installed as BIOS loader it should go first instead. And then you
would have to duplicate that check in grub-pc.
I don't see a problem here. I can do that thanks to the magic of 
functions that let me repeat code with only one line. I already did that 
in the last version of the patch.


( https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731709#233 - In that 
version I thought I had to enforce boot order because not doing so it 
was going to produce non bootable isos. Now I'm convinced that using non 
standard boot order do not produce non bootable isos thus a warning 
instead of stopping live build is ok. )



Let's not repeat the current binary_iso design which has many references to
the different available binary_bootloaders available.


What's wrong with referencing variables we have so that we  know
what's going on in l-b?

Thanks

Michal


Well, basically, my design rationale behind this is that with the 
current way of doing things you need to update binary_iso file each time 
a new bootloader is added.


With what I'm proposing you you wouldn't have to update it. And if a new 
bootloader might ever need binary_iso to be modified then every 
bootloader might benefit from that architecture enhancement.


adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/