LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (http://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Help with Kernel for SATA (http://www.linuxquestions.org/questions/linux-from-scratch-13/help-with-kernel-for-sata-757909/)

lloydsmart 09-26-2009 08:42 AM

Help with Kernel for SATA
 
HELP!

I'm trying to build an LFS system on my PC and everything was going fine, until... the reboot into the new system.

To clarify, I'm building LFS for the x86_64 platform (pure64), but it's not a cross-lfs build. I downloaded the SVN x86_64 LiveCD and went from there.

My problem is that the system just won't boot up from my new installation. I went through the book as normal, and everything worked fine. I installed a bootloader and got it to load the new kernel (version 2.6.22.1), but it crashes out with some messages about SATA.

As the only other working OS I have at the moment is Windows 7, I can't give you the exact output I saw, but here are a few lines that I thought were significant and wrote down:

Code:

failed to IDENTIFY (I/O error, err_mask 0x4)
qc timeout (cmd 0xec)
SATA link up 1.5Gbps (SStatus 113, SControl 300)
limiting speed to UDMA7: PI05
qc timeout (cmd 0xa1)
Kernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block (0,0)

There were other lines of output, but they were all variations on the ones I've posted here.

Does anyone know what is wrong? I have tried everything I can think of.

My hardware is an ASUS M3N-78 PRO motherboard with Nvidia 8300 chipsets (the integrated-GPU one). I'm using AHCI for the SATA, and in total have 5 SATA devices connected (four hard drives and a bluray/DVD-RW).

I'm absolutely positive that I compiled AHCI support into the kernel, but I'm not sure about this libata thing that I've read about - don't know where to find the option in make menuconfig.

PLEASE can anyone help me?!? This has been driving me up the wall for the last 3 days now and I'm seriously considering abandoning LFS and going to a "normal" distro.

Thanks in advance!

lloydsmart 09-27-2009 08:23 AM

Or would my question be better placed in the Linux - Kernel section?

zidane_tribal 09-28-2009 07:01 AM

hmm, well, it's been a while since i compiled my kernel but.....

1. make sure raid is turned on on your motherboard, if available. mine just wouldnt like the drives until it was (i dont use raid, it just has to be enabled).

2. just go and double-check that you ticked the right box to include your on-board sata drives into the kernel, not as modules, but compiled directly into the kernel (i have spent a day troubleshooting to figure out i'd *'d the wrong line).

3. make sure you have compiled in (not modular) support for both "ATA Devices" and "AHCI SATA Devices", as iirc, it needs both sets.

i'd go with checking the driver first, make sure it's compiled in, not modular, and it's the right driver. as it seems to be the most likely culprit.

if i have missed something obvious, forgive me, i am stuffed up with flu atm and floating on a pink fluffy cloud of medication.

lloydsmart 09-28-2009 12:17 PM

Thanks for that post. I was beginning to think I wouldn't get any replies at all!

Well, I've recompiled the kernel as advised, but still no luck. I get the same wierd error messages and the system just doesn't boot. I enabled all the sata options I could find, and definitely enabled AHCI. Nothing was a module, all were *'s.

Maybe I need to use a more up to date kernel source? Would that work with the LFS build? Maybe worth a shot.

Does anyone else have a self-compiled kernel working in 64bit on an Nvidia 8300 chipset? I'd like to hear your experiences and advice, if so.

Any more ideas?
Thanks in advance.

manwithaplan 09-28-2009 12:28 PM

Please post your .config file in a pastebin ... I had this problem at first, when learning about compiling kernels. I now have learned to select only what is pertinent to my system. Also what version of the kernel are you using? Vanilla, git-sources, etc... Along with the version number 2.6.**

This way I can look at you .config and help you configure your chipset and devices. I too have a ASUS board, so I can look at what you have configured so far, and make any changes and post your new .config. This way you can see the diff between the .config files, and see your errors.

lloydsmart 09-28-2009 01:01 PM

Wow, thankyou thankyou thankyou for your generous offer, manwithaplan - if you can get this working for me I will be forever grateful!

I've had a few .config files now, but here is the latest one.

I've been using vanilla kernel, 2.6.22.1, as that's the version currently recommended by the SVN version of the LFS book. I'm not using any patches, simply:

Code:

make mrproper
make menuconfig
make modules_install
cp -v arch/x86_64/boot/bzImage /boot/lfskernel-2.6.22.1
cp -v System.map /boot/System.map-2.6.22.1
cp -v .config /boot/config-2.6.22.1

When you have a look at my .config, could you please disable anything you suspect I won't need? The only real feature I need that's slightly out-of-the-ordinary is V4L, as I'll be adding a TV (DVB-S2) tuner soon.

My system: I have an ASUS M3N78-PRO, which features the Nvidia 8300 chipset, I have four HDDs connected via SATA and one DVDRW/Bluray also connected via SATA. I therefore have to set AHCI mode in the bios, as there's no other way to use that many drives without an add on card. IDE mode only gives me 4. My processor is a Phenom X4 9950 if that makes any difference.

Looking forward to my amended config file!

http://pastebin.com/m4bc53f00

manwithaplan 09-28-2009 02:31 PM

Why use the old kernel...? I know the LFS book says to use this ... I suggest the newer kernel 2.6.31 This has many improvements with scheduling, File system support, newer drivers (which you need) etc...

If you want I can still use this old kernel...

Though, I could make a nice static kernel for you that is current, and has some performance patches. Like the new zen-sources 2.6.31-zen1... It shouldn't effect the LFS handbook, and you wont need a initrd. And is stable

I've done this many times, especially in the last few days trying out new kernels and features.

Also, you have an AMD... I have a patched, and performance kernel that would work great with your hardware. I can tar.bz2 up the source and edit the .config and have you try it..? I can setup my ftp so you can download it? Just a suggestion


EDIT: From what I have been reading about the nVidia 730a chipset... Is that you need a more current kernel 2.6.26 and above ...

Quote:

Asus M3N78 has an nforce 730a chipset. SATA support for this chipset is sadly lacking in kernels below 2.6.26
So I"ll prepare a current kernel with patches version 2.6.31... and upload it so you can download and install. I'll include the new .config in the tarball if your interested.

lloydsmart 09-28-2009 06:00 PM

That would be absolutely fantastic if you could. The newer the better I guess! I'm very grateful for all this help. Pm me with the download details when you're ready.

manwithaplan 09-28-2009 06:21 PM

What version of GCC are you using ...? I want to set custom CFLAGS for compiling


Also, I have added the Raid configuration, I assume you are using all sata ports, I also added DVB support with autodetect... Not sure about revision "S2", but it should work. You'll need to add any additional support for any printers or misc. usb devices, I left that open, too just only the basics.

EDIT:
CONCERNS -

1) Your Raid controller is NVIDIA's & I'm not certain if its going to be problem (never tested it)

