Assigning IP address at boot

I’m sure someone will have an easy solution for this but I’ve been batting it around for a few weeks now…

I’ve got a stripped down version of QNX 6.3 running in my embedded system. During the boot process I do this:

io-net -ptcpip -drtl -pqnet bind=en0,host=cpu1,mount=/
waitfor /net 6
ifconfig en0

This works fine, but the problem is that in order to change the boot system’s IP address I have to edit this script and rebuild. Tedious at best. Is there a simple way to have the IP address be in a text file on the drive that I can edit instead of inserted physically into the .boot image? Bear in mind that I unfortunately don’t have DHCP, scripting languages or editors available to me on my target.



why don’t you write your own script file that will run at every boot time which sets the ip address. Then this script file is not in .boot and you can change the ip address easily by modifying the script file. When you build your .boot image have it to run this script file if it exist.

Here’s what I use (called from a script at startup):

if [[ -e /etc/IPADDRESS ]]; then
    ifconfig en0 $(head -l -n1 /etc/IPADDRESS) up
    ifconfig en0 up

looks ok to me…