代王
In winter 617, the general Li Yuan the Duke of Tang, who had rebelled at Taiyuan earlier that year, captured Chang'an and declared Emperor Yang's grandson Yang You the Prince of Dai emperor (as Emperor Gong). Li Yuan assumed power as regent, and he wrote to Xiao Yu, requesting that Xiao submit. Xiao agreed, and was made the minister of census and created the Duke of Song. In spring 618, during an abortive campaign where Li Yuan sent his sons Li Jiancheng and Li Shimin with an army to the eastern capital Luoyang to try to get Sui officials there to submit, Xiao served on Li Shimin's staff.