This blog post records how to package the xl2tpd configuration file into the mirror when the xl2tpd and ppp packages are added through buildroot-2016, and how to add the app startup content to the boot script and package the mirror.
The first xl2tpd configuration parameter modification
1). Add the xl2tpd folder under the build-2016/board/nuvoton (ARM platform related)/rootfs/etc/ folder, and create a new xl2tpd.conf file under the folder, and configure the target machine as a client. The content is as follows
[global]
port =1701
auth file=/etc/xl2tpd/l2tp-secrets
debug network = yes
debug tunnel = yes
debug state = yes
debug packet = yes
[lac vpn]
name = robot ;L2TP的账号
lns = 192.168.123.111 ;L2TP的服务器IP
pppoptfile = /etc/ppp/testvpn.l2tpd ;PPPD拨号配置文件
ppp debug = yes
redial = yes
redial timeout = 15
require chap = yes
refuse pap = yes
require authentication = yes
length bit =yes
rx bps = 100000000
tx bps = 100000000
2.1). Add the ppp folder under the build-2016/board/nuvoton (ARM platform related)/rootfs/etc/ folder, and add testvpn.l2tpd dial configuration file content under the folder
remotename default
user "robot"
password "123"
unit 0
nodeflate
nobsdcomp
noauth
persist
nopcomp
noaccomp
maxfail 5
debug
2.2). Build under the build-2016/board/nuvoton (ARM platform related)/rootfs/ folder, as follows
mkdir -p var/run/xl2tpd
- Modify the contents of the package/xl2tpd/xl2tpd.mk file as follows
define XL2TP_INSTALL_TARGET_CMDS
$(TARGET_CONFIGURE_OPTS) $(MAKE) DESTDIR=$(TARGET_DIR)\
PREFIX=/usr -C $(@D) install
# 增加内容
$(INSTALL) -D -m 755 package/xl2tpd/xl2tpd \
$(TARGET_DIR)/etc/init.d/xl2tpd
endef
#$(eval $(generic-package))
$(eval $(autotools-package))
4). Modify build-2016/board/nuvoton (ARM platform related)/rootfs/etc/init.d/rcS startup script file, how to say the following
#!/bin/sh
/bin/mount -t proc none /proc
/bin/mount -t sysfs sysfs /sys
/bin/mount -t ramfs /tmp
/bin/mount -t ramfs /mnt
#/bin/mkdir /mnt/pts
#/bin/mount -t devpts devpts /dev/pts
/bin/echo > /dev/mdev.seq
/bin/echo /bin/mdev > /proc/sys/kernel/hotplug
#/bin/mdev -s
# 增加如下内容
/etc/init.d/S41network.sh & # 配置网卡 开机自动获取ip地址
/etc/init.d/S49sshd # 配置sshd 的VFS 依赖环境
/etc/init.d/S51sshd # 启动 sshd 服务器
/etc/init.d/xl2tpd start # start xl2tpd
/etc/init.d/ser2net start # start ser2net service
5). Recompile buildroot, check the output/target/etc/init.d/ and output/target/etc/ppp/ folder contents
robot@ubuntu:~/buildroot/build-2016/output/target/etc/init.d$ ls
rcK rcS S01logging S10udev S20urandom S29netplug S30rpcbind S40network S41network.sh S49ntp S49sshd S50ser2net S50sshd S51sshd S59snmpd S60openvpn S99at socketcand xl2tpd
So far, the configuration file of xl2tpd is packaged into the mirror.