Rationalisation of init
Where to from here?
Following my success with testing aufs stacks in the "init" environment, I have a revised plan for updating the actual "init".
1. Cut search_func into 2, savefile/savefolder stuff becomes search_save_func
2. search_func is reduced to decoding all boot parameters and finding pup...sfs, setting PDEV1
if PDRVDEV is set:
if PDRVFN is empty set to PUPXXXSFS
if /mnt/pdrv$PSUBDIR/$PDRVFN exists, set PDEV1
else search for $PSUBDIR/$PUPXXXSFS as diligently as it was for "vmlinux", set PDEV1 if found
if PDEV1 set DEV1FS and other "vmlinux found" stuff
3. Remove all load sfs code from "LOADING PUPPY FILES" section
4. algorithm becomes:
do search_func stuff
load sfs's to pupmode=5 aufs stack
establish SAVEPART
do "insmod" stuff
do search_save_func
load savefile/savefolder
update aufs stack with savefile/savefolder
continue on to switch root
5. Complete change to use only a single tmpfs.
6. Cleanup more possibly reduntant code, e.g. setting the aufs layer variables in beginning of "LOADING PUPPY FILES" section.
As this has now become a coding exercise, when I have a modified "init" I will open a thread in "Cutting edge" for discussion of the code.
To encourage others to contribute, it might be handy to do this as a file on git-hub in a repository to which I, and others have direct access.
I'm not sure how to set that up.
@jlist, I don't have direct access to the initrd_progs repo.
At the moment the only git-hub repositories I have direct access to, are the forks in my git-hub account.
By "direct access" I mean something I can push "commits" to, using git on my local machine.
gyro
1. Cut search_func into 2, savefile/savefolder stuff becomes search_save_func
2. search_func is reduced to decoding all boot parameters and finding pup...sfs, setting PDEV1
if PDRVDEV is set:
if PDRVFN is empty set to PUPXXXSFS
if /mnt/pdrv$PSUBDIR/$PDRVFN exists, set PDEV1
else search for $PSUBDIR/$PUPXXXSFS as diligently as it was for "vmlinux", set PDEV1 if found
if PDEV1 set DEV1FS and other "vmlinux found" stuff
3. Remove all load sfs code from "LOADING PUPPY FILES" section
4. algorithm becomes:
do search_func stuff
load sfs's to pupmode=5 aufs stack
establish SAVEPART
do "insmod" stuff
do search_save_func
load savefile/savefolder
update aufs stack with savefile/savefolder
continue on to switch root
5. Complete change to use only a single tmpfs.
6. Cleanup more possibly reduntant code, e.g. setting the aufs layer variables in beginning of "LOADING PUPPY FILES" section.
As this has now become a coding exercise, when I have a modified "init" I will open a thread in "Cutting edge" for discussion of the code.
To encourage others to contribute, it might be handy to do this as a file on git-hub in a repository to which I, and others have direct access.
I'm not sure how to set that up.
@jlist, I don't have direct access to the initrd_progs repo.
At the moment the only git-hub repositories I have direct access to, are the forks in my git-hub account.
By "direct access" I mean something I can push "commits" to, using git on my local machine.
gyro
Ok gyro, initrd_progs is somewhat restricted to members of the team, those who have write access to all woofce repos, well, everybody else has to open pull requests ( just like i used to).
I'm certainly quick to merge pull requests so that could be the place, i also think you should a member, or at least have write access to that repo, i'll send a message to micko..
Well, this is what I used to do.... add commits then open a pull request every few days with all the commits... while the pull request was open i kept adding commits to document the changes.. initrd_progs is a place to experiment and push anything and that's what i did until it was ready....
I'm certainly quick to merge pull requests so that could be the place, i also think you should a member, or at least have write access to that repo, i'll send a message to micko..
Well, this is what I used to do.... add commits then open a pull request every few days with all the commits... while the pull request was open i kept adding commits to document the changes.. initrd_progs is a place to experiment and push anything and that's what i did until it was ready....
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
I would suggest starting from this:
https://github.com/landley/aboriginal/b ... in/init.sh
Its pretty simplified already, but it unnecessarily parses /proc/cmdline - the kernel passes parameters of the format *=* to envp/environ (environment variable in shell) and other parameters without an equal sign to argv ($@ in shell)
In shell you can use a default variable parameter like this:or this:
for the kernel arguments without an equal sign:
BTW every single line of code involved with searching is bloat
https://github.com/landley/aboriginal/b ... in/init.sh
Its pretty simplified already, but it unnecessarily parses /proc/cmdline - the kernel passes parameters of the format *=* to envp/environ (environment variable in shell) and other parameters without an equal sign to argv ($@ in shell)
In shell you can use a default variable parameter like this:
Code: Select all
${init:-/linuxrc} #run the init set in the env var $init if it is set, otherwise run /linuxrc
Code: Select all
#defaultinit=/init
defaultinit=/linuxrc
${init:-${defaultinit:-/init}}
#pass init=whatever on the kernel command line
Code: Select all
while [ "$1" ]; do
case "$1" in
quiet)QUIET=1;;
#other cases here
*): DO NOTHING;;
esac
shift
done
[ "$QUIET" ] || echo now doing step XX
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
Fallback when specification fails
The current "init" tries to be too "friendly" in what it does when a specified partition or file is not found.
If anything is specified and not found, "init" should act as though the file is not present.
It should not fallback to the default file, and use that, as the current "init" tries to do.
Why?
So that you get immediate feedback that the spec is incorrect.
If you're specifying an alternative sfs to test something, and it boots fine. The obvious assumption is that the test sfs is fine.
But if there is a typo in your spec, and "init" used the default sfs instead, then your assumption is incorrect.
You're more likely to notice if the sfs is missing from the boot.
(Of course it also makes the code simpler.)
gyro
If anything is specified and not found, "init" should act as though the file is not present.
It should not fallback to the default file, and use that, as the current "init" tries to do.
Why?
So that you get immediate feedback that the spec is incorrect.
If you're specifying an alternative sfs to test something, and it boots fine. The obvious assumption is that the test sfs is fine.
But if there is a typo in your spec, and "init" used the default sfs instead, then your assumption is incorrect.
You're more likely to notice if the sfs is missing from the boot.
(Of course it also makes the code simpler.)
gyro
unfortunately bloat is necessary .
there are too many possibilities of HW configurations available,
so testing needs done.
I have my own init code to speed up the search.
My init code accepts parameters like sfsload=oldsyle|new that is to load the sfs
and lastly the puppy.sfs and zdrv.sfs ;
and pupmode=X to force a pupmode and if X is something unknown falls back to 5 something like that ; instead editing the init to change 12 to 13 and such .
But I rub fukk installs on pupmode 2 mostly.
I wish you good luck
there are too many possibilities of HW configurations available,
so testing needs done.
I have my own init code to speed up the search.
My init code accepts parameters like sfsload=oldsyle|new that is to load the sfs
and lastly the puppy.sfs and zdrv.sfs ;
and pupmode=X to force a pupmode and if X is something unknown falls back to 5 something like that ; instead editing the init to change 12 to 13 and such .
But I rub fukk installs on pupmode 2 mostly.
I wish you good luck
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P
Re: Fallback when specification fails
Is it possible to include user interaction at this point so that the following occurs?:gyro wrote:If anything is specified and not found, "init" should act as though the file is not present. It should not fallback to the default file, and use that, as the current "init" tries to do.
Why?
So that you get immediate feedback that the spec is incorrect.
- file not found
- tell user file not found
- ask user if they want further searches done or not (in case new user unsure how to proceed and wants to see if anything else CAN automatically be found - so they may end up with a clue where the file actually was)
- ie: no automatic searches performed without at least asking the user.
Re: Fallback when specification fails
No.greengeek wrote:Is it possible to include user interaction at this point so that the following occurs?
1. With "huge-kernels" there are no kernel modules ordinarily available to "init", so any device requiring kernel modules to work, will not work while "init" is running, this includes some keyboards. (I have one.)
Currently only the savefile/savefolder code in "init" requires keyboard input.
One of the aims of the rewrite is to get the sfs files loaded so that the "initmodules" facility can "insmod" any keyboard required modules before the keyboard is needed.
Adding more keyboard interaction during "init" only makes an already complicated situation more complicated.
2. I don't consider folk who are specifying alternate sfs files via boot parameters to be complete noobies.
gyro
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
Re: Fallback when specification fails
If you need to load kernel modules during init, the kernel is configured wrong. Just change tne CONFIG_XXXX=M to =Y for everything referenced in init - there should be no modules in the initramfs/initrd.gyro wrote:One of the aims of the rewrite is to get the sfs files loaded so that the "initmodules" facility can "insmod" any keyboard required modules before the keyboard is needed.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
-
- Posts: 1543
- Joined: Mon 22 Feb 2016, 19:43
Do the templates in kernel-kit/configs_extra comply with this? I think there's 12 of them in there.jlst wrote:That leads us to kernel-kit and the huge kernels already built. When compiling a kernel, one needs to be sure that all (or almost all) modules that have to do with keyboard input are builtin.. if a huge kernel does not comply with this, then it should be deleted immediately...
edit: Nevermind, I think gyro answered this in the next post.
Last edited by Sailor Enceladus on Sat 25 Jun 2016, 02:03, edited 3 times in total.
Re: Fallback when specification fails
Correct, except for, where is this mythical list of all the modules that are needed?technosaurus wrote:If you need to load kernel modules during init, the kernel is configured wrong. Just change tne CONFIG_XXXX=M to =Y for everything referenced in init - there should be no modules in the initramfs/initrd.gyro wrote:One of the aims of the rewrite is to get the sfs files loaded so that the "initmodules" facility can "insmod" any keyboard required modules before the keyboard is needed.
My keyboard works with 666philb's kernels, but not with 01micko's. (not a big deal for me, since I then use "initmodules", with a 01micko kernel.)
666philb used to have a problem with a particular USB port, that required a module, (fixed in his kernels now.)
The end result is a kernel that conatins everything that looks slightly like it might be needed.
But stiil, at any time someone can start using new hardware that is only supported with a new kernel module, thus making all existing kernels obselete.
And until the new kernel's are available, the user has the "no keyboard during init" problem.
Edit:
Making the "huge-kernel" modules available during "init", we can do.
The remaining problem is; how do we sort out what is the minimal set of modules that need to be loaded to enable the keyboard?
The only current solution is "intmodules".
gyro
Last edited by gyro on Sat 25 Jun 2016, 06:05, edited 1 time in total.
I haven't got to the upgrading code yet.jlst wrote:gyro, watching the logs I see vercmp complains about a wrong syntax... i made sure the busybox vercmp works the same as the standalone app.
This happens when one of the operands is empty, so I wonder if there is something to delete there...
I'm currently working with my new minimilist init script to sortout all the new stuff.
Once that is working I will start porting this code into the current init. (First action, delete obsolete stuff.)
And/Or port the current stuff that is missing in my new init, from the current init to my new init.
gyro
Sounds nice, but at any time, new hardware could invalidate all previous kernels.jlst wrote:That leads us to kernel-kit and the huge kernels already built. When compiling a kernel, one needs to be sure that all (or almost all) modules that have to do with keyboard input are builtin.. if a huge kernel does not comply with this, then it should be deleted immediately...
My keyboard worked in "init" with old kernels, because there was no module peculiar to it. But then latter kernels introduced a new module to provide full support for my keyboard. It then stopped working during "init". (Fixed in 666philb's kernels.)
gyro
I have found a difficulty with searching for pup...sfs instead of vmlinuz, PDEV1 won't be set if pup...sfs is included in the initrd.gz.
A "humongous initrd" puppy will probably still boot, but PUPSTATE will have a couple of empty variables, unless the user adds a "pupsfs=xxx" boot parameter.
gyro
A "humongous initrd" puppy will probably still boot, but PUPSTATE will have a couple of empty variables, unless the user adds a "pupsfs=xxx" boot parameter.
gyro
Last edited by gyro on Sat 25 Jun 2016, 05:55, edited 1 time in total.
My testing has found no problem with the blkid in the tahrpup 6.0.5 initrd.gz.jlst wrote:i think we should use the full blkid in the initrd, it's just more robust at everything, but a bit slower too
My test init script relies on blkid to decode Label's into partition names, and so far this has been reliable in both ata and usb boots.
I have not discovered any need to replace it.
gyro