Tiny Core Linux

Tiny Core Base => Micro Core => Topic started by: ulfr on August 22, 2020, 06:31:12 PM

Title: building core.gz from scratch
Post by: ulfr on August 22, 2020, 06:31:12 PM

    hi guys

    how do you build core.gz from scratch

   
    ulfr

Title: Re: building core.gz from scratch
Post by: Rich on August 22, 2020, 07:41:54 PM
Hi ulfr
Do really want to build  core.gz  from scratch, or do you just want to modify the contents?
Title: Re: building core.gz from scratch
Post by: ulfr on August 22, 2020, 07:49:57 PM

   
    thanks for your reply

    and all your work - tinycore is the best designed distro  there is   


    no i know how to modify the contents of core.gz
 
    i would like to know how you guys build core.gz 

   
    ulfr 
Title: Re: building core.gz from scratch
Post by: Rich on August 22, 2020, 08:31:01 PM
Hi ulfr
core.gz  can be created by combining  rootfs.gz  and  modules.gz  like this:
Code: [Select]
cat rootfs.gz modules.gz > core.gzYou are probably aware that  rootfs.gz  and  modules.gz  can be found under  release/distribution_files/  for each architecture:
http://tinycorelinux.net/11.x/x86/release/distribution_files/

modules.gz  is created by the  sorter.sh  script available from  Github:
https://github.com/tinycorelinux/sorter

After running  make modules  and  make modules_install  you use  sorter.sh  to create  modules.sh  and all the kernel module
extensions. You can find the instructions included in these kernel compile instructions:
http://forum.tinycorelinux.net/index.php/topic,23272.msg147325.html#msg147325

There may be a script to create  rootfs.gz  or they might just  unpack/repack  the existing  rootfs.gz.  I don't know, but I don't
think it changes very often. You can create a root directory manually in some work directory, or you can modify an existing one.

To unpack:
Code: [Select]
mkdir tempdir
cd tempdir
zcat /path/to/existing/rootfs.gz | sudo cpio -i

To repack:
Code: [Select]
sudo find . | sudo cpio -o -H newc | gzip > /path/to/new/rootfs.gz
Found here:
http://forum.tinycorelinux.net/index.php/topic,22398.msg140327.html#msg140327

Title: Re: building core.gz from scratch
Post by: ulfr on August 22, 2020, 08:42:03 PM


      thank you very much

      i was not aware of where things were or how they were built

      i will check things out   

      fascinating stuff 

      the more one learns about tinycore the more amazed and impressed one is   


      ulfr 
Title: Re: building core.gz from scratch
Post by: ulfr on August 22, 2020, 10:05:35 PM

     i would like to now how rootfsgz is built

     because it contains busybox it must have to be updated regularly 

     that would be one of the final pieces


     ulfr 
Title: Re: building core.gz from scratch
Post by: Rich on August 22, 2020, 11:10:31 PM
Hi ulfr
As I said, I don't know the details of how  rootfs.gz  is built. There is a  busybox  build script located here:
http://tinycorelinux.net/11.x/x86/release/src/busybox/

It does appear to do some kind of install, though I can't tell if it also creates all of the symlinks in  /bin  and  /sbin.
Title: Re: building core.gz from scratch
Post by: ulfr on August 22, 2020, 11:22:26 PM

    than you so much rich 

    you have been a great help   

    i will look at your link

   
    ulfr 
Title: Re: building core.gz from scratch
Post by: ulfr on August 22, 2020, 11:47:20 PM

    hi rich 

    i note that there is a script called compile tc11  x86 
   
    in     /releases/src/toolchain/   

    which appears to be the script that compiles core.gz 

    (if you want to) take a look  and tell me what you think   

 
    ulfr


   
Title: Re: building core.gz from scratch
Post by: Rich on August 23, 2020, 01:09:13 AM
Hi ulfr
I think that script just compiles all of the source packages in that directory.
Title: Re: building core.gz from scratch
Post by: Juanito on August 23, 2020, 01:10:49 AM
It does appear to do some kind of install, though I can't tell if it also creates all of the symlinks in  /bin  and  /sbin.

Yes, busybox install creates all of the symlinks.
Title: Re: building core.gz from scratch
Post by: Juanito on August 23, 2020, 01:13:02 AM
I think that script just compiles all of the source packages in that directory.

