HOSTNAME as OpenWrt issue: I did an experiment. I started from scratch. I then did board setup built from board halowlink1, went into menuconfig and changed to hlk7688, also changed default ip addr to 192.168.3.1. I then used the ./files/etc/board.d/02_network with the only change being to make the hilink have a different lan port config so I could get to our board through ethernet. Guess what? After loading, the hostname came as expected. In the system card of the home page, Hostname is “hlk-7688a-481e”, not “OpenWrt”.
So… what is it about that build vs. my build?
Below is the code from ./package/base-files/files/bin/config_generate which I suspect is what this is about.
I use my board in initial setup to build the project just like above for halowlink1. But in the above paragraph, it seems it goes through the json ‘if’ block in the code below which sets the hostname as I’d expect but my board build doesn’t go through that ‘if’, thus, leaves hostname as “OpenWrt”. Am I looking at the right spot for this? Is there something else I’m not aware of?
generate_static_system() {
uci -q batch <<-EOF
delete system.@system[0]
add system system
set system.@system[-1].hostname='OpenWrt'
set system.@system[-1].timezone='UTC'
set system.@system[-1].ttylogin='0'
set system.@system[-1].log_size='64'
set system.@system[-1].urandom_seed='0'
delete system.ntp
set system.ntp='timeserver'
set system.ntp.enabled='1'
set system.ntp.enable_server='0'
add_list system.ntp.server='0.openwrt.pool.ntp.org'
add_list system.ntp.server='1.openwrt.pool.ntp.org'
add_list system.ntp.server='2.openwrt.pool.ntp.org'
add_list system.ntp.server='3.openwrt.pool.ntp.org'
EOF
if json_is_a system object; then
json_select system
local hostname
if json_get_var hostname hostname; then
uci -q set "system.@system[-1].hostname=$hostname"
fi
UPDATE: I just built another where I have my board directory. It did not build with the common folder b/c it didn’t use any luci themes. The halowlink1 uses morseargon. Then when I got the image loaded, the hostname was “OpenWrt”. I had the following in the boards/hlk-7688a/target_diffconfig file, which is slightly different than the halowlink1 file. What is the build doing different for halowlink1 that it puts the theme in .config and allows the hostname to be other than “OpenWrt”?
CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_mt76x8=y
CONFIG_TARGET_ramips_mt76x8_DEVICE_hilink_hlk-7688a=y
CONFIG_TARGET_ROOTFS_INITRAMFS=n
CONFIG_VERSION_DIST=“ep-halow”
CONFIG_VERSION_CODE=“Morse-2.9.3-baseline”
CONFIG_VERSION_MANUFACTURER=“NexcommAP”
CONFIG_VERSION_MANUFACTURER_URL=“ Nexcomm Systems - Nexcomm Systems
CONFIG_VERSION_PRODUCT=“ep-halow”
CONFIG_TARGET_PREINIT_IP=“192.168.3.1”
CONFIG_TARGET_PREINIT_BROADCAST=“192.168.3.255”
CONFIG_TARGET_DEFAULT_LAN_IP_FROM_PREINIT=y
CONFIG_PACKAGE_morsectrl=y
CONFIG_PACKAGE_luci-app-ekhwizards=y
CONFIG_PACKAGE_morse-button=y
CONFIG_PACKAGE_persistent-vars-storage-ubootenv=y
CONFIG_PACKAGE_virtual-wire=y
CONFIG_PACKAGE_morse-led-rgb=y
CONFIG_MORSE_SDIO_ALIGNMENT=8
CONFIG_PACKAGE_morse-mgmt-iface=y
CONFIG_PACKAGE_wizard-config=y
Since that didn’t work, I copied the target_diffconfig from the halowlink1 dir into the hlk-7688a dir. The only difference was I replaced the 1st 4 lines with the 1st 4 lines above. After I did setup_morse, the following was in the .config:
CONFIG_PACKAGE_luci-theme-morseargon=y
So, now I’ll wait a while for make -j8 to build, and I’m going to make a guess: hostname will not be OpenWrt. Then I want to know…what is different, meaning what am I missing in the above original hlk-7688a target_diffconfig that it makes the hostname OpenWrt, which CONFIG_ setting is it?
I did discover CONFIG_PACKAGE_morse-fw-6108=y is necessary to have setup_morse select morseargon as the luci theme. Without that, no theme gets picked and morseargon isn’t even an option.
I’m going nuts trying to figure out what parameter(s) are necessary for the hostname to be something like “hlk-7688a-481c” instead of OpenWrt. I have been able to make it be not OpenWrt when building baseline using my hlk-7688a board dir which largely uses halowlink1 for most of target_diffconfig params. But when I try to make my other project have the same settings, that one always defaults hostname to OpenWrt. I have yet to find out what works.