BSD, Raspberry Pi, Oddities and Endians

Sometimes, between “Wah? It’s morning you say?” and “Coffee? Coffee?! We don’t need no more steeeenking Coffee!!” comes wandering.

Not quite up to speed enough yet for “real work”, but not able to just sit and wait either. So I explore things that are “of interest” but not “of importance”.

One of those is the issue of getting a Big Endian machine to run GIStemp (as the code I have is mostly Big Endian and while that MOSTLY doesn’t matter, it shifts to an endian dependent data format in the last couple of steps where it does the major Grid / Box molestation. While I saw no reason to run those, it would be nice to do.)

Sidebar on Endian:

It comes from a pun about Gulliver and which end of a hard boiled egg to start with when opening / eating. If you really care, read about his travels…

Me? I’m “big endian” as typically that is where the air bubble is at and it gets that out of the way while giving better spoon access via the larger space created. You also tend to get a nicer “yolk first” and get to that disappointing bit of solid white after having already had most of the good bits. With luck, some yolk dribbled onto it making it ‘good enough’ in the process. The “other way round” you start with digging in a tiny hole for ‘just whites’ and it’s not very pleasant.

I have no idea if that influenced me about computer endian, or not, but I really do prefer my computers to be big endian as well. A lot of what I did early on was on big endian machines, and the 6800 / 68000 family is a great processor. Then there were the Vaxen. It’s hard not to fall for a Vaxen…

For those with no clue at all what I’m talking about, it comes down to how numbers are stored in a computer. Do you store 1,245 as:
1245
5421
2154
4512

Normally folks think it just applies to 1234 ( biggest ‘value’ first, so “big endian” ) vs 5421 ( smallest value first, so “little endian”) but in fact you can find yourself dealing with both “word endian” as those two, or “byte endian” if there is a byte / word boundary… and endian is involved. This happens much more often than expected as “little endian” PCs have come to dominate (some of us would say “corrupt”) the world while networking has stayed pure and uncorrupted… (i.e. big endian). So all over the place there are folks dealing with swaps of endian as networks and computers get connected.

There were endless arguments over the merits of one over the other. With “The Rise Of The PCs” they have mostly ended. One at a time the major Big Endian microprocessors have died out. Apple swapping to Intel Little Endian was in some ways the signal of the end of the world… Now the old warriors no longer have the arguments. They just “remember”… You can find lots on this online.

Oh, and Sun (now gone, bought by Oracle) was Big Endian (mostly). So folks who did things on Sun Workstations (which is where I think GIStemp might have been developed) tended to Big Endian.

Which brings us back to why I care. I don’t really want to go digging in the garage to find the old SPARC 10 and see if it still boots just to run step 4_5 of GIStemp. And I don’t really want to dig through the bit of a web page I saved somewhere talking about how to convert GIStemp to Little Endian (often just LE or BE and semetimes in a bit of inside joke that you will now get, in listings of OS and software as endings: -el and sometimes -eb )

Which leads back to the Raspberry Pi and the ARM chip. The ARM chip is something called “bi-endian”. It can handed both kinds of ‘endian’ with the right tweeks. MOST of the operating systems out there run it in -el mode as that is what most folks now expect. Yet… Some of us would like a BE version. For many reasons. (not the least of which is those network guys making network boxes… why go through all that byte swapping just to swap them back for the next wire?…)

Back At BSD

So I’d brought up a new NOOBS release of Debian on the R.PiM2 and it booted faster. But was kind of ‘quirky’ about some things. Nothing big, just clearly different; and not ways that made me happy. Hanging on an NFS mount that worked prior (but timing out and moving on). Having a window ‘jump’ text to the bottom after a resize, but only when you start to type. A few others.)

It looks like the release now given you by default is “systemd”. And I’m not fond of systemd (long discussion … see the web threads. It’s a big fat binary blob with fingers in everything that becomes a prime security ‘attack surface’ while at the same time breaking all sorts of “prior art” on how to do things. So thousands of ‘how to’ web pages are now “wrong” and “everything you know has changed”.)

One good thing, though. I don’t know if it is the systemd, or the swap to IceWeasel (likely the browser swap) but it is now ‘livable’ for editing WordPress pages. Just enough faster to be “good enough”; so I’ll keep this chip / install for WordPress editing… until something better and faster comes along… (And NetBSD is likly to be just that…)

So last night I dreamed of BSD on my Raspberry Pi… A bit of web searching showed both FreeBSD and NetBSD are available. I decided this morning to look into NetBSD. All the things I know and love about BSD are still there; including the very clean “init” process that was (IMHO) screwed up by System V. (This matters as it is the complicated and not that effective sysvinit that is supposedly “fixed” by systemd, by making it more complicated and less effective as an init process… IMHO.)