2) Your onboard NIC, should work with the Realtek driver (8169) in the kernel. If not, you'll need to look for a patch or a workaround ... I wouldn't worry so much on this one

3) I have the VESA driver set for your initial display, (using nvidia fb is usually a nightmare) You can always use the source binaries from nVidia's site for your X.

manwithaplan 09-28-2009 07:43 PM

All right here is the links to the source:

This is for GCC 4.3 and above:
http://www.mediafire.com/?sy9nu3yzwsy


This is for GCC 4.3 and below e.g. (4.1 - 4.2.4)
http://www.mediafire.com/?zyfd94jg1s0



Build instructions:

Code:

# cp linux-2.6.31-zen1.tar.bz2 /usr/src && cd /usr/src
# tar -xvf linux-2.6.31-zen1.tar.bz2
# cd linux-2.6.31-zen1
# make -j5 && make modules_install
# cp arch/x86_64/boot/bzimage /boot/2.6.31-zen1

Notice I use make -j5 this is because you have a quad core, and its nice to compile quickly

There is know need to make clean or make mrproper, I have already cleaned the source. This would erase the .config file I've created.
As a optional task you can make menuconfig before executing the build (you need dialog installed to use menuconfig)

The .config has full support for iptables.


Cheers hope this helps ... reply if any questions

manwithaplan 09-29-2009 01:06 AM

I noticed that you are using the LFS live_cd ... way out dated. I just downloaded the latest svn handbook, and reviewing it now. It references all up to date packages and a current GCC 4.4.1

