Author Topic: Linux from an SD card?  (Read 17536 times)

Spectere

  • \m/ (-_-) \m/
  • Administrator
  • Hero Member
  • *****
  • Posts: 5716
  • printf("%s\n", "Hi!");
    • View Profile
    • spectere.net
Re: Linux from an SD card?
« Reply #30 on: July 25, 2010, 05:56:23 PM »
If it's grey, you made a copy of net.lo rather than a symbolic link.  Symlinks inherit the permissions of their parent and should be teal.  net.eth0 is there by default, so your net.wlan0 should look exactly like that.

Make sure to use ln -s net.lo net.wlan0, exactly like that, to create the link.

Grub generally installs itself to /boot/grub.  I use the original version of grub, but I'm sure grub2 still uses /boot/grub/menu.lst (or something similar) as its configuration file.

By default, Gentoo doesn't mount /boot.  In order to do so, type mount /boot as root.  You should be able to see the grub directory from in there.
"This is a machine for making cows."

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: Linux from an SD card?
« Reply #31 on: July 25, 2010, 07:04:17 PM »
well /boot is on the same partition as the rest of my filesystem. My point was that because I was using a nonstandard boot setup, I have no idea where EasyBCD stuck it's copy of Grub2. I mean, typing all that stuff out isn't that hard, but it is kinda annoying.

Oh yeah, and netplug doesn't seem to be doing much of anything.

But yeah, how do I manually force my computer to use DHCP to get an IP address. Because it does seem like wlan0 works. The driver is loaded, it's just a matter of figuring out how to get it to do the rest of what's needed.
This is going in my sig. :)

BANNED FOR BAD PUNS X_x

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: Linux from an SD card?
« Reply #32 on: July 25, 2010, 10:02:10 PM »
You know how you told me to delete the net.wlan0 and remake it? Yeah, well, it worked. Of course, that was after i installed hdcpcd as well, so that might have helped out a bit too. I am now posting from my fully antonomous (sp?) linux install. Hopefully I won't have to go back to the livecd again.

Quick question: The livecd terminal was running at a higher resolution than this one. Everything on this one is much larger.. How do I made the text smaller so I can fit more on the screen (which is kinda important in a completely text based environment...)?
This is going in my sig. :)

BANNED FOR BAD PUNS X_x

Spectere

  • \m/ (-_-) \m/
  • Administrator
  • Hero Member
  • *****
  • Posts: 5716
  • printf("%s\n", "Hi!");
    • View Profile
    • spectere.net
Re: Linux from an SD card?
« Reply #33 on: July 26, 2010, 12:00:41 AM »
You can get a higher resolution console by installing the appropriate framebuffer driver.  Honestly, I don't recommend it.  Framebuffer consoles are slow as piss (and if you use video acceleration on them you generally lose the ability to accelerate X), so it'll pretty much slow down everything, including compilation (since it draws every single line, you'll wind up waiting for the screen to scroll, doubling compilation times, or worse).

Your best bet is to do the bare minimum to get X up and running on your system, then working from an xterm.  Alternatively, you could go back to chrooting until everything is installed.  I generally do the former.
"This is a machine for making cows."

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: Linux from an SD card?
« Reply #34 on: July 26, 2010, 01:31:10 AM »
I'm working on getting X going. Unfortunately, X doesn't want to cooperate.

startx tells me that it can't find any of the modules. Including the ati drivers, which I know I have :/

Xorg -config actually causes a segmentation fault.
This is going in my sig. :)

BANNED FOR BAD PUNS X_x

Spectere

  • \m/ (-_-) \m/
  • Administrator
  • Hero Member
  • *****
  • Posts: 5716
  • printf("%s\n", "Hi!");
    • View Profile
    • spectere.net
Re: Linux from an SD card?
« Reply #35 on: July 26, 2010, 02:48:17 AM »
Which ATI chipset do you have?  There are about three different proprietary drivers, depending on the age of the card (the newest ones only work with R600 chipsets and up, which I believe means the HD 3000 series and better).  If your laptop's GPU is one of those, read on.

