Tiny Core Base > Raspberry Pi

Concatenate initramfs on Windows

(1/4) > >>

sodface:
I was goofing around tonight with picore 6.0 and made a small initramfs with just the w1 kernel module tcz in it (~62k).  As an experiment, on my windows laptop I wrote the picore 6.0 image to sd card as usual.  I moved the 6.0.gz file off the card into a directory on my laptop where I had my extra initramfs file (my_initramfs.gz).  Then I renamed 6.0.gz to 6.0.gz.orig and tacked the two together to create a new 6.0.gz:


--- Code: --- copy /b 6.0.gz.orig + my_initramfs.gz 6.0.gz
--- End code ---

Then I moved the 6.0.gz back onto the sd card and inserted into pi and booted... it booted fine and the contents of my_initramfs.gz were in the root file system where expected (I built my_initramfs.gz to extract to /tmp/builtin/optional).

I didn't have to edit any boot files or anything else other than combine the two initramfs files and replace the original.  Not sure what the use case is but I was pleasantly surprised that it worked first try.

sodface:
Maybe this is kind of a pointless thread but anyway, just to see if I could get it working, I built another version of my_initramfs.gz with the following extensions for wifi and ssh:

libiw.tcz
libnl.tcz
ncurses.tcz
openssh.tcz
openssl-1.0.1.tcz
readline.tcz
wifi.tcz
wireless-3.12.36-piCore+.tcz
wireless_tools.tcz
wpa_supplicant.tcz

Connected once to my WLAN to create the wifi.db, updated bootlocal.sh to start wifi on boot etc. and then did filetool.sh -b to get a good mydata.tgz.

Then formatted an SD card with FAT32, used 7zip to copy all the boot files out of the piCore 6.0 .img file and onto the sd card.  Combined the 6.0.gz and my_initramfs.gz into a new 6.0.gz as in previous post and replaced the original on the sd card.  Placed a copy of mydata.tgz on the sd card also.

Pi booted fine, loaded extensions, restored mydata backup, connected to wifi and I was able to ssh to it.  SD card has only the one fat partition that gets unmounted after boot.  I guess this is some form of a "remaster", not sure if there's anything new or helpful here.

bmarkus:
Well done, thanks for sharing. For sure it helps other remastering piCore.

sodface:
I picked up a pi zero w at Micro Center while we were camping near Atlanta.  I didn't mess with it until now.  I knew that the USB and HDMI ports were a different form factor but I didn't buy any adapters at Micro Center (even though I knew I didn't have any at home) so I decided to try and get up and running on wifi without the benefit of video, keyboard, or serial access on the pi, but rather just customizing the sd card on my windows laptop.

I came close, but I didn't know until just now.

Continuing what I did previously in this thread, I downloaded picore 9.0.3 and:

- used 7zip to extract the picore img file.
- downloaded extensions needed for wifi
- installed cpio for windows
- created the directory structure /tmp/builtin/optional with extensions in the optional dir
- created onboot.lst and put it one dir up in /tmp/builtin
- created a bare format file list with:

--- Code: ---dir /s /b > dir.txt
--- End code ---
- edited the dir.txt to change it from absolute paths to relative path starting with tmp
- fed the path list into cpio and then into 7z with gzip compression via command line:

--- Code: ---type dir.txt | cpio -H newc -o | 7z a -tgzip -si my_initramfs.gz
--- End code ---
- tacked the original picore initramfs and my extra one together to create the new one:

--- Code: ---copy /b 9.0.3_orig.gz + my_initramfs.gz 9.0.3.gz
--- End code ---
- formatted an sd card with a 100mb fat32 partition and copied all the extracted picore files there but used my custom 9.0.3.gz
- I had a mydata.gz from before that had my wifi.db and stuff in it so I put that in the root of the sd card also

I put the sd card in and powered up the pi zero w.  I had a green activity light but no idea what was really happening.  I was hoping to see a new dhcp client address show up in my router but alas, nothing.

So I gave up and ordered an adapter kit from Amazon and also a serial cable,  I got the adapter kit tonight (serial cable tomorrow) so I hooked it up to the TV to see what was going on.  The only mistake I made was the direction of the slashes in my dir.txt file (rookie!)  I could see right away that my extensions were being extracted into the root and their filenames were the full paths with windows style back slashes in them.  So I went back to my laptop and just did a replace in dir.txt changing the direction of the slashes to be linux style forward slashes.  The cpio command line above worked fine still and then I moved the card back to the pi and it came right up on wifi.

So I was close  :D

Sounds kind of convoluted I know but I think it's kind of cool to be able to prep the sd card completely from Windows and have it actually work!

curaga:
You should never create Linux archives on Windows, as the permissions and ownership will be all wrong.

Navigation

[0] Message Index

[#] Next page

Go to full version