All, I solved my problems.
> -----Original Message----- > From: [email protected] <[email protected]> On > Behalf Of Bryan Evenson via lists.yoctoproject.org > Sent: Thursday, January 6, 2022 9:32 AM > To: [email protected] > Subject: [yocto] Problems switching from busybox-udhcpc to dhcpcd > > I have a system that is based off core-image-minimal which uses sysvinit and > busybox-udhcpc. I'm trying to switch to dhcpcd because I want to get the > NTP server list from the local DHCP server; dhcpcd supports this feature and > busybox-udhcpc does not. I'm on the dunfell branch. I think I finally got > firmware upgrade to work cleanly (with opkg) but I'm having trouble > triggering dhcpcd. It doesn't work straight out of the box and I'm looking > for > assistance in how to get dhcpcd started. > > First, here are the recipe changes I made in my custom layer to install dhcpcd > onto my image and for it to get pulled in on firmware upgrade. > 1. I added the following to my busybox_%.bbappend: > > Do not install busybox-udcpcd, since we are using dhcpcd > RRECOMMENDS_${PN} = "" > > 2. I modified my busybox defconfig to unset all the udhcpc related > configuration features > > 3. I created a dhcpcd_%.bbappend with these contents: > # Set the package to conflict with busybox-udhcpc > RCONFLICTS_${PN} = "busybox-udhcpc" > RREPLACES_${PN} = "busybox-udhcpc" > > # Add configuration settings to enable NTP configuration > PACKAGECONFIG += " \ > ntp \ > " > PACKAGECONFIG[ntp] = "--with-hook=ntp, , , ntp" > > # Include the hook scripts on the system > EXTRA_OECONF += " \ > --with-hooks \ > " > 4. In my init-ifupdown_%.bbappend: > a. I added dhcpcd to the RDEPENDS list > b. I added a script to start dhcpcd and installed it in the > ${D}${sysconfdir}/network/if-up directory > > 5. Here is the if-up script (note: I only have one Ethernet port on this > device > which will always be eth0): > #!/bin/sh > > # Only do this for eth0 and not the loopback interface > if [ "$IFACE" == "eth0" ]; then > # Start the DHCP client > dhcpcd -4 -6 -f /etc/dhcpcd.conf "$IFACE" > fi > > > I think I'm close, but the dhcpcd never gets called when the Ethernet > interface starts up. As best I can tell from my debugging, I think $IFACE is > never set whenever my if-up script is called. I'm not sure why that is, > because I have a pre-up script that depends on $IFACE that has been working > for years for me. First, I was having issue even directly calling dhcpcd from the command line with the line I had in my pre-up script. There have been some updates to the dhcpcd recipe in master that affects the file installation locations. I copied the dhcpcd recipe in master and put it in my custom layer. I could then call dhcpcd directly without issue. Second, I needed to enable the CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP configuration parameter in busybox. The ifup and ifdown applets from Busybox were not attempted to call dhcpcd without this set. Once I got both of these fixes in place, I found out that I don't need the if-up script I had created. Everything is running fine now. > > Has anyone else made this transition that can offer some more support? Are > there some examples floating around on how to start dhcpcd on ifup that I > am missing? > > Thanks, > Bryan Evenson Bryan Evenson
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#55786): https://lists.yoctoproject.org/g/yocto/message/55786 Mute This Topic: https://lists.yoctoproject.org/mt/88238321/21656 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
