scripts to convert standalone md to jekyll frontmatter

This commit is contained in:
Dan Ballard 2016-01-06 05:12:22 -08:00
parent b18387ebe1
commit c9527117f0
3 changed files with 25 additions and 0 deletions

View File

@ -14,6 +14,7 @@
<a name="gp2x_gentoo_why"></a>
## Why? ##
Because now that the GP2X can use ethernet over USB and Wifi it's pretty much a small form factor 200MHz ARM computer, and extremely portable at that. I've installed Gentoo on lesser machines. Also, I wanted an ultra portable box I could do programing with in whatever language I want, like Ruby or Lisp. But more generally, there is a vast array of software available to Gentoo that isn't available for the native Linux of the GP2X. If I could get Gentoo on the GP2X (which considering it's basically just a small ARM box, shouldn't be too hard) then I'd be opening up a whole new and vast world of software for the GP2X.
@ -21,6 +22,7 @@ Because now that the GP2X can use ethernet over USB and Wifi it's pretty much a
As for why chrootable and not a full install? The GP2X firmware does a good job and is extremely compact (~20MB). Getting Gentoo down to that might be a trick. Plus, with the custom hardware, rolling my own kernel might be a bit of work. And it would also probably preclude me from using any GP2X specific software. A chrootable Gentoo environment gives me the best of both worlds. I can use the GP2X and assorted software as normal, but pop in an SD card, and suddenly I also have a Gentoo environment. The GP2X Linux ends up acting like a bootloader and an abstraction layer between the somewhat custom hardware of the GP2X and the Gentoo environment.
<a name="gp2x_networking"></a>
## Getting the GP2X fully online ##
**Note:** *On the computer side of things it is assumed you are running Gentoo, as I am, so some things may have to be changed accordingly*
@ -93,6 +95,7 @@ Now you can
When ever you want to activate the connection to your GP2X. You can automate it with rc-update, but the connection may not work if the GP2X isn't plugged in before net.usb0 is started. Your millage may vary. But it's easily restartable :).
<a name="gp2x_media"></a>
## Preparing the media ##
We will be installing onto an SD card because the NAND on the GP2X is just about full, and we don't really want to mess with it anyway. We will use the ext2 file system because it's light, but provides all the features any UNIX like OS needs (unlike FAT which most glaringly doesn't support file permissions or links).
@ -123,6 +126,7 @@ The GP2X Linux is based around a limited version of busybox that lacks a few ess
I made a 'gp2x' directory on the SD card and tossed chroot.static in there (see, aren't you glad you didn't use the whole SD as the Gentoo root?). Now we are just about ready.
<a name="gp2x_netfs"></a>
## Networked File Systems ##
SD cards don't have the hugest life spans. Lots of writes can reduce those lifespans. So it makes sense that if we can, we should farm out directories with lots of write to computers with real harddrives that can handle them. Also, if we have directories that we don't often need but are huge, we should farm those out to. This is where networked file systems come in. We're going to at least get /usr/portage to be on some other machine and just mount it over the network to our chroot Gentoo environment to save on space.
@ -179,6 +183,7 @@ and automate samba server starting with
If you want to use NFS on your computer to export /usr/portage, you can get the required NFS client package for the GP2X at [archive.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,42,1880](http://archive.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,42,1880).
<a name="gp2x_chroot"></a>
## Chrooting the Gentoo environment ##
Now we have everything in place to use our Gentoo environment. So, put the SD card into the GP2X. The GP2X doesn't automount ext2 file systems, only FAT. That's okay. Create a script to do it for you because it's slightly a hassle.
@ -248,6 +253,7 @@ Now you are ready to emerge software.
**Note:** Software installation is currently not recommended at this point. Compilation takes place at '/vat/tmp/portage' which is on the SD card. This will start to take it's toll on the SD card. I attempted to get /var/tmp/portage to also be a Samba mount and succeeded as far as I could mount it remotely, however, portage complained it could not chmod the directory appropriately and thus failed. Until I can get this working I'm not too eager to emerge much software and would recommend you also take it easy until you can successfully get /var/tmp/portage remotely mounted. Suggestions would be appreciated.
<a name="gp2x_crossdev"></a>
## Crossdev ##
Another way to install software on the GP2X is to cross compile it, which is compiling it on another computer, for ARM, and then package it (yes portage supports binary packages). There are some difficulties which I'll outline, but this method should be possible at least.
@ -265,6 +271,7 @@ I was able to get crossdev installed, but using xmerge, I was unable to then com
Also, the crossdev solution seems slightly more geared towards more embedded devices where you will be creating a whole environment in one go and then doing something like flashing it onto the device. It feels less suitable for package by package software installation (by proxy) for the GP2X. Partly because you'll have to keep track of all the dependencies installed and package those too and install then on the GP2X. Another problem that then creeps up is that since hte GP2X has a Stage3 install, it already has lots of software, but the crossdev environment has none, so it will compile newer versions of everything for it self. It does seem to start to become a bit of a hassle and mess.
<a name="gp2x_conclusion"></a>
## Conclusion ##
Well, I got a chrootable Gentoo environment setup on the GP2X. That's pretty impressive. The only hitch is that I currently don't feel comfortable installing (emerging) software due to the adverse effects it might have on my SD card. But there are options from here. You could set up a cross compilation system, fairly easily accomplished with [crossdev](#gp2x_crossdev), and cross compile packages for the GP2X on a computer and then just install the precompiled packages. This may end up being more effort than it's worth, see above. Also, research further on how to get portage to play nice with samba mounted /var/tmp/portage.
@ -273,6 +280,7 @@ Also, as an after thought, you might want to take the SDL libs for the GP2X and
Finally, I hope this ends up being a useful tutorial/howto for anyone out there interested in any of the topics covered.
<a name="gp2x_ref"></a>
## References ##
* [Gentoo ARM Handbook](http://www.gentoo.org/doc/en/handbook/handbook-arm.xml)

View File

@ -0,0 +1,3 @@
for file in *.md
gawk -i inplace -f standalone-md-to-frontmater.awk $file
end

View File

@ -0,0 +1,14 @@
{
if (NR==1) {
gsub(/# /, "");
gsub(/ #/, "");
print "---";
print "title: ", $0
} else if (NR==2) {
date=FILENAME;
sub(/-[^0-9].*$/, "", date)
gsub(/\*/, "");
print "date: ", date;
print "---"
} else { print }
}