LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   LFS 6.7 - Problem, populating /dev with a BSD-style init (https://www.linuxquestions.org/questions/linux-from-scratch-13/lfs-6-7-problem-populating-dev-with-a-bsd-style-init-834437/)

jimmy_page_89 09-25-2010 10:29 AM

LFS 6.7 - Problem, populating /dev with a BSD-style init
 
Hello everybody,
i'm building an LFS 6.7 with a BDS-style init
i follow the hint, with a little modification of the rc.sysinit:
Code:

#!/bin/sh

# Starting /etc/rc.d/rc.sysinit

PATH=/sbin:/usr/sbin:/bin:/usr/bin

echo "Mounting root device read-only..."
/bin/mount -n -o remount,ro /

echo "Starting udev..."
mount -n -t sysfs sysfs /sys
mount -n -t proc proc /proc
mount -n -t tmpfs tmpfs /dev
echo > /proc/sys/kernel/hotplug
cp -ar /lib/udev/devices/* /dev
udevd --daemon
#udevtrigger
#udevsettle

echo "Initializing swap partitions..."
/sbin/swapon -a

/sbin/fsck -A -a -C
if [ $? -gt 1 ]; then
  echo
  echo "ERROR:"
  echo "Your filesystem has been severely damaged. You can probably correct this"
  echo "problem by running e2fsck manually (eg. with the -v and -y options). After"
  echo "you logout, the system will reboot"
  echo
  PS1="(Repair filesystem)# "
  export PS1
  /sbin/sulogin
  /bin/umount -a -r
  /sbin/reboot -f
fi

echo "Remounting root device read-write..."
/bin/mount -n -v -o remount,rw /

echo "" >/etc/mtab
/bin/mount -f -o remount,rw /

echo "Recording existing mounts in /etc/mtab..."
mount -f /proc
mount -f /sys

echo "Mounting other local filesystems..."
/bin/mount -a -v -tnonfs

echo "Setting up loopback networking..."
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo

echo "Setting up hostname..."
/bin/hostname `cat /etc/HOSTNAME |cut -d . -f1`
/bin/domainname `cat /etc/HOSTNAME |cut -d . -f2-`

if [ -f "/tmp/random-seed" ]; then
  echo "Initializing random number generator..."
  /bin/cat /tmp/random-seed >/dev/urandom
  rm -f /tmp/random-seed
fi

echo "Loading keymap..."
/usr/bin/loadkeys -d

echo "Configuring RTC..."
echo 1024 > /proc/sys/dev/rtc/max-user-freq

echo "Setting system time from hardware clock..."
/sbin/hwclock --hctosys --utc

echo "Starting system and kernel log daemons..."
/usr/sbin/syslogd
/usr/sbin/klogd -c3

echo "Updating module dependencies..."
/sbin/depmod -a

at the "swapon -a", it can't found /dev/hda2 (my swap partition)
because into /dev there isn't hda2 (and hda1 also, my root partition)
how can i solve this?

Thanks

druuna 09-25-2010 02:16 PM

Hi,

Never tried a LFS with BSD-style init, but one thing doesn't look correct when using a modern kernel and udev: Shouldn't hda1 and hda2 be sda1 and sda2?

I don't see them mentioned in your posted code nor in the hint, /etc/fstab related?

Check the output of the dmesg command to see how the partitions are recognized.

Hope this helps.

jimmy_page_89 09-25-2010 03:02 PM

when i see the graphical boot, kernel recognize partitions as hda{1,2}
but, in every case, in /dev i can't se hd* and sd*
every node of the hard disk wasn't create..

Thanks

druuna 09-26-2010 02:52 AM

Hi,

A few questions:

- Did you have a working LFS before you changed to BSD init style?
- How far does the boot process go and what error message is produced (if it doesn't finish that is).

Also:

If I look at the standard /etc/rc.d/init.d/udev script I see some differences that you might want to look into.

Quote:

echo "Mounting root device read-only..."
/bin/mount -n -o remount,ro /

echo "Starting udev..."
mount -n -t sysfs sysfs /sys
mount -n -t proc proc /proc # Is this one needed here?
mount -n -t tmpfs tmpfs /dev # Shouldn't this be: mount -n -t tmpfs tmpfs /dev -o mode=755
echo > /proc/sys/kernel/hotplug
cp -ar /lib/udev/devices/* /dev shouldn't this be: cp -a /lib/udev/devices/null /dev
udevd --daemon # Add full path to udev: /sbin/udevd --daemon
#udevtrigger # Why is this commented out? /sbin/udevadm trigger --action=add
#udevsettle # Commented out? /sbin/udevadm settle
When do you load your modules? This should be done before the udev part runs. I think proc should already be available to load the modules. I.e:
- first kernel based FS is mounted,
- then modules are loaded,
- then udev is populated.

Hope this gets you going again.


All times are GMT -5. The time now is 11:16 AM.