WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Booting Core with custom files on top of the standard files  (Read 293 times)

Offline tdarst

  • Newbie
  • *
  • Posts: 3
Booting Core with custom files on top of the standard files
« on: October 01, 2025, 01:10:13 PM »
Hi, I'm not a super experienced Linux user by any stretch and I'm new to this community, so bear with me please.

I am working on utilizing Core with something called V86 to deliver users a working Linux terminal in their browser but I would like to be able to create variations of the ISO file to automatically boot into different scenarios.

Since the user will get a fresh boot every time they access the pages hosting this terminal I was trying to edit the core.gz file, specifically this part

^@^@^@070701030B8027000081ED00000000000000320000000168D5627C00000033000000080000000200000000000000000000001100000000opt/bootlocal.sh^@^@#!/bin/sh
# put other system startup commands here
mkdir /testdir

with /testdir as my check to see if I was successfuland then zip it back up and re-create the ISO. However when I re-create the ISO and boot back into it in the browser, bootlocal.sh just shows

#!/bin/sh
# put other system startup commands here

So I'm guessing that I am editing the wrong thing. But I feel kind of lost and was hoping somebody could help point me in the right direction.

Thanks!

Offline polikuo

  • Hero Member
  • *****
  • Posts: 779
Re: Booting Core with custom files on top of the standard files
« Reply #1 on: October 01, 2025, 07:54:01 PM »
Hi, tdarst.
Sometimes I make a custom.gz for easier maintainance.
Just edit the boot config with somthing like.
Code: [Select]
INITRD core.gz,custom.gzThat's syslinux, you'll need to look up syntax for grub2.
The files in the later gz should be able to overwrite the earlier ones.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12257
Re: Booting Core with custom files on top of the standard files
« Reply #2 on: October 01, 2025, 09:41:01 PM »
Hi tdarst
Welcome to the forum.

You can't edit core.gz directly. You need to unpack it, edit the file
of interest, then repack it:
Code: [Select]
#   Pack/unpack core.gz
#       To unpack
tc@E310:~$ mkdir tempdir
tc@E310:~$ cd tempdir
tc@E310:~/tempdir$ zcat /path/to/existing/core.gz | sudo cpio -i

#       Make changes to ~/tempdir/opt/bootlocal.sh

#       To repack
tc@E310:~$ cd ~/tempdir
tc@E310:~/tempdir$ sudo find . | sudo cpio -o -H newc | gzip > /path/to/new/core_modified.gz
# Point the boot loader to core_modified.gz instead of core.gz

What polikuo suggests is probably simpler:
Code: [Select]
tc@E310:~$ mkdir -p tempdir/opt
tc@E310:~$ cd tempdir/opt
tc@E310:~$ touch bootlocal.sh
tc@E310:~$ chown tc:staff bootlocal.sh
tc@E310:~$ chmod 775 bootlocal.sh

# Edit ~/tempdir/opt/bootlocal.sh so it contains the contents you want

#       To pack
tc@E310:~$ cd ~/tempdir
tc@E310:~/tempdir$ sudo find . | sudo cpio -o -H newc | gzip > /path/to/new/custom.gz
Note: Do not edit Linux files using Windows.

Update the boot loader to include custom.gz after core.gz.

Offline gadget42

  • Hero Member
  • *****
  • Posts: 961
Re: Booting Core with custom files on top of the standard files
« Reply #3 on: October 02, 2025, 12:55:30 AM »
** WARNING: connection is not using a post-quantum kex exchange algorithm.
** This session may be vulnerable to "store now, decrypt later" attacks.
** The server may need to be upgraded. See https://openssh.com/pq.html

Offline gadget42

  • Hero Member
  • *****
  • Posts: 961
Re: Booting Core with custom files on top of the standard files
« Reply #4 on: October 02, 2025, 01:53:42 AM »
am assuming OP OT reference to "v86" refers to:

https://github.com/copy/v86
** WARNING: connection is not using a post-quantum kex exchange algorithm.
** This session may be vulnerable to "store now, decrypt later" attacks.
** The server may need to be upgraded. See https://openssh.com/pq.html

Offline tdarst

  • Newbie
  • *
  • Posts: 3
Re: Booting Core with custom files on top of the standard files
« Reply #5 on: October 02, 2025, 11:41:43 AM »
Hi tdarst
Welcome to the forum.

You can't edit core.gz directly. You need to unpack it, edit the file
of interest, then repack it:
Code: [Select]
#   Pack/unpack core.gz
#       To unpack
tc@E310:~$ mkdir tempdir
tc@E310:~$ cd tempdir
tc@E310:~/tempdir$ zcat /path/to/existing/core.gz | sudo cpio -i

#       Make changes to ~/tempdir/opt/bootlocal.sh

#       To repack
tc@E310:~$ cd ~/tempdir
tc@E310:~/tempdir$ sudo find . | sudo cpio -o -H newc | gzip > /path/to/new/core_modified.gz
# Point the boot loader to core_modified.gz instead of core.gz

What polikuo suggests is probably simpler:
Code: [Select]
tc@E310:~$ mkdir -p tempdir/opt
tc@E310:~$ cd tempdir/opt
tc@E310:~$ touch bootlocal.sh
tc@E310:~$ chown tc:staff bootlocal.sh
tc@E310:~$ chmod 775 bootlocal.sh

# Edit ~/tempdir/opt/bootlocal.sh so it contains the contents you want

#       To pack
tc@E310:~$ cd ~/tempdir
tc@E310:~/tempdir$ sudo find . | sudo cpio -o -H newc | gzip > /path/to/new/custom.gz
Note: Do not edit Linux files using Windows.

Update the boot loader to include custom.gz after core.gz.


Cool, this is really helpful, thanks for the guidance! I have so far tried method one here. Sorry to bother you for more info but what method do you use to re-pack the iso file? I had a method that was working and I'm not sure if there's something that I'm now doing differently that I'm not realizing, but I'm getting errors now when booting into the re-made iso file about not being able to find /proc/cmdline and mount: you must be root, even if I haven't changed anything after un-packing the iso.

For information my command I'm using is:
mkisofs -l -J -R -V "CoreCustom" \
  -b boot/isolinux/isolinux.bin \
  -c boot/isolinux/boot.cat \
  -no-emul-boot -boot-load-size 4 -boot-info-table \
  -o CoreCustom.iso ~/isop/ison/

Offline tdarst

  • Newbie
  • *
  • Posts: 3
Re: Booting Core with custom files on top of the standard files
« Reply #6 on: October 02, 2025, 11:42:19 AM »
am assuming OP OT reference to "v86" refers to:

https://github.com/copy/v86

This is what I'm referring to.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12257
Re: Booting Core with custom files on top of the standard files
« Reply #7 on: October 02, 2025, 08:18:43 PM »
Hi tdarst
I've never needed to make an ISO, but I did some digging
and found this:
Code: [Select]
mkisofs -pad -l -r -J -V Core -no-emul-boot -boot-load-size 4 \
-boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
-hide-rr-moved -o iso/"$RELEASE".iso master

Also, if you named the initrd core_modified.gz, you also need to
update isolinux/isolinux.cfg to reflect that change:
Code: [Select]
display boot.msg
default microcore
label microcore
        kernel /boot/vmlinuz
        initrd /boot/core_modified.gz
        append loglevel=3

label mc
        kernel /boot/vmlinuz
        append initrd=/boot/core_modified.gz loglevel=3
implicit 0
prompt 1
timeout 300
F1 boot.msg
F2 f2
F3 f3
F4 f4