Bug#757697: RFE: Autodetection of architecture at boot time to load appropiate kernel
El 22/12/14 a las 01:19, Michal Suchanek escribió: Hello, On 10 August 2014 at 18:31, Adrian Gibanel Lopez adrian15...@gmail.com wrote: Source: live-config Severity: wishlist Dear Maintainer, If one has configured its Debian Live to have more than one architecture kernel this is what I am expecting would be the default behaviour is: (...) Upstream documentation: http://www.syslinux.org/wiki/index.php/Ifcpu64.c32 Thank you! While at this is it also possible to detect i486 vs i686-pae? You could do it with the current ifcpu64.c32 comboot module. This poses another problem, what to do when you have three or more than three different kernels? I prefer not to implement i486 vs i686-pae. I think it's better the patch to be accepted as-is and later to be improved if someone finds out a reasonable way of improving it for enabling i486 vs i686-pae. 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/ -- To UNSUBSCRIBE, email to debian-live-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/54b7cad1.9050...@gmail.com
Bug#757697: RFE: Autodetection of architecture at boot time to load appropiate kernel
El 15/08/14 a las 13:04, Daniel Baumann escribió: On 08/15/2014 07:12 AM, adrian15 wrote: I attach a patch for Isolinux / Syslinux implementation for cpu detection. nice, thanks. from a quick look, sounds good. will check, test, and apply next week. As suggested (by another bug) I attach both patches / commits updated so that they are based on debian-next branch. Related branch can be found at: https://github.com/adrian15/live-build/commits/rescatux_0.32_debian-next_arch_detection_rebased adrian15 -- Support free software. Donate to Super Grub Disk. Apoya el software libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/ commit 5852a69976da36abd7bcbbce95807a7a2451a7a6 Author: Adrian Gibanel Lopez adrian.giba...@btactic.com Date: Sun Dec 7 17:46:07 2014 +0100 Syslinux build now supports: Arch detection It adds a default boot option that automatically chooses either amd64 or x86 kernel depending on the detected cpu flags. diff --git a/scripts/build/binary_syslinux b/scripts/build/binary_syslinux index abd900a..d59bd05 100755 --- a/scripts/build/binary_syslinux +++ b/scripts/build/binary_syslinux @@ -233,6 +233,12 @@ case ${LB_BUILD_WITH_CHROOT} in ;; esac +# Copy necessary syslinux modules +for module in ifcpu64.c32 +do + cp chroot/usr/lib/syslinux/modules/bios/${module} ${_TARGET}/ +done + # Configuring files if [ -e ${_TARGET}/live.cfg.in ] then @@ -255,6 +261,22 @@ then ;; *) + _AMD64_486_NUMBER=0 + + for _FLAVOUR in ${LB_LINUX_FLAVOURS} + do +if [ ${_FLAVOUR} = amd64 -o ${_FLAVOUR} = 486 ] ; then + _AMD64_486_NUMBER=$((${_AMD64_486_NUMBER} + 1)) +fi + done + + if [ ${_AMD64_486_NUMBER} -ge 2 ] ; then +_AMD64_LABEL=$(cat ${_TARGET}/live.cfg.in | grep ^label | grep -v failsafe | sed 's/label //g' | sed -e s|@FLAVOUR@|amd64|g) +_486_LABEL=$(cat ${_TARGET}/live.cfg.in | grep ^label | grep -v failsafe | sed 's/label //g' | sed -e s|@FLAVOUR@|486|g) +_AUTO_LABEL=$(cat ${_TARGET}/live.cfg.in | grep ^label | grep -v failsafe | sed 's/label //g' | sed -e s|@FLAVOUR@|autodetect|g) +_AUTO_MENU_LABEL=$(cat ${_TARGET}/live.cfg.in | grep menu label | grep -v failsafe | sed 's/.*menu label //g' | sed -e s|@FLAVOUR@|auto|g) + fi + _NUMBER=0 for _FLAVOUR in ${LB_LINUX_FLAVOURS} @@ -269,7 +291,22 @@ then echo ${_TARGET}/live.cfg grep -v 'menu default' ${_TARGET}/live.cfg.in ${_TARGET}/live.cfg else - cat ${_TARGET}/live.cfg.in ${_TARGET}/live.cfg + if [ ${_AMD64_486_NUMBER} -ge 2 ] ; then + cat EOF ${_TARGET}/live.cfg +label ${_AUTO_LABEL} + menu label ${_AUTO_MENU_LABEL} + com32 ifcpu64.c32 + append ${_AMD64_LABEL} -- ${_486_LABEL} -- ${_486_LABEL} + +EOF + fi + + + if [ ${_AMD64_486_NUMBER} -ge 2 ] ; then + grep -v 'menu default' ${_TARGET}/live.cfg.in ${_TARGET}/live.cfg + else + cat ${_TARGET}/live.cfg.in ${_TARGET}/live.cfg + fi fi sed -i -e s|@FLAVOUR@|${_FLAVOUR}|g \ commit 36f781c4dc55e9a0d14cc74df5ff36f9eac2e33f Author: Adrian Gibanel Lopez adrian.giba...@btactic.com Date: Sun Dec 7 17:50:16 2014 +0100 Grub2 build now supports: Arch detection It adds a default boot option that automatically chooses either amd64 or x86 kernel depending on the detected cpu flags. diff --git a/scripts/build/binary_grub2 b/scripts/build/binary_grub2 index bf5f8ce..a23c2f9 100755 --- a/scripts/build/binary_grub2 +++ b/scripts/build/binary_grub2 @@ -60,6 +60,16 @@ Restore_cache cache/packages.binary Install_package # Local functions +Grub_live_entry_commands () +{ + KERNEL=${1} + INITRD=${2} + APPEND=${3} + + LINUX_LIVE=${LINUX_LIVE}\nlinux\t\t/${KERNEL} ${INITFS:+boot=${INITFS} }config LB_BOOTAPPEND_LIVE ${APPEND} + LINUX_LIVE=${LINUX_LIVE}\ninitrd\t\t/${INITRD} +} + Grub_live_entry () { LABEL=${1} @@ -68,8 +78,25 @@ Grub_live_entry () APPEND=${4} LINUX_LIVE=${LINUX_LIVE}\nmenuentry \Debian GNU/Linux - ${LABEL}\ { - LINUX_LIVE=${LINUX_LIVE}\nlinux\t\t/${KERNEL} ${INITFS:+boot=${INITFS} }config LB_BOOTAPPEND_LIVE ${APPEND} - LINUX_LIVE=${LINUX_LIVE}\ninitrd\t\t/${INITRD} + Grub_live_entry_commands ${KERNEL} ${INITRD} ${APPEND} + LINUX_LIVE=${LINUX_LIVE}\n} +} + +Grub_live_autodetect_entry () +{ + LABEL=${1} + AMD64_KERNEL=${2} + AMD64_INITRD=${3} + _486_KERNEL=${4} + _486_INITRD=${5} + APPEND=${6} + + LINUX_LIVE=${LINUX_LIVE}\nmenuentry \Debian GNU/Linux - ${LABEL}\ { + LINUX_LIVE=${LINUX_LIVE}\nif cpuid -l ; then + Grub_live_entry_commands ${AMD64_KERNEL} ${AMD64_INITRD} ${APPEND} + LINUX_LIVE=${LINUX_LIVE}\nelse + Grub_live_entry_commands ${_486_KERNEL} ${_486_INITRD} ${APPEND} + LINUX_LIVE=${LINUX_LIVE}\nfi LINUX_LIVE=${LINUX_LIVE}\n} } @@ -153,6 +180,29 @@ LB_BOOTAPPEND_LIVE=$(echo ${LB_BOOTAPPEND_LIVE} | sed -e 's| ||') # Assembling kernel configuration +_AMD64_486_NUMBER=0 + +for _FLAVOUR in ${LB_LINUX_FLAVOURS} +do + if [ ${_FLAVOUR} = amd64 -o ${_FLAVOUR} = 486 ] ; then +
Bug#757697: RFE: Autodetection of architecture at boot time to load appropiate kernel
Hello, On 10 August 2014 at 18:31, Adrian Gibanel Lopez adrian15...@gmail.com wrote: Source: live-config Severity: wishlist Dear Maintainer, If one has configured its Debian Live to have more than one architecture kernel this is what I am expecting would be the default behaviour is: * Add an auto entry * Auto entry will either load the Kernel64 entry is a 64bit architecture is detected or load the Kernel(not 64) entry is no 64bit architecture is detected. * In order to achieve that behaviour: ** With GRUB2 you should use cpuid -l command as seen in Rescatux grub cfg file: http://sourceforge.net/p/rescatux/git/ci/a332cbb67e10e8cc3f73bcad8e4893c1acda115a/tree/rescatux_grub.cfg Upstream documentation: http://www.gnu.org/software/grub/manual/grub.html#cpuid ** With Isolinux / Syslinux you should use the ifcpu64.c32 comboot module as seen in tails: https://git-tails.immerda.ch/tails/tree/config/binary_local- hooks/20-syslinux_detect_cpu?id=deb15c765e2b34fe587c96ca590981a59a278922 Upstream documentation: http://www.syslinux.org/wiki/index.php/Ifcpu64.c32 Thank you! While at this is it also possible to detect i486 vs i686-pae? Thanks Michal -- To UNSUBSCRIBE, email to debian-live-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/caomqctsesgjs1eycrpfv7uz-0rupk6ke0s6yoqywoo99gpb...@mail.gmail.com
Bug#757697: RFE: Autodetection of architecture at boot time to load appropiate kernel
I have these same patches available for live-build package on my live-build git repo here: Isolinux: https://github.com/adrian15/live-build/commit/4419638ab9cdfb1bacd98593e31d7f700b15a2dc Grub2 : https://github.com/adrian15/live-build/commit/a06085381ba346b576064ee84b325de54a81e33d Just in case it makes it easier to be included into upstream. Probably after Jessie release. El 15/08/14 a las 13:04, Daniel Baumann escribió: On 08/15/2014 07:12 AM, adrian15 wrote: I attach a patch for Isolinux / Syslinux implementation for cpu detection. nice, thanks. from a quick look, sounds good. will check, test, and apply next week. adrian15 -- Support free software. Donate to Super Grub Disk. Apoya el software libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/ -- To UNSUBSCRIBE, email to debian-live-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/5484900f.2080...@gmail.com
Bug#757697: RFE: Autodetection of architecture at boot time to load appropiate kernel
On 08/15/2014 07:12 AM, adrian15 wrote: I attach a patch for Isolinux / Syslinux implementation for cpu detection. nice, thanks. from a quick look, sounds good. will check, test, and apply next week. -- Address:Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern Email: daniel.baum...@progress-technologies.net Internet: http://people.progress-technologies.net/~daniel.baumann/ -- To UNSUBSCRIBE, email to debian-live-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/53ede93f.3040...@progress-technologies.net
Bug#757697: RFE: Autodetection of architecture at boot time to load appropiate kernel
El 10/08/14 18:31, Adrian Gibanel Lopez escribió: Source: live-config Severity: wishlist ** With Isolinux / Syslinux you should use the ifcpu64.c32 comboot module as seen in tails: https://git-tails.immerda.ch/tails/tree/config/binary_local- hooks/20-syslinux_detect_cpu?id=deb15c765e2b34fe587c96ca590981a59a278922 Upstream documentation: http://www.syslinux.org/wiki/index.php/Ifcpu64.c32 Thank you! I attach a patch for Isolinux / Syslinux implementation for cpu detection. Please advise how to improve the implementation so that it can be accepted upstream. 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/ diff -urN original/usr/lib/live/build/binary_syslinux fork_cpu64bit_detection/usr/lib/live/build/binary_syslinux --- original/usr/lib/live/build/binary_syslinux 2014-08-14 02:42:20.007666770 + +++ fork_cpu64bit_detection/usr/lib/live/build/binary_syslinux 2014-08-15 05:08:58.701948081 + @@ -161,6 +161,12 @@ ;; esac +# Copy necessary syslinux modules +for module in ifcpu64.c32 +do + cp chroot/usr/lib/syslinux/${module} ${_TARGET}/ +done + # Configuring files if [ -e ${_TARGET}/live.cfg.in ] then @@ -183,6 +189,22 @@ ;; *) + _AMD64_486_NUMBER=0 + + for _FLAVOUR in ${LB_LINUX_FLAVOURS} + do + if [ ${_FLAVOUR} = amd64 -o ${_FLAVOUR} = 486 ] ; then + _AMD64_486_NUMBER=$((${_AMD64_486_NUMBER} + 1)) + fi + done + + if [ ${_AMD64_486_NUMBER} -ge 2 ] ; then + _AMD64_LABEL=$(cat ${_TARGET}/live.cfg.in | grep ^label | grep -v failsafe | sed 's/label //g' | sed -e s|@FLAVOUR@|amd64|g) + _486_LABEL=$(cat ${_TARGET}/live.cfg.in | grep ^label | grep -v failsafe | sed 's/label //g' | sed -e s|@FLAVOUR@|486|g) + _AUTO_LABEL=$(cat ${_TARGET}/live.cfg.in | grep ^label | grep -v failsafe | sed 's/label //g' | sed -e s|@FLAVOUR@|autodetect|g) + _AUTO_MENU_LABEL=$(cat ${_TARGET}/live.cfg.in | grep menu label | grep -v failsafe | sed 's/.*menu label //g' | sed -e s|@FLAVOUR@|auto|g) + fi + _NUMBER=0 for _FLAVOUR in ${LB_LINUX_FLAVOURS} @@ -197,7 +219,22 @@ echo ${_TARGET}/live.cfg grep -v 'menu default' ${_TARGET}/live.cfg.in ${_TARGET}/live.cfg else - cat ${_TARGET}/live.cfg.in ${_TARGET}/live.cfg + if [ ${_AMD64_486_NUMBER} -ge 2 ] ; then + cat EOF ${_TARGET}/live.cfg +label ${_AUTO_LABEL} + menu label ${_AUTO_MENU_LABEL} + com32 ifcpu64.c32 + append ${_AMD64_LABEL} -- ${_486_LABEL} -- ${_486_LABEL} + +EOF + fi + + + if [ ${_AMD64_486_NUMBER} -ge 2 ] ; then + grep -v 'menu default' ${_TARGET}/live.cfg.in ${_TARGET}/live.cfg + else + cat ${_TARGET}/live.cfg.in ${_TARGET}/live.cfg + fi fi sed -i -e s|@FLAVOUR@|${_FLAVOUR}|g \