I think, if you want a better LFS setup, you should download the new Anniversary Gentoo live_DVD, and download the svn LFS pdf handbook. I use Funtoo, which is a variant of Gentoo, and love it. The new Live_DVD will have all current build utilities needed in a host system to build LFS. If not you can always use emerge to grab the tools needed.

I haven't built a LFS system in sometime, so you got me interested. I am reviewing the svn version Linux From Scratch - Version SVN-20090924. This is current. Since I wont need a Live_DVD, I'd suggest that you use the new Gentoo Live_DVD, which you can download here This is current, and would make a great introduction to Gentoo and make a good live host. They dont make a live DVD very often, if at all anymore since they transitioned to a rolling release distro.

This is a multi-arch release DVD... Check it out on there website.


EDIT:

I actually was referring to the 32bit LFS build with the pdf (as above)... For a pure 64bit build I will be using CLFS SVN-20090922-x86_64-Pure64 located here. This is for a pure 64bit CLFS build. Going to give it a try myself.

Keep in mind about the Gentoo Live_DVD version 10, as a live distro for your build

lloydsmart 09-29-2009 07:43 AM

Thanks for that, will try out the kernel tonight!

As for the outdated LFS, it was the only x86_64 version I could find. I'm not sure about CLFS, is there a way to do x86_64 from the "normal" LFS (x86) book? Or should I just give CLFS a try instead?

EDIT: Having had a look, I'm gonna go the CLFS route and see how that goes. I'll use the kernel you prepared for me (massive thanks for that, by the way!) and hopefully tonight I'll end up with a fully working system!

I'm gonna try out your kernel on my current "in-progress" LFS build, though, before I wipe all that and start again with the bleeding-edge CLFS.

I'm also going to take your suggestion about using the Gentoo live DVD.

Thanks again!

manwithaplan 09-29-2009 02:05 PM

1 Attachment(s)
Since I have taken up this challenge also ... I wanna share with you some hints about the GCC 4.4.1, also share my hacked .bashrc file you can use when you reach step:

(Chapter 10. Installing Basic System Software)

FYI: I have chosen the chroot route, much easier since my arch types match, I suggest you do the same if you boot the Gentoo Live_DVD with the 64bit kernel.

HINT:

It mentions a link in Chapter 10 to the gcc optimizations etc... etc... there outdated for your processor, and mine.

So... I made a little hack to make things a little nicer... :)

Once you have chrooted and have reached CHPT 10, create a .bashrc file in /root directory and add these contents:

Code:

# /etc/bash/bashrc
#
#
#
# Test for an interactive shell.  There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.

if [[ $- != *i* ]] ; then
        # Shell is non-interactive.  Be done now!
        return
fi

# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control.  #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize

# Enable history appending instead of overwriting.  #139609
shopt -s histappend

# Change the window title of X terminals
case ${TERM} in
        xterm*|rxvt*|Eterm|aterm|kterm|gnome*|interix)
                PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
                ;;
        screen)
                PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
                ;;
esac

use_color=false


####################################
# Gentoo Color Like Terminal for LFS
####################################



