WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Remastering ISO file for PXE boot system  (Read 5081 times)

Offline xho95

  • Newbie
  • *
  • Posts: 5
Remastering ISO file for PXE boot system
« on: March 29, 2017, 02:30:56 AM »
I have been building a system which checks computer information with in a PXE server-client system for several weeks.

My goal is running my program automatically on tiny core linux immediately after boot time.

I read the Netbooting(http://wiki.tinycorelinux.net/wiki:netbooting) article. However, that method uses the tiny core linux as the server side, so I can't use it.

I have built the pxe booting system with Ubuntu 16.04 for server and Tiny Core linux for client, and succeed booting with ISO file of Tiny Core linux.

After then I have tried to change the `bootlocal.sh` file to test the remastering of Tiny Core linux according to the Remastering TC(http://wiki.tinycorelinux.net/wiki:remastering) article.

However, executing the below command on Ubuntu 16.04 make wrong cpio file in the gz file.

Code: [Select]
$ sudo find | sudo cpio -o -H newc | gzip -2 > ~/Documents/core.gz
As shown below, the core.cpio file is crashed, so It can't boot with the PXE system.



Below are the commands which I used to make ISO file.

Code: [Select]
$ sudo mkdir /mnt/temp
$ sudo mount ~/Downloads/Tiny-Origin/TinyCore-current.iso /mnt/temp -o loop,ro
$ cp -a /mnt/temp ~/Documents/temp
$ sudo mv ~/Documents/temp/boot/core.gz ~/Documents/temp
$ sudo umount /mnt/temp

Code: [Select]
$ sudo mkdir ~/Documents/temp/extract
$ cd ~/Documents/temp/extract
$ zcat ~/Documents/temp/core.gz | sudo cpio -i -H newc -d

Code: [Select]
$ sudo vi bootlocal.sh
$ sudo geidt bootlocal.sh

echo "hello, world"

Code: [Select]
$ cd ~/Documents/temp/extract
$ sudo find | sudo cpio -o -H newc | gzip -2 > ~/Documents/core.gz
$ cd ~/Documents
$ advdef -z4 core.gz

Code: [Select]
$ cd ~/Documents/temp
$ sudo mv ~/Documents/core.gz boot
$ sudo mkdir newiso
$ sudo mv boot newiso
$ sudo mv cde newiso
$ sudo mkisofs -l -J -R -V TC-custom -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -o TC-remastered.iso newiso
$ rm -rf newiso

Are there any mistakes or are there any other solutions?

I needs your help, Thank you.
« Last Edit: March 29, 2017, 02:47:36 AM by xho95 »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: Remastering ISO file for PXE boot system
« Reply #1 on: March 29, 2017, 05:19:24 AM »
There's no mistakes, Ubuntu is just confusing you with its file name detection. Your core.gz is fine, it just happens to be the same name Ubuntu uses for crash reports.

Also, bootlocal.sh does not run interactively, so you likely won't see that echo. Echo into a file instead.

echo "Hello" > /tmp/test
The only barriers that can stop you are the ones you create yourself.

Offline xho95

  • Newbie
  • *
  • Posts: 5
Re: Remastering ISO file for PXE boot system
« Reply #2 on: March 30, 2017, 01:04:00 AM »
Thank you for your reply.

However, as your reply, Tiny Core linux would be booted well within the PXE system.

But in my case, it doesn't work as shown below.



I only extracted and re-compressed the Tiny Core linux, but did nothing else.

And core.cpio is the only difference.



Above is the correct one and the below is mine that is crashed.



Anyway, is there other solution that can run my own program or tcz file (?) on the Tiny Core linux without changing core.gz file?

Thank you.
« Last Edit: March 30, 2017, 01:05:41 AM by xho95 »

Offline polikuo

  • Hero Member
  • *****
  • Posts: 758
Re: Remastering ISO file for PXE boot system
« Reply #3 on: March 30, 2017, 01:35:14 AM »
Anyway, is there other solution that can run my own program or tcz file (?) on the Tiny Core linux without changing core.gz file?

TC can handle multiple initrds, just create your own .gz and modify the config file.
Assume that you're using syslinux:
Quote
DEFAULT tc
LABEL tc
KERNEL /boot/vmlinuz
INITRD /boot/core.gz,/boot/my_own_core.gz
APPEND .....

Offline xho95

  • Newbie
  • *
  • Posts: 5
Re: Remastering ISO file for PXE boot system
« Reply #4 on: March 30, 2017, 02:57:14 AM »
Thank you for your reply.

But as you know, I can't use the syslinux, should use the pxelinux.

And anyway if I will make my own core.gz, it should be compressed by cpio and it will be crushed as like before.

Therefore I want to know the method that use the original core.gz with my tcz program file - my own extension(?). And my tcz program should start immediately after the boot time.

Could you explain the process for it or tell me a link of some useful data?

Thank you.

Offline polikuo

  • Hero Member
  • *****
  • Posts: 758
Re: Remastering ISO file for PXE boot system
« Reply #5 on: March 30, 2017, 04:14:26 AM »
Could you explain the process for it or tell me a link of some useful data?

How I remaster
Code: [Select]
# make a root directory
mkdir -p /tmp/root/opt
# do some modification
echo 'echo Hello world > /tmp/remaster.txt' > /tmp/root/opt/bootlocal.sh
# chmod, chown
sudo chmod 775 -R /tmp/root/opt
sudo chown root:staff -R /tmp/root/opt
# compress
cd /tmp/root
sudo su
find | cpio -o -H newc | gzip -9 > /tmp/my_own_core.gz

That's it !  :D
I don't run "advdef"

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: Remastering ISO file for PXE boot system
« Reply #6 on: March 30, 2017, 04:40:59 AM »
Under the unlikely chance that Ubuntu's cpio really is that buggy, do your work under a different OS, such as TC?
The only barriers that can stop you are the ones you create yourself.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Remastering ISO file for PXE boot system
« Reply #7 on: March 30, 2017, 09:07:28 AM »
If you use an NFS directory for your tce directory, you don't need to remaster at all.  It works just like a hard/thumb drive.

Offline xho95

  • Newbie
  • *
  • Posts: 5
Re: Remastering ISO file for PXE boot system
« Reply #8 on: March 31, 2017, 03:04:50 AM »
Thank you everybody.

As your suggestion, I made a Tiny Core bootable CD and booted with it.



If I do all the work on this Tiny Core linux, everything is going to well. OK?

And is it right that I have to work here to develop my program to create a tcz file?

Anyway I'm going to try a few things.

Thank you.
« Last Edit: March 31, 2017, 03:07:04 AM by xho95 »