taking kernel config into consideration when reorder

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

taking kernel config into consideration when reorder

Gregory Edigarov-5
Hello,

Just tired a of rebooting into UKC a bit.

diff --git a/libexec/reorder_kernel/reorder_kernel.sh
b/libexec/reorder_kernel/reorder_kernel.sh
index ecd8d8fc563..7354350505a 100644
--- a/libexec/reorder_kernel/reorder_kernel.sh
+++ b/libexec/reorder_kernel/reorder_kernel.sh
@@ -66,5 +66,9 @@ make newbsd
  make newinstall
  sync

+if [[ -f /etc/kernel.conf ]]; then
+       config -ef /bsd < /etc/kernel.conf
+fi
+
  echo "\nKernel has been relinked and is active on next reboot.\n"
  cat $SHA256

Reply | Threaded
Open this post in threaded view
|

Re: taking kernel config into consideration when reorder

Solene Rapenne
On Thu, Jul 18, 2019 at 07:15:50PM +0300, Gregory Edigarov wrote:

> Hello,
>
> Just tired a of rebooting into UKC a bit.
>
> diff --git a/libexec/reorder_kernel/reorder_kernel.sh
> b/libexec/reorder_kernel/reorder_kernel.sh
> index ecd8d8fc563..7354350505a 100644
> --- a/libexec/reorder_kernel/reorder_kernel.sh
> +++ b/libexec/reorder_kernel/reorder_kernel.sh
> @@ -66,5 +66,9 @@ make newbsd
>  make newinstall
>  sync
>
> +if [[ -f /etc/kernel.conf ]]; then
> +       config -ef /bsd < /etc/kernel.conf
> +fi
> +
>  echo "\nKernel has been relinked and is active on next reboot.\n"
>  cat $SHA256
>
What is that /etc/kernel.conf file? No man page mentions it.

Reply | Threaded
Open this post in threaded view
|

Re: taking kernel config into consideration when reorder

Stuart Henderson
In reply to this post by Gregory Edigarov-5
On 2019/07/18 19:15, Gregory Edigarov wrote:

> Hello,
>
> Just tired a of rebooting into UKC a bit.
>
> diff --git a/libexec/reorder_kernel/reorder_kernel.sh
> b/libexec/reorder_kernel/reorder_kernel.sh
> index ecd8d8fc563..7354350505a 100644
> --- a/libexec/reorder_kernel/reorder_kernel.sh
> +++ b/libexec/reorder_kernel/reorder_kernel.sh
> @@ -66,5 +66,9 @@ make newbsd
>  make newinstall
>  sync
>
> +if [[ -f /etc/kernel.conf ]]; then
> +       config -ef /bsd < /etc/kernel.conf
> +fi
> +
>  echo "\nKernel has been relinked and is active on next reboot.\n"
>  cat $SHA256
>

A subsequent reboot will fail to relink because the SHA256 file has not
been updated, also rewriting the kernel at this point nullifies the sync
that was recently added for a reason.

(Also as you'd probably expect, a similar suggestion has been made
before and already rejected.)

Reply | Threaded
Open this post in threaded view
|

Re: taking kernel config into consideration when reorder

Gregory Edigarov-5
In reply to this post by Solene Rapenne

On 18.07.19 19:38, Solene Rapenne wrote:

> On Thu, Jul 18, 2019 at 07:15:50PM +0300, Gregory Edigarov wrote:
>> Hello,
>>
>> Just tired a of rebooting into UKC a bit.
>>
>> diff --git a/libexec/reorder_kernel/reorder_kernel.sh
>> b/libexec/reorder_kernel/reorder_kernel.sh
>> index ecd8d8fc563..7354350505a 100644
>> --- a/libexec/reorder_kernel/reorder_kernel.sh
>> +++ b/libexec/reorder_kernel/reorder_kernel.sh
>> @@ -66,5 +66,9 @@ make newbsd
>>   make newinstall
>>   sync
>>
>> +if [[ -f /etc/kernel.conf ]]; then
>> +       config -ef /bsd < /etc/kernel.conf
>> +fi
>> +
>>   echo "\nKernel has been relinked and is active on next reboot.\n"
>>   cat $SHA256
>>
> What is that /etc/kernel.conf file? No man page mentions it.

