Lady Lu, who later received the title of Lady Dowager of Yan. During reign of Emperor Xizong of Tang Song Wentong apparently became an officer in the Boye Army, which was then stationed at Fengtian (奉天, in modern Xianyang, Shaanxi), in his youth. When the major agrarian rebel Huang Chao captured Chang'an around the new year 881 and forced then-reigning Emperor Xizong (Emperor Xuānzong's grandson) to flee to Chengdu, the Boye Army moved to Fengxiang Circuit and followed the orders of Fengxiang's military governor (Jiedushi), the former chancellor Zheng Tian. When Huang sent his major general Shang Rang to attack Zheng, Zheng repelled Shang; in that battle, Song distinguished himself, and thereafter was made a commander in the imperial Shence Army. During his service there, he was once favored by the powerful eunuch Tian Lingzi who adopted him as his son with the name Tian Yanbin (). In 886, Emperor Xizong, who had returned to Chang'an after Huang's defeat, was again forced to flee Chang'an, to Xingyuan (興元, in modern Hanzhong, Shaanxi) after his trusted eunuch advisor Tian Lingzi got into a confrontation with the warlords Wang Chongrong the military governor of Huguo Circuit (護國, headquartered in modern Yuncheng, Shanxi) and Li Keyong the military governor of Hedong Circuit (河東, headquartered in modern Taiyuan, Shanxi) and was subsequently defeated by Wang Chongrong and Li Keyong. Two other warlords, Zhu Mei the military governor of Jingnan Circuit (靜難, headquartered in modern Xianyang) and Li Changfu the military governor of Fengxiang, who had previously been allied with Tian, turned against Emperor Xizong as well and supported his distant relative Li Yun the Prince of Xiang as a rival emperor at Chang'an. Zhu subsequently sent his general Wang Xingyu to advance on Xingyuan to try to capture Emperor Xizong, and Wang Xingyu initially defeated the imperial guard general Yang Sheng (). In response, Emperor Xizong sent Song, Li Chan (), and Chen Pei () to station themselves at Mount Datang (大唐峰, in modern Hanzhong) to defend against Wang Xingyu. Wang Xingyu was unable to advance and later, after enticement by Tian's successor and the leading eunuch Yang Fugong, turned against Zhu and killed him. Li Yun fled to Wang Chongrong's territory but was killed by Wang Chongrong. For Song's accomplishments, Emperor Xizong bestowed the imperial surname of Li on him and gave him a new personal name of Maozhen ("prosperous and faithful") as