Skip to content

Conversation

@mkikets99
Copy link

This also includes:

  • cosmetic changes
  • bug fixes
  • preparation for iso build
  • folder-like static and templates

@mkikets99
Copy link
Author

I am going to change a way how it execute phases.
It will be a loop with executing of same command strokes:

  • run_before_{PHASENAME} function will be skipped if not exists
  • build_phase {PHASENAME} {SECTION} function
  • run_after_{PHASENAME} function will be skipped if not exists
  • $ONEOFF && $FOUNDSTARTPHASE && unmount_image && exit

Is it ok?

mkikets99 added 2 commits May 15, 2022 15:38
Added `run_before` and `run_after` functions
also done folder like style for `static` and `templates`
version-check.sh Outdated
if [ -x dummy ]
then echo "g++ compilation OK";
else echo "g++ compilation failed"; fi
rm -f dummy.c dummy
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file isn't necessary since it's already built in to the script with mylfs.sh --check

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but there is some output issues with some files, like yacc...
I think that ill just set it in .gitignore...

# unmount and detatch image
unmount_image

echo "build successful."
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that you moved this into a separate function

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it cause iso will work separately from building

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah makes complete sense, even without the iso build


```
$ sudo ./build.sh --help
$ sudo ./mylfs.sh --help
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof, can't believe I missed that

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That what i meant in #6

rm -rf $LFS/usr/share/{info,man,doc}/*
find $LFS/usr/{lib,libexec} -name \*.la -delete
rm -rf $LFS/tools
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I like this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will make Sections with phases more mobile and modular

export PATCH_GLIBC=https://www.linuxfromscratch.org/patches/lfs/11.1/glibc-2.35-fhs-1.patch
export PATCH_KBD=https://www.linuxfromscratch.org/patches/lfs/11.1/kbd-2.4.0-backspace-1.patch
export PATCH_PERL=https://www.linuxfromscratch.org/patches/lfs/11.1/perl-5.34.0-upstream_fixes-1.patch
export PATCH_SYSLINUX=https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-boot/syslinux/files/syslinux-6.03-sysmacros.patch
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I understand syslinux is some kind of bootloader. Will it "replace" GRUB whenever the script builds an ISO? Or will they need to coexist?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grub will operate a boot of vmz and imglinux files. Syslinux helps to boot them from fat systems on which iso operates and boots.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that they will cooperate...
But RN i have some issues with building syslinux... Must check how it built from that project.

-t|--phase-id Specify which portion of script you need to execute. If
not specified, will run 'lfs' scripts.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong, but it seems like we would only be able to build one "STARTSECTION" at a time. Is that right? I kind of like the idea of being able to build everything I need in a single command, like so:

sudo ./mylfs.sh --build-all --extend path/to/extension
rather than
sudo ./mylfs.sh --build-all --phase-id lfs && sudo ./mylfs.sh --build-all --phase-id path/to/extension

And I kind of prefer the --extend parameter name to the --phase-id parameter name. But I like where you are going with grouping phases together under a single directory.

so my_extension/ might have:
phase1/
phase2/

sudo ./mylfs.sh --build-all --extend path/to/my_extension would build the lfs phases AND the my_extension phases all in one go. Thoughts?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... what if make --extend as array? So when you add more of them they will build up in a list and build one by one...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then i will just edit some of Build Extension function to work with multiple values
And it will auto start after the building...
But then something additional option needed, cause sometimes it can broke on extension, but not on the lfs part

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, storing it as an array could work. And you could pass the extensions in either like --extend path1 --extend path2... or --extend path1,path2,.... Up to you.

As for restarting after a break in an extension, you could add another param like you mentioned:

# after a failure in 'my_extension'
sudo ./mylfs.sh --extend my_extension --start-extension my_extension --start-phase 2 --start-package some_package

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also make it clear that the order in which you specify extensions is important, since that will be the order in which they are built.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. so i'll redo changes for --phase-id and extend more functionality on --extend

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And you could pass the extensions in either like --extend path1 --extend path2... or --extend path1,path2,.... Up to you.

I am more prefer to have a multiple, or separated with : - like a PATH separation
So... About multiple - it will be working soon.
A oneliner - must do a separation function. But after that it will work with any symbol.

HOUT+=$(repeat_echo ${#SSTR} '#';echo)
HOUT+="\n# ${SSTR}\n"
HOUT+="# $(repeat_echo ${#SSTR} '~';echo)"
echo -e $HOUT
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: this is a cosmetic change
This will make automatic top and bottom line for text

@krglaws
Copy link
Owner

krglaws commented May 15, 2022

regarding the missing GRUB build, it seems that one of the build scripts is messing with STDIN (which affects the while read loop), and that's why it skips the grub line in build_order.txt. https://stackoverflow.com/questions/13800225/while-loop-stops-reading-after-the-first-line-in-bash

I'm thinking one of the commands in phase4/linux.sh must be reading STDIN and accidentally pulling "grub" out of the stream before the while loop gets to it.

Possible fixes:

  • manually run the linux script in chroot to find out which command is reading stdin
  • change the while loop in build_phase to not rely on stdin, and thereby keep the loop safe from whatever the scripts are doing

@mkikets99
Copy link
Author

mkikets99 commented May 15, 2022

regarding the missing GRUB build, it seems that one of the build scripts is messing with STDIN (which affects the while read loop), and that's why it skips the grub line in build_order.txt. https://stackoverflow.com/questions/13800225/while-loop-stops-reading-after-the-first-line-in-bash

I'm thinking one of the commands in phase4/linux.sh must be reading STDIN and accidentally pulling "grub" out of the stream before the while loop gets to it.

Possible fixes:

  • manually run the linux script in chroot to find out which command is reading stdin
  • change the while loop in build_phase to not rely on stdin, and thereby keep the loop safe from whatever the scripts are doing

I'm on my way to check it...
I'll search it on lfs book, and its rebuilding again with # on linux,grub and syslinux

There is also something with syslinux... it can't build cause it can't link something... more old script analyzing on the go

@mkikets99
Copy link
Author

mkikets99 commented May 15, 2022

regarding the missing GRUB build, it seems that one of the build scripts is messing with STDIN (which affects the while read loop), and that's why it skips the grub line in build_order.txt. https://stackoverflow.com/questions/13800225/while-loop-stops-reading-after-the-first-line-in-bash

I'm thinking one of the commands in phase4/linux.sh must be reading STDIN and accidentally pulling "grub" out of the stream before the while loop gets to it.

Possible fixes:

  • manually run the linux script in chroot to find out which command is reading stdin
  • change the while loop in build_phase to not rely on stdin, and thereby keep the loop safe from whatever the scripts are doing

Founded. it is on make command:

  1. Enable legacy fbdev support for your modesetting driver (DRM_FBDEV_EMULATION) [Y/n/?] (NEW)
    1.1. if Y - Overallocation of the fbdev buffer (DRM_FBDEV_OVERALLOC) [100] (NEW)
    ....
  2. Enable firmware EDID (FIRMWARE_EDID) [N/y/?] (NEW) - FB section is on so it is called
  3. Enable legacy fbcon hardware acceleration code (FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION)
    .....
  4. Bootup logo (LOGO) [N/y/?] (NEW)
  5. Select compiled-in fonts (FONTS) [N/y/?] (NEW)
    If you want i can check all Keys with their default values that are needed to add.

@mkikets99
Copy link
Author

mkikets99 commented May 15, 2022

@krglaws
Yoo-hoo.. having a progress with VM...
It loaded a Kernel-panic.... at least it loaded a vmz for it
I'll send some picks on discussion page

@krglaws
Copy link
Owner

krglaws commented May 15, 2022

Awesome! I'm gonna be AFK most of today and tomorrow probably. But I'll be able to check in here and there. Seems like we are going to need to fix those prompts in the linux.sh script. I'll think about it in the meantime

@mkikets99
Copy link
Author

One more edit on build_extension and i'll remove mainLFSbuild and set a build_extension lfs for it

mkikets99 added 5 commits May 16, 2022 15:51
Preparing to have a list of linux kernel parameters that are out of the list
Next:
 - Linux kernel build fixup
 - Searching for `vmz` aka `vmlinux` build in BLFS
 - Defining whats wrong with `syslinux` build
 - remaking `example_extension` folder to be like `lfs-build` folder
@mkikets99
Copy link
Author

mkikets99 commented May 17, 2022

The last one needs testing on that section...
Also, i must add checker if LFS built completely, or not... so extensions would not start if it is not...
Also, i think, it would be better if Build instructions for build_phase and build_package would be in config.sh or build.config.sh

mkikets99 added 14 commits May 17, 2022 14:22
- Moved syslinux to phase5
- `logs` are now inside of extensions, Or it is better to be `logs/$SECTION/$PKG.log`?
… while building phases (and clearing after it) and now no input issue on`read` command inside of `build_phase`

Also some TODO.txt enhancements and echo additions (like `Ending of building phase`
thinking on a idea with pkgs_used.txt
…timer with `--time`, fixed issue with $NAMEOVERRIDE to be empty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants