More on building under a small Linux environment

Well, I’ve been playing a little bit with Erik Anderson’s uClibc-based development environment mentioned in the previous two posts.
When I compile, I issue the command export CFLAGS='-Os -s -mcpu=i386 -march=i386' to create small-as-possible binaries. Using the default flags, the Links web browser balloons to nearly 2.6 megs on my dual Celeron, mostly due to the debug symbols. It drops to around 760K with those options. Specifying i386 binaries shrinks them down at the expense of some speed on some CPUs (especially 486s and first-generation Pentiums), so you have to set your priorities. It doesn’t matter nearly as much on newer CPUs. But I’m pretty sure if you’re interested in uClibc you’re not just running it on Pentium 4s.

For the record, Links compiles without warnings without doing anything special to its configuration and seems to run without incident (I immediately used it to locate and download more source code to compile). Samba’s more difficult, giving some warnings in various places. It may or may not require some special configuration in order to actually run (I didn’t have time tonight to test it), and of course that could result in some reduced functionality. The binaries total 9.3 meg, which isn’t bad considering it implements a complete Windows NT-compatible file server as well as some simple client utilities for connecting to NT shares on a network. The files themselves are about 20% smaller than on a stock Debian system.

Erik Anderson says the majority of Unix software will compile under uClibc, which is probably true. I generally see compiler warnings occasionally even when using a completely mainstream system.

So there is a uClibc-based Linux distribution

I think I found just what I needed. Somehow I overlooked it before. Right there on Erik Anderson’s uClibc page, near the bottom, there’s his uClibc development environment. What is it? A Linux distribution based on his uClibc, busybox and tinylogin userspace in addition to enough GNU tools to compile other stuff. If you don’t want all 150 megs’ worth, download his makefile and uncomment just the stuff you want.
It’s not a general-purpose Linux distribution. It’s intended as a development environment. But besides that, it would be perfect for running on a low-end PC, like a 386 or 486 laptop. You get the benefits of a modern kernel and a modern, in-development libc, but with everything designed to lower memory consumption. On an older PC with a slow hard disk, that all translates into better performance.

Now I’m not sure how much of a GUI you get, but frankly, an older laptop, especially a network-capable one, with this stuff and the excellent Links web browser, the machine would be useful. If SVGAlib and the SVGAlib-capable version of Links compile, then you could even have a graphical web browser on a low-octane machine. Wouldn’t that be cool?

A tiny Linux server distribution? Maybe?

OK, so we’ve been talking about NAS boxes at work. NAS (Network Attached Storage) is a simple server appliance. Plug this thing into the network and you’ve got an instant file server.
Problem is, they’re not that much less expensive than a file server, if at all.

Now, file serving isn’t a particularly CPU-intensive task. Put some decent-speed disks in a box with a simple CPU and some memory, running an embedded operating system, and you’ve got a NAS box, right? Sounds like a perfect job for Linux, right? And you can stuff a minimal Linux into 8 megs of disk space and save the overwhelming majority of your disk space for real work, right?

Well, I asked Charlie if I was completely crazy or not. He didn’t seem to think I was completely nuts. He did ask if I checked to see if anyone’s compiled Samba against uClibc, the alternative libc I was talking about using. I know one person has gotten Samba 2.2.8 to compile against a recent uClibc.

And I even found a project that downloads and compiles uClibc, TinyLogin and Busybox, essentially giving you a complete Linux environment in 600K of disk space, not counting the kernel. And it boots very quickly, even off a floppy. The only problem is that its tools are set up for the ancient Minix filesystem.

Charlie didn’t think running the enterprise on the Minix filesystem was one of my brighter ideas. Maybe I should be glad he didn’t tell me exactly what he was thinking.

Well, getting the system up and running with JFS or XFS probably won’t be much of a problem. Those filesystems are enterprise class if anything ever was.

I had difficulty getting Samba to compile though. I forget the exact error message I was getting.

I may have to opt for the uClibc-based Linux from Scratch, since it’s being actively maintained. That’ll be a bit more work.

I suspect it’s possible to get this combination of tools to work together though. I can’t imagine Quantum is running its Snap servers on Red Hat. I’m sure they’re using uClibc and other embedded tools in conjunction with Samba.

The question is how much more time I want to put into it. If indeed I ever get more time to put into it. The surprising thing to me is that nobody else has built and released this.

Time for more potshots at SWBell

I’m sorry the site’s been down. My DSL modem has been really bad about picking up a signal and even worse about holding on to it when it finds one. Out of desperation I unplugged my Speedsteam and pulled out my old Alcatel that I had in my apartment. The Alcatel didn’t see a signal at all. At least the Speedstream usually saw a partial one. So I pressed the Speedstream back into duty.
But it’s been reliable for the past 7 hours, which must be some kind of record.

Bell swears the Speedstreams are completely reliable and the old Alcatels were junk. I never had problems with my Alcatel, and as far as I know, neither has Steve DeLassus.

I suspect some of the problem is my wiring. The jack in this room was wired sloppily and cheaply with what looks like doorbell wire. Half the jacks in the house never worked at all. I think I’ll have to get a friend to help me pull some CAT5 in here soon, and wire the jacks properly.

I know the phone in this room doesn’t work all that well. I remember the couple of times I’ve dialed up from here, I’ve gotten really low connection speeds, like on the order of 33.6 or lower. I could almost always get 53K from my apartment, less than a mile away. But my apartment had pretty good wiring. (Good thing, because about the only other thing that place had to offer was four walls and a roof.)

Meanwhile, hopefully the site stays reliable. I’ve got the MTU on my web server set below 1500, which fixes the other connectivity problems we’ve had.

And barring all else, maybe I’ll just move my equipment into a different room. But I hope it doesn’t come to that.

An author reflects on publishing

Last week must have been the week for writing and publishing questions. I’ll be honest: I don’t know much about publishing successfully. And I think the advice I’ve dispensed over the years has done a lot more to dissuade potential authors than it has to encourage them.
Someone asked me last week if I would write full-time if I thought I could make a good living off it. That’s an easy answer. Absolutely. So I guess it’s telling that I have a regular 40-hour-a-week job with a salary and benefits and three bosses.

The downsides of writing: Nothing is certain. There’s no way to know how many copies a book will sell, so there’s no way to know how much money you’ll make from quarter to quarter. There’s no way to know if you’ll have steady work. Steve DeLassus was telling me about some book proposals someone else we both know is currently pitching. This other guy said the publisher was really excited.

To me, that’s like getting excited because that young, single and attractive girl who just started in HR smiled at you as she passed you in the hall. Just because she smiled doesn’t mean she wants to marry you. A publisher’s excitement about a book proposal is worth less than the change in your pocket. The change you have in your pocket is certain, and it already belongs to you.

Publishing a book is a long road, like dating. It’s so much like dating that I almost started referring to Optimizing Windows by a girl’s name while I was writing it. I nixed that when one of my friends told me that was too weird and psycho. But think about it. Finding an idea is like getting interested in a girl. Finding a publisher is like asking a girl out. You probably get more rejections than you’d like. And maybe you ask the same one more than once. Writing the book and getting it to press is like the dating and engagement process. Hopefully you’re both excited and both working hard. But it’s sunk if either one of you gives up. Halfway through my second book, my publisher pulled the plug on it. A contract is no guarantee.

So, how do you pick a publisher? I wish I knew. I’ve worked with good ones and bad ones. The very best one I’ve worked with, by a long shot, is Dennis Publishing, a British magazine producer. But that’s magazines, not books.

An agent can help you find a publisher, but the agent doesn’t necessarily know everything, and the agent’s best interests may or may not be your best interests. Sometimes they are, but sometimes no. At times while I was writing my second book, I felt like both my publisher and my agent were taking advantage of me. I absolutely hated answering my phone.

But if you don’t have an existing relationship with an editor somewhere, it’s definitely much easier to get in the door with an agent. An agent, after all, knows the industry much better than most authors do, and has contact with a larger number of publishers and editors. The agent may even be able to call in a favor to get you noticed. And agents are typically always looking for new authors, whereas most editors would probably rather be doing other things and are more likely to listen to an agent than a wannabe writer. After all, if the writer is totally worthless and the idea is totally worthless, the agent has better things to do.

You may decide later not to use an agent. I don’t use one to do magazine gigs. There, you’re usually dealing with flat rate per-word pay, so it doesn’t make any sense to pay an agent 10% to firm up non-negotiables, especially in my case when the editor had already made all of the terms clear and was also making it very clear that he was eager to work with me.

But if you’re asking questions like what publishers would be best under specific circumstances and who would be the most likely to promote your book, you need an agent.

I’m not an expert. I signed two books and published one of them. I’ve published a number of magazine articles. I guess the most valuable thing I have to say is that most people need an agent but should be careful.

Hopefully my thoughts are better than nothing.

I’ll be back later, I hope

Sorry about the disappearance this weekend. I’m going to try to finish the promised post after I finish writing up the article for my church newsletter that I’m working on. (No, it won’t interest anyone here. I’m trying to figure out how to write about revising the constitution without putting people to sleep. If I succeed, I’m nominating myself for a Pulitzer. I don’t care if there’s no category for church newsletters. I’ll make them make one.)
Meanwhile, I’m sitting here listening to Ultravox–one of those 80s bands you hear all the time but always think is someone else–and procrastinating. I’ll get back to my newsletter. Maybe if Ultravox helps me make it brooding, it’ll be more interesting.

OK, I gotta go. I just had an idea.

Quirks about St. Louis

I guess one thing I like about St. Louis is that it isn’t completely cookie-cutter yet–I can still go to a place called MacArthur’s for a better doughnut than a Krispy Kreme and a much better sandwich than Subway, or to The Concord Grill for a much better hamburger than Applebee’s or TGI Friday’s, or to Fortel’s for the best pizza, period–but St. Louisans themselves have some delightful quirks to make fun of.

You can tell I’m not a St. Louis native because I haven’t asked you what high school you went to yet. You might be 48 years old and the president of the company you work for, but for some reason that’s more important than your name and what you do for a living. Because, after all, St. Louisans measure the quality of their weekend by the number of former classmates they ran into.

When Dick Gephardt decided to run for president, I’m sure the first paragraph of the news story read, “Southwest High School graduate Dick Gephardt announced Tuesday his intention to run for president–of the United States–in 2004.” The second or third paragraph should mention he graduated in 1958. And somewhere buried in the middle of the story, there’d be a mention that he served in the U.S. House of Representatives for 26 years. The mention of minor details such as his political party was probably cut to make room for a bigger photo of Southwest High School.

And the only quote from Gephardt ought to talk about how he manages to keep in touch with his old classmates from Washington D.C. and where to get a good pork steak outside of St. Louis.

At least that’s how I would have run the story if I’d been the editor and wanted St. Louisans to read it.

And I never have figured out what you’re supposed to do with a pork steak. Put it in your baseball glove for extra padding? What a true St. Louisan does is throw the fat- and gristle-laden thing on a grill, dry, cook it until charred, then wave a little bit of Maull’s over it and call it real BBQ.

No wonder Kansas City is on the opposite side of the state. It’s trying to stay as far away from that vile dish as possible.

Sorry about that. I got rolling in an e-mail message this morning so I’m cheating and posting that. I’ll answer someone’s writing and publishing question later this weekend.

God cares about our concerns, even when we’re not brave enough to talk about them

Tomorrow night in Bible study, I’m going to cover Mark 5:21-41. Since I actually put some work into preparing and actually wrote something halfway substantial for probably the first time this year, I thought I’d share it here.
Special thanks go to Jeff King for inspiring this largely derivative study, and to God for using Jeff and his talents and insight to answer two simple prayers from last night.

Let’s let Mark start the story:

21When Jesus had again crossed over by boat to the other side of the lake, a large crowd gathered around him while he was by the lake. 22Then one of the synagogue rulers, named Jairus, came there. Seeing Jesus, he fell at his feet 23and pleaded earnestly with him, "My little daughter is dying. Please come and put your hands on her so that she will be healed and live."

Now remember, most of the religious leaders of the day didn’t have a whole lot of use for Jesus. And being a synagogue ruler in this day and age, he was in the upper crust. But on this day, He needed Jesus.

So this aristocrat comes up to Jesus and wants something from Him. Jesus had this big crowd around Him. Yet Jesus dropped that opportunity and went to help him. Even though Jesus had something else to do. And even though Jesus could have used this opportunity to teach the aristocrat a lesson.

The lesson for me: God does not have better things to do. God wants to hear my voice. Yours too.

And there’s a second lesson: God “teaching us a lesson” doesn’t necessarily have to be painful. Sometimes it is. But He prefers, as we’re about to find out, to be unbelievably kind and loving.

24So Jesus went with him. 25A large crowd followed and pressed around him.

The crowd expected something. I guess Jesus had a reputation. The hard question for me: Do I expect God to do something?

And a woman was there who had been subject to bleeding for twelve years. 26She had suffered a great deal under the care of many doctors and had spent all she had, yet instead of getting better she grew worse.

Anyone who made contact with this woman became ceremonially unclean. (See Leviticus 15-25-33.) She was an inconvenience. A nuissance. This woman lived in loneliness and isolation for 12 years. Not to mention the physical pain she must have suffered.

Now, I don’t know about anybody else, but I can handle pain. I deal a whole lot worse with loneliness. When I’m in pain and lonely, personally, it’s the loneliness that I want to go away. To me, 12 hours of it is more than enough, so I can’t even begin to imagine this poor woman’s plight.

27When she heard about Jesus, she came up behind him in the crowd and touched his cloak,

What I want to know is why this woman that nobody wanted to have anything to do with knew about Jesus. And that raises a question: Is there anyone in my life or yours who nobody wants to have anything to do with who needs to know about Jesus?

28because she thought, “If I just touch his clothes, I will be healed.”

This has always troubled me, because I’ve wondered whether this was faith or superstition. Faith is good. Superstition isn’t. But God knows faith when He sees it. Here’s a question: What had the power? The cloak, or Jesus? The answer is the difference between the two.

If you think I think there are a lot of superstitious Christians, you’re right. Take the Prayer of Jabez (please!): There is absolutely nothing special about the words, "enlarge my territory." Say that to me and I might give you a quarter if I have one and nobody else has asked me today. But if you say it to God, trusting in the power of God and not in some magic words, and it’s God’s will… then it’s something special. But wouldn’t God rather hear your own words?

Here’s something else that strikes me. She was afraid to just ask Him for what she wanted. Maybe she didn’t want to trouble Him. He was off to stop someone from dying, after all. He had something better to do, right?

Wrong, wrong, wrong, wrong, wrong, a million times plus infinity wrong. God isn’t like your overburdened unapproachable boss. God isn’t bound by the constraints of time. God always has time for you.

Is there anything that you’re afraid to ask God for?

29Immediately her bleeding stopped and she felt in her body that she was freed from her suffering.

Jesus healed her. Period. End of story. Right?

30At once Jesus realized that power had gone out from him. He turned around in the crowd and asked, "Who touched my clothes?"
31"You see the people crowding against you," his disciples answered, "and yet you can ask, ‘Who touched me?’ "
32But Jesus kept looking around to see who had done it.

I used to think Jesus was angry here. Maybe He was mad about her making Him physically unclean. Maybe He was mad about her being superstitious. Maybe He had some other reason. Now I believe differently. Of course Jesus knew who touched Him. He only asked because He wanted her to approach Him. Why? I don’t think Jesus was satisfied with healing just her physical ailment. We’ll see why in a second.

33Then the woman, knowing what had happened to her, came and fell at his feet and, trembling with fear, told him the whole truth.

She thought the same thing I used to think. She’s a genius! She agrees with me!

34He said to her, "Daughter, your faith has healed you. Go in peace and be freed from your suffering."

Look at what Jesus said. What word jumps out at you? The word that jumps out at me is "Daughter." "Daughter" is a loving word. It’s a special word. How special was it to Jesus? It’s the only recorded instance of Him using this word.

Now, if you’ll indulge my overanalysis for a minute: She’s in pain and she’s lonely. If she could get rid of her bleeding, then human contact suddenly becomes a possibility. Solve the root problem, and then she can see about finding some companionship. Maybe she had some relatives. Maybe she could make some friends. She didn’t dare ask Jesus to love her.

But what she wanted wasn’t nearly as important to Jesus as what she needed. Jesus didn’t dare keep on walking without telling her that He loved her.

The Eastern Orthodox church has a legend that this woman’s name was Veronica, and that she followed Him literally to His death. The legend says that when Jesus fell underneath the weight of the cross on His way to Calvary, Veronica reached out to Him and wiped the sweat, blood, and dirt off his face with a handkerchief as the soldiers seized Simon of Cyrene and made him carry Jesus’ cross the rest of the way. She was there for Him when His disciples had abandoned Him. It’s only a legend, but isn’t it a beautiful picture of a reaction to God’s love?

35While Jesus was still speaking, some men came from the house of Jairus, the synagogue ruler. "Your daughter is dead," they said. "Why bother the teacher any more?"

If “trouble” wan’t Jesus’ least favorite word before He was incarnated, it was by the time He died. Remember what I said before about God not being bound by the constraints of time? You’re not any trouble for Him.

36Ignoring what they said, Jesus told the synagogue ruler, "Don’t be afraid; just believe."

Faith is enough. The amount of faith doesn’t matter. The smallest possible amount of faith in the right thing–God–is more than enough.

37He did not let anyone follow him except Peter, James and John the brother of James.

Peter, James and John were Jesus’ inner circle. This was one of many things they alone were priveliged to see.

38When they came to the home of the synagogue ruler, Jesus saw a commotion, with people crying and wailing loudly. 39He went in and said to them, "Why all this commotion and wailing? The child is not dead but asleep."

As far as God is concerned, death and sleep are the same thing. Jesus wasn’t lying.

40But they laughed at him. 41After he put them all out,

God isn’t mocked. But Jesus didn’t punish them; He just gave them the same fate as the other 9 disciples: They had to wait outside.

he took the child’s father and mother and the disciples who were with him, and went in where the child was. He took her by the hand and said to her, "Talitha koum!" (which means, "Little girl, I say to you, get up!" ).

Look at some of the words here. Gently. Taking her by the hand. “Talitha” is an endearing way to say “little girl.” Jesus loved that girl.

42Immediately the girl stood up and walked around (she was twelve years old). At this they were completely astonished. 43He gave strict orders not to let anyone know about this, and told them to give her something to eat.

Let’s look at the two halves of verse 43. First half: Jesus didn’t want to be famous. Jesus wanted to help people. Jesus was the very embodiment of humility. This raises a tough question for me: How many times have I boasted about something God did, hoping that someone would think more highly of me simply because I happened to be there? Don’t we sometimes seem to be preoccupied with appearing to be spiritual powerhouses? I hope I’m the only one.

Second half: Jeff King, a friend of a friend, brought this one up. Do you see the parallel with verse 34? Jesus raised this girl from the dead, and once again, He wasn’t satisfied. First He’s concerned that she’s sick and in pain. Then He’s concerned that she’s dead–a valid concern, possibly. Did she believe before He raised her from the dead? Not likely. I’m sure she did afterward. So now that He’s healed her ailment and saved her soul, what’s He concerned about? He didn’t want her to be hungry.

God derives no pleasure from your hunger or mine. None.

I’ve asked a lot of questions tonight, but I want to ask one more. What have you been afraid to talk to God about?

Scripture taken from the HOLY BIBLE, NEW INTERNATIONAL VERSION®: NIV®. Copyright © 1973, 1978, 1984 by International Bible Society. Used by permission of Zondervan Publishing House. All rights reserved.

Fair use statement: NIV quotations are permitted without express written permission provided they are fewer than 500 verses, do not amount to an entire book of the Bible, and do not constitute more than 25% of the total text of the work.

Why my ramdisk techniques don’t work with XP

I got a question today in a roundabout way asking about ramdisks in Windows, specifically, where to find my instructions for loading Win98 into a ramdisk, and how to do the same in XP.
I haven’t thought about any of this kind of stuff for more than two years. It seems like two lifetimes.

The original instructions appeared in my book, Optimizing Windows (now in the half-price bin at Amazon.com), and instructions to use DriveSpace to compress the disk appear here. You can get the freeware xmsdisk utility this trick requires from simtel.