X doesn't automatically pick up any proprietary drivers, be it NVIDIA or ATI.  Similarly, Xorg -config will only detect the drivers that it knows about (meaning, anything that comes with X).  If you configure X so that only the proprietary drivers are enabled, Xorg -config won't be able to find any "valid" video card drivers and will segfault.  If you were to set your VIDEO_CARDS variable to "ati vesa", for instance, it would actually work and use the vesa driver.  Not that you'd want this.  VESA is supported by everything but is unaccelerated, so getting it to work will be incredibly easy, but your performance will be mindnumbingly terrible.

Fortunately, NVIDIA and ATI both have utilities that will make generating the custom Xorg.conf fairly simple.  If you can load the kernel driver (type modprobe fglrx to load it -- it'll complain if it's already loaded -- then type lsmod and make sure that it appears on that list), odds are you're in the clear and don't have to mask anything off.  To generate the X configuration file, just type aticonfig --initial, then try starting X.  If it seems to initialize the video (flashes the screen, yadda yadda) but dumps you back to the console, complaining that it can't find some files, type emerge twm xterm to give yourself a basic window manager and shell.  After those are installed, jump back into X.

Now you'll want to make sure that your 3D acceleration is working.  emerge mesa-progs to get some of the test utilities.  When those are installed, type glxinfo | grep direct.  You should see "direct rendering: Yes" if everything is kosher.  Finally, type glxgears to make sure that OpenGL is working.  If you can't get OpenGL or direct rendering to work (or if it still fails to start X), jump back to the shell and make sure that ATI's OpenGL module is active by typing eselect opengl set ati.

If you can get it working in twm, you're ready to install your environment of choice.
"This is a machine for making cows."

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: Linux from an SD card?
« Reply #36 on: July 26, 2010, 10:41:46 AM »
Awesome, trying that ASAP. And yeah, I've got the Radeon Mobility HD 3100.
This is going in my sig. :)

BANNED FOR BAD PUNS X_x

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: Linux from an SD card?
« Reply #37 on: July 26, 2010, 06:06:49 PM »
Ok, so I just tried the aticonfig... It complained about missing some opengl .so file (as far as I can tell, I can't remember the exact error). I then tried to emerge ati-tools, and saw a couple more errors about missing opengl, so I'm emerging opengl now, lol.

installing stuff out of order like that shouldn't pose too much of a problem should it? what's the syntax for reinstalling something through emerge?

glxinfo says: Error: couldn't open display. :< However, startx works. Links looks so much nicer when the text isn't fucking massive.
« Last Edit: July 26, 2010, 07:15:55 PM by Bobbias »
This is going in my sig. :)

BANNED FOR BAD PUNS X_x

Spectere

  • \m/ (-_-) \m/
  • Administrator
  • Hero Member
  • *****
  • Posts: 5716
  • printf("%s\n", "Hi!");
    • View Profile
    • spectere.net
Re: Linux from an SD card?
« Reply #38 on: July 26, 2010, 09:33:36 PM »
OpenGL support is actually included in ati-drivers.  emerge ati-drivers again if it's complaining about a missing OpenGL .so.  Emerging OpenGL isn't going to do a whole lot for you.  If anything, it's only a software rendered "solution."

Installing stuff out of order doesn't cause problems because dependencies are always resolved properly.  If you tried to emerge ati-drivers without X being installed, it would emerge everything that you'd need in order to use it.  Since it's an X module, that would involve emerging X.  If something caused files to be deleted, then you might have to reemerge the package.

Reinstalling is extremely simple -- just emerge it again.

If you still have problems after emerging ati-drivers again, post your /var/log/Xorg.0.log and /etc/X11/xorg.conf files to Pastebin and I'll have a look-see.
"This is a machine for making cows."

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: Linux from an SD card?
« Reply #39 on: July 26, 2010, 09:48:25 PM »
Actually right now I have x working fine. I'm in TWM right now. Somewhere along the line of installing twm and all the other stuff I did things automagically began working. Of course, with the number of times i emerge --deep --newuse world, it could have been fixed in one of those, lol.
This is going in my sig. :)