But this isn’t about installing NetBSD, it’s about Big Endian.

I’ve downloaded the NetBSD code for both the v6 original Pi and the ARM v7 processor Pi Model 2. But there was this other directory too:

http://nyftp.netbsd.org/pub/NetBSD-daily/netbsd-7/201510181750Z/

Lists:

evbarm-arm/                              18-Oct-2015 19:46         0kB
evbarm-armeb/                            18-Oct-2015 19:14         0kB
evbarm-earm/                             18-Oct-2015 19:58         0kB
evbarm-earmeb/                           18-Oct-2015 19:27         0kB
evbarm-earmv6hf/                         18-Oct-2015 19:45         0kB
evbarm-earmv7hf/                         18-Oct-2015 19:45         0kB
evbarm-earmv7hfeb/                       18-Oct-2015 19:35         0kB
evbmips-mips64eb/                        18-Oct-2015 19:38         0kB
evbmips-mips64el/                        18-Oct-2015 19:39         0kB
evbmips-mipseb/                          18-Oct-2015 19:18         0kB
evbppc/                                  18-Oct-2015 19:35         0kB
evbsh3-sh3eb/                            18-Oct-2015 19:15         0kB
evbsh3-sh3el/                            18-Oct-2015 19:27         0kB
ews4800mips/     

where evbarm-earmv7hf is the one for the R.PiM2 (hf being hard float meaning it uses the floating point arithmetic hardware instead of doing math in software).

But what, one wondered, was 7hfeb about?…

More Reason For a CubieBoard

Well, digging around the net found this. A set of slides from the guy who did the port. He did it to a Cubietruck, which is my present intended target for “next box” to buy. Now I know I can run it Big Endian too. Oh Boy!

http://www.netbsd.org/gallery/presentations/martin/asiabsdcon2015/slides/index.html#/

The slides have a little “box with blue points” in the lower right corner. IF / when the down point lights up, use it to scroll down the page to see more. (Then the up point will light up to let you scroll back up). Left and right obviously take you forward and back in the series of slides.

Has a nice picture of a Cubietruck board in a box with a disk.

So “many thanks” to Martin Husemann for doing all the work to make that hardware function. I now know that it works, and that I can finally get my Big Endian box and with far less personal work required than I’d been expecting.

Just scrolling to the right in the slides, the headings give a pretty good idea what level of work was needed. Surprisingly less than expected. Then scrolling down the detail slides lets you see the specifics. Somewhat more obscure that would have taken me a long while to work out.

In Conclusion

So with that, I now know that I’m going to put NetBSD on at lest one of my Raspberry Pi boards. Just to refresh the skill set if nothing else.

I also know that I’ll be getting a Cubietruck for the next GIStemp box. (Likely a year out given my present queue… which includes ‘get a job so you can buy toys’…) It is always easier to use the same gear as the base port…

BSD, gotta love it ;-)

With that, time for that morning coffee…

Subscribe to feed

About E.M.Smith

A technical managerial sort interested in things from Stonehenge to computer science. My present "hot buttons' are the mythology of Climate Change and ancient metrology; but things change...
This entry was posted in Tech Bits and tagged , , , , , , , , . Bookmark the permalink.