These techniques absolutely do not work with Windows NT4, 2000, or XP. Despite the similar name, Windows NT/2000/XP are very different operating systems than Windows 9x. Believe it or not, they’re much more closely related to IBM’s OS/2 than they are to Windows 98. Since there is no DOS laying underneath it all, there’s no easy way to do the trickery that the bootable ramdisk tricks use. What these two tricks do is literally intercept the boot process, copy Windows into the ramdisk, then continue booting.

There’s a $99 piece of software called SuperSpeed that gives the NT-based operating systems this capability. I haven’t used it. I imagine it works using the same principle, hooking into the boot process and moving stuff around before booting continues.

The downside, no matter what OS you use, is the boot time. XP boots in seconds, and my book talks about the trickery necessary to get 95 and 98 to boot in 30 seconds or less. But any time you’re moving a few hundred megs or–yikes–a gig or two of data off a disk into a ramdisk, the boot process is going to end up taking minutes instead.

Is it worth it? For some people, yes. It’s nice to have applications load instantly. A lot of things aren’t CPU intensive. You spend more time waiting for your productivity apps to load than you do waiting for them to do anything. Web browsing and e-mail are generally more bandwidth- and disk-intensive than they are CPU-intensive (although CSS seems determined to change that).

But a lot of games aren’t especially disk-intensive, with the possible exception of when they’re loading a new level. So loading the flavor-of-the-week FPS game into a ramdisk isn’t going to speed it up very much.

Of course, XP is far, far more stable than 98. Windows 9x’s lack of stability absolutely drives me up the wall, and for that matter, I don’t think 2000 or XP are as stable as they should be. Given the choice between XP or 98 in a ramdisk, I’d go for XP, with or without speedup utilities.

I’ve made my choice. As I write, I’m sitting in front of a laptop running 2000 (it’s VPNed into work so I can keep an eye on tape backup jobs) and a desktop PC running Linux. I have a 400 MHz Celeron with Windows 98 on it, but it’s the last Win9x box I have (I think I had 4 at one point when I was writing the aforementioned book). Sometimes I use it to play Baseball Mogul and Railroad Tycoon. Right now it doesn’t even have a keyboard or monitor connected to it.

I guess in a way it feels like hypocrisy, but I wrote the first couple of chapters of that book with a word processor running in Red Hat Linux 5.2 (much to my editor’s chagrin), so I started down that path a long, long time ago.

More on tiny but potentially modern Linux distributions

I found a couple of interesting things on Freshmeat today.
First, there’s a Linux-bootfloppy-from-scratch hint, in the spirit of Linux From Scratch, but using uClibc and Busybox in place of the full-sized standard GNU userspace. This is great for low-memory, low-horsepower machines like 386s and 486s.

I would think it would provide a basis for building small Linux distributions using other tools as well.

What other tools? Well, there’s skarnet.org, which provides bunches of small tools. The memory usage on skarnet’s web server, not counting the kernel, is 2.8 megs.

Skarnet’s work builds on that of Fefe, who provides dietlibc (yet another tiny libc) and a large number of small userspace tools. (These tools provide most of the basis for DietLinux, which I haven’t been able to figure out how to install, sadly. Some weekend I’ll sign up for the mailing list and give it another go.

And then there’s always asmutils, which is a set of tools written in pure x86 assembly language and doesn’t use a libc at all, and the e3 text editor, a 12K beauty that can use the keybindings for almost every popular editor, including two editors that incite people into religious wars.

These toolkits largely duplicate one another but not completely, so they could be complementary.

If you want to get really sick, you can try matching this kind of stuff up with Linux-Lite v1.00, which is a set of patches to the Linux 1.09 kernel dating back to 1998 or so to make it recognize things like ELF binaries. And there was another update in 2002 that lists fixes for the GCC 2.72 compiler in its changelog. I don’t know how these two projects were related, if at all, besides their common ancestry.

Or you could try using a 1.2 kernel. Of course compiling those kernels with a modern compiler could also be an issue. I’m intrigued by the possibility of a kernel that could itself use less than a meg, but I don’t know if I want to experiment that much.

And I’m trying to figure out my fascination with this stuff. Maybe it’s because I don’t like to see old equipment go to waste.