Sorry for not providing manual page. I am not a native speaker.
/etc/kernel.conf is simply a file that contains UKC commands one per
line ending with quit

mine is:
greg@lbld12 ~ # cat /etc/kernel.conf

disable pcppi

quit

also updated diff, now reevaluates sha256 if kernel is changed by config
as pointed by Stuart Henderson.

diff --git a/libexec/reorder_kernel/reorder_kernel.sh
b/libexec/reorder_kernel/reorder_kernel.sh
index ecd8d8fc563..90bf4364421 100644
--- a/libexec/reorder_kernel/reorder_kernel.sh
+++ b/libexec/reorder_kernel/reorder_kernel.sh
@@ -66,5 +66,10 @@ make newbsd
  make newinstall
  sync

+if [[ -f /etc/kernel.conf ]]; then
+       config -ef /bsd < /etc/kernel.conf
+       sha256 -h $SHA256 /bsd
+fi
+
  echo "\nKernel has been relinked and is active on next reboot.\n"
  cat $SHA256

Reply | Threaded
Open this post in threaded view
|

Re: taking kernel config into consideration when reorder

Gregory Edigarov-5

On 19.07.19 11:12, Gregory Edigarov wrote:

>
> On 18.07.19 19:38, Solene Rapenne wrote:
>> On Thu, Jul 18, 2019 at 07:15:50PM +0300, Gregory Edigarov wrote:
>>> Hello,
>>>
>>> Just tired a of rebooting into UKC a bit.
>>>
>>> diff --git a/libexec/reorder_kernel/reorder_kernel.sh
>>> b/libexec/reorder_kernel/reorder_kernel.sh
>>> index ecd8d8fc563..7354350505a 100644
>>> --- a/libexec/reorder_kernel/reorder_kernel.sh
>>> +++ b/libexec/reorder_kernel/reorder_kernel.sh
>>> @@ -66,5 +66,9 @@ make newbsd
>>>   make newinstall
>>>   sync
>>>
>>> +if [[ -f /etc/kernel.conf ]]; then
>>> +       config -ef /bsd < /etc/kernel.conf
>>> +fi
>>> +
>>>   echo "\nKernel has been relinked and is active on next reboot.\n"
>>>   cat $SHA256
>>>
>> What is that /etc/kernel.conf file? No man page mentions it.

oops, the updated diff, to sync after reconfig is done

diff --git a/libexec/reorder_kernel/reorder_kernel.sh
b/libexec/reorder_kernel/reorder_kernel.sh
index ecd8d8fc563..c2b726281c2 100644
--- a/libexec/reorder_kernel/reorder_kernel.sh
+++ b/libexec/reorder_kernel/reorder_kernel.sh
@@ -66,5 +66,11 @@ make newbsd
  make newinstall
  sync

+if [[ -f /etc/kernel.conf ]]; then
+       config -ef /bsd < /etc/kernel.conf
+       sync
+       sha256 -h $SHA256 /bsd
+fi
+
  echo "\nKernel has been relinked and is active on next reboot.\n"
  cat $SHA256

Reply | Threaded
Open this post in threaded view
|

Re: taking kernel config into consideration when reorder

Martian67
In reply to this post by Stuart Henderson
> A subsequent reboot will fail to relink because the SHA256 file has not
> been updated, also rewriting the kernel at this point nullifies the sync
> that was recently added for a reason.
>
> (Also as you'd probably expect, a similar suggestion has been made
> before and already rejected.)

Out of curiosity, what was the reason this idea was rejected? I'd be
interested in writing a patch that addressed them if possible.