8 Responses to BSD, Raspberry Pi, Oddities and Endians

  1. LG says:

    Regarding those slides, I noted that (on Win7), home/end/pg up/pg dn/ keys made for a very nice way to navigate up/down that presentation.
    ChiefIO,
    THANKS !!!! for pointing to that link for the first scroll was VERY informative.

  2. E.M.Smith says:

    @L.G.: You are most welcome.

    @All:

    FWIW, I’m posting this comment from Android on the R.PiM2. Very strange experience. Font is very large (seems to think my 24 inch monitor is a phone screen ;-) and using the mouse as a ‘finger’ to scroll around is a bit strange… but it works. If slowly due to the heavy graphics dependency for dynamic control. Yes, it is part of the Berryboot collection I installed last night…

  3. LG says:

    ChiefIO,
    With all this sysadmin blogging (Scripting, Penetration testing, Customized Rasp Builds,Security architecture, etc…) , I’d say you already have the makings of a book series outlined broadly….
    I find that your perspective and experience breeds INSIGHT, my favorite word of the English language (a non-native speaker here)
    I hope you’ll also consider traditional publication, beyond just putting out there on the cloud…..

  4. E.M.Smith says:

    @LG:

    I’ve thought about it. Just don’t know what I’d add that isn’t already in the dozens of dozens of “how to run your system” books already out there. Though perhaps a “Industrial Strength Security for the DIY at Home” might have a benefit…

    The Professional Home System? Something like that…

    Yeah, you get a lot of “insight” after banging your head on computers at 2 AM with the customer due to arive at 8 AM and the vendor not answering the phone and the coffee running out… I’ve got a lot of “insight scars”… sigh… 8-|

    But oddly, I keep being drawn to do it all over again with each new hardware / software set…

    FWIW, I have a great love of paper books. More times than I care to think about I’ve been in a computer room doing “bring up” and either there isn’t enough electrical power yet ( i.e. limited standby / emergency generator is it) or the internet connection is the thing you need to bring up or “whatever” and that paper copy has been really nice to have….

    Sidebar:

    One one occasion I was at a client site. IIRC it was Ericsson in Menlo Park… I had been dispatched by a VAR to install the Very Special Cisco Router we had ordered. It was ordered “complete” with the needed interfaces to bring up the WAN / internet connection ( some kind of CSU / DSU built in with 24 channel support IIRC). I “unbox it”, plug it all in, power it up. No joy. Fiddle this. Configure that. No joy. Now this was prior to the days of WiFi via your phone or wireless everywhere. Just a CDMA Sony about the size of a soda can and a Dell laptop that wanted to plug into a wire.

    I call Cisco help after a while. They inform me “no problem. It ships without the software. Just connect to the Internet and download the software update bundle.”….

    After a slow burn I explain to them why they are “unclear on the concept of ‘special router with everything’ and ‘for the purpose of bringing up internet at new sites”….

    After a rapid panic run back to the VAR (Value Added Reseller) location and an hour or three in the lab, I’m back at the client site doing the install. At about 8 PM. That ought to have been finished about 4 PM. Driving an hour or so each way during rush hour traffic.

    The “insight”? Never ever trust the vendor to ship it as described. ALWAYS test ALL hardware and SOFTWARE is at least present and if possible functions as expected while AT THE OFFICE prior to going to the client site. Do not expect “support” to have clue about “site bring up” needs. They expect everyone to be working in a 24 x 7 staffed office with unlimited electrical power and Gig-E mainlined into your desk… Sigh… again…

    So now I travel with a “WiFi Hotspot” and an inverter big enough to power all my stuff, and then some, just from my car. And a few various cables and media adapters. And…

    FWIW, I’m still adding to the lessons learned book. On another thread I’d stated that the Berryboot Fedora didn’t see the USB disks. I’ve now corrected that. Seems the R.PiM2 will power the Wireless Keyboard dongle, mouse, and “power on” lights of the USB disk through the “powered” USB hub even it it has not had the power plugged in… Adding power enabled the USB disk to actually work… Note to self: “On USB, ‘power on’ light does not mean power is on.”
    Sigh… again… again…

  5. Chuck Bradley says:

    Just a nit, but but VAX is little endian. (Present tense because some are still in use.)

  6. Ron says:

    Thanks for the tip on eating an egg. I’ll never look at breakfast in the same way again. Let us know when you get your Cubie – it’s on my list as well. I like the sata support and also the line-in audio (2 of them) – that match up better with some of my other hardware.

    As far as big-endian stuff goes, I think I need more of the motivation that I don’t have before taking that path. As for the Rpi2, I’ve got one here and I use RiscOS on it. Now that’s an OS that comes with only an assembler, and a group of afficionados who like it that way!

  7. Thanks for the tip on eating an egg. I’ll never look at breakfast in the same way again. Let us know when you get your Cubie – it’s on my list as well. I like the sata support and also the line-in audio (2 of them) – that match up better with some of my other hardware.

    As far as big-endian stuff goes, I think I need more of the motivation that I don’t have before taking that path. As for the Rpi2, I’ve got one here and I use RiscOS on it. Now that’s an OS that comes with only an assembler, and a group of afficionados who like it that way!

  8. E.M.Smith says:

    @Ron:

    You are welcome to eat your eggs in any order, but hopefully my comment will turn you to the BigEndian Darkside ;-)

    As the GIStemp climate code is big-endian, I actually have a need for a big-endian machine…

    I fired up RiscOS, but didn’t see the point… It’s nice, I guess, but unless I can find a FORTRAN compiler for it, well… ;-)

    @Chuck:

    Oh, right! I think maybe I was thinking about the MIPS chip… (Hey, it’s only been about 3 decades now… ;-)

    UPDATE: Thinking about it, we had VAXen and Sun boxes and it was the Sun machines that were big endian and the VAXen were little endian.

    At any rate, I have use of a big endian machine and that’s become harder to do with the dominance of Intel Little-Endian everywhere.

Comments are closed.