BANNED FOR BAD PUNS X_x

Spectere

  • \m/ (-_-) \m/
  • Administrator
  • Hero Member
  • *****
  • Posts: 5716
  • printf("%s\n", "Hi!");
    • View Profile
    • spectere.net
Re: Linux from an SD card?
« Reply #40 on: July 26, 2010, 09:52:52 PM »
Coolies.

FYI, you don't have to do an emerge --deep --newuse world for every single USE flag.  You'll want to change all of your USE flags and run a single emerge --deep --newuse world (or emerge -uDN world for short).  It'll rebuild all of the affected packages at once that way, hopefully preserving most of your remaining sanity.
"This is a machine for making cows."

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: Linux from an SD card?
« Reply #41 on: July 26, 2010, 10:07:35 PM »
I would have done that if it said "your gonna need all these new uses" instead of giving me one at a time. Regardless, I've learned from that, lol.

Also, would you have any idea where I should start looking to figure out how to control the sound volume with my laptop's volume thingie. It's a rotating dial on the front of the laptop, but, like usual with non-standard stuff, it's not immediately supported in gentoo. I have no fucking clue where I might want to start looking, and I was wondering if you've ever had to enable something like that. I'd really like to be able to control my volume with it, since manually going into a mixer and changing it by hand is kinda a pain in the ass.
« Last Edit: July 26, 2010, 10:52:03 PM by Bobbias »
This is going in my sig. :)

BANNED FOR BAD PUNS X_x

Spectere

  • \m/ (-_-) \m/
  • Administrator
  • Hero Member
  • *****
  • Posts: 5716
  • printf("%s\n", "Hi!");
    • View Profile
    • spectere.net
Re: Linux from an SD card?
« Reply #42 on: July 26, 2010, 10:32:42 PM »
Usually, if you're given USE flags one at a time the ramifications of selecting them are either being explained or they are optional (or situational, whichever the case may be).  I typically skim through the documentation before I begin for that reason alone.

Luckily, I learned to do that before I built Gentoo on a Pentium III 933MHz.  A high-end P3 is surprisingly fast at compiling code, but it's still better to make your mistakes on a decent P4 or better. :x
"This is a machine for making cows."

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: Linux from an SD card?
« Reply #43 on: July 26, 2010, 11:21:32 PM »
Usually, if you're given USE flags one at a time the ramifications of selecting them are either being explained or they are optional (or situational, whichever the case may be). I typically skim through the documentation before I begin for that reason alone.

The Gnome Configuration HOWTO that you linked me to said nothing about all those otehr use flags. It just mentions -qt4 -kde x dbus gtk gnome hal. I didnt use any of the - ones, but I doubt that had much to do with it. And the only "explanation" I got was that package xyz needed that use flag because no version of that package would build with what I had currently. emerge just ended after that.

Also, while I'm at it, I've got a bash scripting question. Say I wanted to output df onto the screen, and print out a warning if disk usage was 80% or higher, how would I do that? I know a bit about pipes, but I'm not sure how I would both print the df output, and process the output with (say) grep in an if statement as well. Also, how would I format my grep statement to look at my main partition, and warn me if the usage percentage was over 80%? regex's sound like they'd be a fucking PAIN to set up for that. Also, where could I learn about regex's? I haven't seen any real concrete explanations of the syntax of a regex, just vague discussions on them.
This is going in my sig. :)

BANNED FOR BAD PUNS X_x

Spectere

  • \m/ (-_-) \m/
  • Administrator
  • Hero Member
  • *****
  • Posts: 5716
  • printf("%s\n", "Hi!");
    • View Profile
    • spectere.net
Re: Linux from an SD card?
« Reply #44 on: July 27, 2010, 12:41:43 AM »
Yeah, I don't remember what the Gnome HOWTO said specifically.  I haven't read it in a while (since I really really dislike Gnome).  That's just usually the case.

