So I have a custom minimal kernel I have created which boots fine on the RPI. I'm using busybox for my init process. However I am having some trouble with the ethernet port. (This is on the model B RPI). In my init scripts I have the interface being configured with an IP address I know. (At some point in the future I'll enable DHCP on it.) The problem is the calls to ifconfig are failing. The reason they are failing is because the smsc95xx ethernet interface is not up yet. A few lines down in the boot up process (after I see the ifconfig fail) I see the ethernet interface come up. If I continue on with the command line I can manually configure the ethernet port.

I thought this might be due to me not calling ifconfig at the right runlevel but it seems the busybox inittab does not use runlevels.

Anyways does anyone have an idea how I can run this configuration at the correct moment? I have reproduced a few parts of my script that make my image. Specifically the inittab portion:

# Setup the inittab                                                             
mkdir ${ROOTFS}/etc                                                             
echo "::sysinit:/etc/init.d/rcS                                                 
::shutdown:/bin/umount -a -r" > ${ROOTFS}/etc/inittab                           

mkdir ${ROOTFS}/etc/init.d                                                      

echo "#!/bin/sh                                                                 
mount -t proc proc /proc" > ${ROOTFS}/etc/init.d/rcS                            
chmod +x ${ROOTFS}/etc/init.d/rcS                                               

echo "#!/bin/sh                                                                 
" > ${ROOTFS}/etc/init.d/rc1                                                    
chmod +x ${ROOTFS}/etc/init.d/rc1                                               
echo "#!/bin/sh                                                                 

" > ${ROOTFS}/etc/init.d/rc2                                                    
chmod +x ${ROOTFS}/etc/init.d/rc2                                               
echo "#!/bin/sh                                                                 

" > ${ROOTFS}/etc/init.d/rc3                                                    
chmod +x ${ROOTFS}/etc/init.d/rc3                                               
echo "#!/bin/sh                                                                 

" > ${ROOTFS}/etc/init.d/rc4                                                    
chmod +x ${ROOTFS}/etc/init.d/rc4                                               

echo "#!/bin/sh                                                                 
ifconfig eth0 up                                                                
ifconfig eth0 netmask broadcast       
route add default gw                                                
telnetd -l /bin/login                                                           
/bin/sh" > ${ROOTFS}/etc/init.d/rc5                                             
chmod +x ${ROOTFS}/etc/init.d/rc5                                               

echo "#!/bin/sh                                                                 
" > ${ROOTFS}/etc/init.d/rc6                                                    
chmod +x ${ROOTFS}/etc/init.d/rc6     
  • 1
    I have not done much with busybox so I can't answer your question directly but as you said busybox doesn't use runlevels so I don't know how it is running your scripts at all. See man.he.net/man1/busybox for details. Try putting your ifconfig stuff in rcS.
    – Craig
    Jan 23 '13 at 23:21
  • Yeah, thanks for the suggestion. I had in fact originally had it all in rcS but then I was thinking it might be runlevels... then I realized busybox doesn't do them. Any other ideas? Jan 24 '13 at 0:56
  • 2
    cron job in the place where the acual ifconfig is to run ifconfig 3~4 seconds later?
    – Piotr Kula
    Jan 24 '13 at 8:51
  • Yeah, I suppose that would work just fine, but it seems to be a hack. Jan 24 '13 at 14:22
  • Do the normal distros just have some network daemon that monitors and applies configuration to interfaces when they come up? Jan 24 '13 at 14:22

Have you considered having the kernel configure the interface? This might actually make more sense in a minimalist environment anyway. It requires the "kernel level autoconfiguration" option, CONFIG_IP_PNP. The bootloader then parses the ip= option for the IP address.


You can also get it to do DHCP.

  • I have not tried this, but I don't have the setup to try it quickly anymore but this looks like what I wanted if it can be done with DHCP. Thanks Mar 4 '14 at 8:02
  • It will work with DHCP, but that'll need to be enabled in the kernel with CONFIG_IP_PNP_DHCP. Then you set ip=dhcp.
    – Fred
    Mar 4 '14 at 16:47

In my case, the solution given by Fred works only partially: DNS configuration wasn't set even with <dns0-ip>:<dns1-ip>

I finally just add a sleep 5 command in /etc/init.d/S40network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.