It's basically the build notes for the new toolchain, which is then copied into rootfs.gz
Title: Re: building core.gz from scratch
Post by: ulfr on August 23, 2020, 01:14:22 AM
    it has a lot of make install 

    wouldn't that put the completed binary in the proper directory after it was compiled


    ulfr 
Title: Re: building core.gz from scratch
Post by: ulfr on August 23, 2020, 01:30:37 AM

   so what is the sequence of the scripts 

   ulfr 

   
Title: Re: building core.gz from scratch
Post by: Juanito on August 23, 2020, 02:24:01 AM
It's not a script, it is just build notes - you start at the beginning and work your way to the end  ;)
Title: Re: building core.gz from scratch
Post by: ulfr on August 23, 2020, 02:55:10 AM


    thank you very much guys for all your time 

    you have set me on the path 

    i now have a good general idea of where to look and how things are done

    i'll poke around and see if i can learn a little more 

    and thanks for making such a great distro 

    its my favorite


    ulfr   


Title: Re: building core.gz from scratch
Post by: linic on April 24, 2025, 10:58:23 AM
It's not a script, it is just build notes - you start at the beginning and work your way to the end  ;)

Hi Juanito, in summary, there is no build script for rootfs.gz even for the current latest TC 16 x86. Is that right?
For example, if one wants to rebuild rootfs.gz, let's say to change
Code: [Select]
--enable-kernel=6.1.2 to
Code: [Select]
--enable-kernel=4.4.302, one would have to
Would that be it?

Also, thank you Juanito everyone for tinycore! It's fascinating!
Title: Re: building core.gz from scratch
Post by: Juanito on April 24, 2025, 11:21:21 AM
probably running an additional repacking to generate the rootfs.gz command because the build notes end with "remove files to match base/extension setup"

Not exactly, the "remove files to match base/extension setup" refers to the chroot environment.

To update rootfs.gz, you need to overwrite the existing files with the newly built files (after first stripping them) like this:
Code: [Select]
mkdir /tmp/extract
cd /tmp/extract
zcat /tmp/rootfs.gz | sudo cpio -i -H newc -d
rm /tmp/rootfs.gz

[overwrite/update existing files]

cd /tmp/extract
find | sudo cpio -o -H newc | gzip -2 > ../rootfs.gz
cd /tmp
advdef -z4 rootfs.gz

Quote
Would that be it?

Yes  :)
Title: Re: building core.gz from scratch
Post by: linic on May 10, 2025, 11:13:52 AM
Hi Juanito,

I'm interested to obtain copies of
Code: [Select]
binutils_usr.tce.list
gcc_usr_remove.tce.list
gcc_local_remove.tce.list

They are referenced in http://tinycorelinux.net/16.x/x86/release/src/toolchain/compile_tc16_x86. Are they hosted anywhere? Are there any other .tce.list files which were used in making TC16 x86? I am interested in those too.

Also, thank you for your last reply!

Oh, and the compile_tc16_x86 notes are great! I was able to compile roughly 1/3 of the required sources so far. I'm automating the steps in a couple of .sh scripts. I plan to release those scripts once I have a working result.
Title: Re: building core.gz from scratch
Post by: Juanito on May 10, 2025, 11:20:13 AM
binutils_usr.tce.list is created by:
Code: [Select]
touch mymarker
sudo make install
sudo find / -not -type 'd' -cnewer mymarker | grep -v "\/proc\/" | grep -v "^\/sys\/" | tee files
vi files (remove any obviously unneeded files)
mv files binutils_usr.tce.list

The other two were made by a similar process and then editing to leave only the files I wanted to remove.

Sorry, but I didn't keep the lists  :(
Title: Re: building core.gz from scratch
Post by: linic on May 10, 2025, 01:37:54 PM
No worries  :)

Thanks for your answer! Very interesting!
Title: Re: building core.gz from scratch
Post by: linic on May 24, 2025, 09:11:16 PM
I wrote a couple of scripts which I released here https://github.com/linic/tcc
I was able to compile all the sources mentioned in compile_tc16_x86 (http://tinycorelinux.net/16.x/x86/release/src/toolchain/compile_tc16_x86) and busybox (using the compile notes in 15.x http://tinycorelinux.net/15.x/x86/release/src/busybox/compile_busybox).
I changed some flags. I think I mentioned them all in the README.md (https://github.com/linic/tcc/blob/main/README.md)
I'm not done with repacking rootfs.gz, but I thought it was a nice state to share it.