df shows the percentage in the standard view, so you can kinda kludge something together if you parse its output with awk and sed (you can probably do everything with one or the other, but this is the easiest way that I know off the top of my head).  For instance, if I wanted to return just the percentage free on /dev/sda1, I could use the following (since with df's output, the percentage field is the 5th one):

Code: [Select]
df /dev/sda1 | awk '{ getline; print $5 }' | sed 's/\%//'
Basically, df /dev/sda1 returns the disk space free for only the specified drive, as follows:

Code: [Select]
spectere@obsidian:~$ df /dev/sda1
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1            488369088 350973792 137395296  72% /storage
spectere@obsidian:~$

Now, we pipe that output to awk.  Awk is a programming language that's designed around parsing text.  We're basically feeding what df is giving us into awk's input.  Let's look at the awk script, line-by-line:

Code: [Select]
getline
print $5

getline just returns the first line and drops it from the input.  This is my way of getting rid of df's header.

print $5 simply returns the fifth field of the line.  Since awk seperates fields by spaces (like df does) it returns the percentage, as follows:

Code: [Select]
spectere@obsidian:~$ df /dev/sda1 | awk '{ getline; print $5 }'
72%
spectere@obsidian:~$

Since we want just the number, we'll use sed to substitute the percentage for black space with the following script: sed 's/\%//'.  This takes what is given to sed (the output of awk, which is the processed output from df) and replaces any percentage sign that it sees with nothingness.  If you were to have a string that said "hello%world", this script would give you "helloworld".  The end result of this is pretty obvious:

Code: [Select]
spectere@obsidian:~$ df /dev/sda1 | awk '{ getline; print $5 }' | sed 's/\%//'
72
spectere@obsidian:~$

Looks like the shared storage drive on my server is 72% full.  Oh snap.  Now, let's cook up a quick bash script to use the output from our little one-liner and put it to use.  I'll start off by simply showing what I came up with:

Code: [Select]
#!/bin/bash
export percent=`df /dev/sda1 | awk '{ getline; print $5 }' | sed 's/\%//'`

if [ "$percent" -gt "80" ]; then
        echo "omg ur disks r filing up :o";
else
        echo "kk looks liek ur gud 4 nao";
fi;

Save that to a file (I called it zomgdisk.sh) and make it executable with chmod u+x zomgdisk.sh.

The first line tells the interpreter what to use to parse the script.  Since we definitely want bash to handle it, we tell it to use /bin/bash.  This is optional, but recommended.  If this is not included, the active shell will interpret the script, which might not be what you want.

The next line should look mostly familiar.  In short, it's setting the output of our one-liner to the percent variable.  The backticks (``) execute the command contained within and pastes its output directly onto the line.  Essentially, in the context of the script, when it's run on my server, it's seeing this:

Code: [Select]
export percent=72
Next, we go down to a fairly straight-forward if statement.  If our variable is greater than 80, it will display the "omg ur disks r filing up" message, otherwise it'll tell us that it "looks liek ur gud".  Note the square brackets for the condition and the odd semicolon usage.  I assure you, that will bite you on the ass repeatedly in the future until you've written several scripts from scratch (and after you've set aside the black arts of bash scripting for a few months and jump back to it, it'll trip you up again...grr).

Let's give it a whirl, shall we?  Since my server's SATA drive is only 72% full, we should see the second message.

Code: [Select]
spectere@obsidian:~$ ./zomgdisk.sh
kk looks liek ur gud 4 nao
spectere@obsidian:~$

Perfect!  Now, to make sure that our conditions are working right, let's set the warning percentage to 70%:

Code: [Select]
if [ "$percent" -gt "70" ]; then
Okay, let's give this another go:

Code: [Select]
spectere@obsidian:~$ ./zomgdisk.sh
omg ur disks r filing up :o
spectere@obsidian:~$

oh noes!!!!!1

So, there you have it.  A script that will happily warn you when your drive is getting full. ;D  As you can see, no complex regex tomfoolery was required.
« Last Edit: July 27, 2010, 12:43:44 AM by Spectere »
"This is a machine for making cows."