Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

inittab and rcS

Hello,

I would like to know if there is an example for writing inittab and rcS. I added Busybox in the filesystem.

I would like to enable uart port for the default console. I think that I have to add an entry in this file to enable it.

Thanks

Christ ian

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Take a peek inside the Reference Guide. There is an example inittab that can be used.

    Also, please be careful with newlines... busybox expects only the linux style newlines.

    To be safe, I would run each of the files through dos2unix.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I copy the 2 files... Is it correct... I don't know why... The console restarts the shell after few seconds

    // Here is what it displays

    ...

    init started: BusyBox v1.00-pre8 (2004.07.08-18:39+0000) multi-call binary

    Booting Altera Nios 2 uCLinux

    expand: from=/ramfs.img to=/dev/ram0

    expand: from=/ramfs.img to=/dev/ram1

    Please press Enter to activate this console.

    #

    Please press Enter to activate this console.

    Please press Enter to activate this console.

    Please press Enter to activate this console.

    ...

    //

    inittab file

    ::sysinit:/bin/sh /etc/init.d/rcS

    ::respawn:/bin/agetty -n -l /bin/lsh -L ttyS0 115200 vt100

    ::ctrlaltdel:/sbin/reboot

    ::shutdown:umount –a –r

    ::restart:/sbin/init

    ::askfirst:-/bin/sh

    rcS# !/bin/sh

    echo "Booting Altera Nios 2 uCLinux"

    # !/bin/sh# # system startup.

    # set up the hostname

    /bin/hostname Nios2

    # expand and mount the ramdisk

    /bin/expand /ramfs.img /dev/ram0

    /bin/mount -t ext2 /dev/ram0 /var -n

    /bin/expand /ramfs.img /dev/ram1

    /bin/mount -t ext2 /dev/ram1 /tmp -n

    # mount proc file system

    /bin/mount -t proc proc /proc -n

    # manually assign ip address (uncomment and edit as appropriate)# note: first ifattach (no args) sets local loopback

    /bin/ifattach# /bin/ifattach --addr 10.1.1.99 --mask 255.255.255.0 --net 10.1.1.0 --gw 10.1.1.11 --if eth0

    # try and get ip address automatically...# /bin/mkdir /var/dhcpc# /bin/dhcpcd -NRY &

    # start up the internet superserver

    /bin/inetd &

    # start up the web server

    /bin/boa &

    # mount Linux server:# (uncomment and edit as appropriate)# /bin/mount -t nfs 192.168.1.30:/home /mnt/nfs -n -o nolock

    # mount master ide disk partition(s):# (uncomment and edit as appropriate)# /bin/mount /dev/hda1 /mnt/ide0 -n

    # that's it... success

    exit 0

    Best regards

    CHristian