safe_term=${TERM//[^[:alnum:]]/?}  # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors  ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs}    ]] \
        && type -P dircolors >/dev/null \
        && match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true

if ${use_color} ; then
        # Enable colors for ls, etc.  Prefer ~/.dir_colors #64489
        if type -P dircolors >/dev/null ; then
                if [[ -f ~/.dir_colors ]] ; then
                        eval $(dircolors -b ~/.dir_colors)
                elif [[ -f /etc/DIR_COLORS ]] ; then
                        eval $(dircolors -b /etc/DIR_COLORS)
                fi
        fi

        if [[ ${EUID} == 0 ]] ; then
                PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
        else
                PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
        fi

        alias ls='ls --color=auto'
        alias grep='grep --colour=auto'
else
        if [[ ${EUID} == 0 ]] ; then
                # show root@ when we don't have colors
                PS1='\u@\h \W \$ '
        else
                PS1='\u@\h \w \$ '
        fi
fi


# --- SHOWS ---- current chroot, remove when done buliding ---#
export PS1="(clfs) $PS1"

# --- ALIAS's ----#
alias mkdir='mkdir -p'
alias path='echo -e ${PATH//:/\\n}'  # Echos your current linked patch in a nice readable format
alias du='du --max-depth=1 -hx'      # Makes a more readable "du" output, run on any directory to get file size & total


# --- CFLAGS ----#
export CFLAGS="-march=amdfam10 -O2 -pipe -ftree-vectorize -ftracer \
              -ftree-loop-distribution -floop-block -floop-interchange -floop-strip-mine \
              -findirect-inlining -ftree-switch-conversion"
export CXXFLAGS="${CFLAGS}"
export LDFLAGS="-Wl,-O1 -Wl,--as-needed"

You'll notice a nice colored terminal whenever you "# source /root/.bashrc". And, I added some highly optimized global GCC Flags, for when your compiling the source.

NOTE: if your having any compiling error's try removing "-ftracer" first and then try compiling again, it shouldn't be a problem, and I haven't had any trouble with similar flags.

Also, if you want this .bashrc sourced for the colored prompt every time you login, you need to add this line to your .bash_profile.

Code:

. /root/.bashrc
You still need to # source .bashrc in the root directory whenever you chroot though.

Check out the aliases I added, "cd /" to the base directory and type "du" you'll notice a nice readable du format & then try the command "path" you'll then noticed that there is a nice print out of your $PATH variable. These are nice aliases to have building this CLFS, IMHO. You can use the "du" command in any directory to give you the directory sizes (disk space used).

Also if you ever get confused, because you have multiple terminals open with the same colors. In the "chrooted" CLFS terminal window type this:

(I added this to the .bashrc above)
Code:

# export PS1="(clfs) $PS1"
This will show you which terminal your working with, and if for some reason the colored prompt doesn't show then just:

Code:

# source .bashrc
And the last Hint .... With your Quad core you can use all for cores to compile, and greatly increase compile times, whenever you see the "make" command add -j5 to the of it.. Like so:

Code:

# make -j5

# make -j5 test

And if the compile fails for some reason, then just type make.


I added a file called "DIR_COLORS" this is the file Gentoo uses to set its colors in prompt for files,dir ... etc. Remove the ".txt" and add it to the /etc directory of the CLFS install. So, when you ever source ~/.bashrc, you'll have colors for your tar files, and others...

And remember to source ~/.bashrc whenever you chroot.

lloydsmart 09-30-2009 08:08 AM

I'm having some trouble with the Gentoo Live DVD. Can't get it to start X. It just goes to a black screen with a cursor at the top, as if waiting for text input. Nothing else happens, and every 30 seconds or so, I see the DVD activity light come on for a few seconds, then go off.

Any ideas? I'd like to get started with this ASAP. Thanks.

manwithaplan 09-30-2009 04:33 PM

Quote:

Originally Posted by lloydsmart (Post 3701784)
I'm having some trouble with the Gentoo Live DVD. Can't get it to start X. It just goes to a black screen with a cursor at the top, as if waiting for text input. Nothing else happens, and every 30 seconds or so, I see the DVD activity light come on for a few seconds, then go off.

Any ideas? I'd like to get started with this ASAP. Thanks.

Well that's weird, I am trying out this DVD as I write. I loaded right into X KDE.

Have you tried the different kernel? Or, any of the boot options? I am guessing it might be conflicting with your video card. Try kernel gentoo-nofb and see if that has an effect, along with a boot option. You can read the boot options on the DVD in a text file, or at startup hit F2, to list all the options. If all else fails, I have had the best luck and hardware detection with Sabayon's Live DVD 4.2. Its way bloated, but it works, and even autoloads my nvidia drivers.

BTW, I finished up my CLFS, and hacked the sh*t out of it. I dont know if you know much about sysinit... Its the init that starts all the devices and any loadable modules & daemons on bootup. In the CLFS book they bundle there own, (There crappy and not manageable- total hacks) So, I added Roy Marple's OpenRC 5.0 . I had to patch the code to get it to work with my CLFS, but man what a difference. I think I am going to write up a CLFS hint for this project. It makes a world of difference.

I also recommend you follow my previous hints, it helps alot:
(I have edited it, and also added an attachment for more colors at the prompt. The attachment is from Gentoo).


I have another hint that can be extremely useful when downloading all of those packages. It grabs all the downloads in one full scoop. Let me know when you get up and running, and I'll help you through this... Let me know if i you want the commands to DL all the packages at once.


All times are GMT -5. The time now is 05:47 PM.