+ # hostname
+ with open(os.path.join(name, 'etc', 'hostname'), 'w', encoding='utf-8') as f:
+ f.write(hostname + "\n")
+
+ # user
+ command = [
+ 'chroot', name,
+ 'adduser', '--gecos', '', '--disabled-password', 'linaro',
+ ]
+ completed_process = subprocess.run(command, check=True)
+
+ command = [
+ 'chroot', name, 'chpasswd',
+ ]
+ process = subprocess.Popen(command, stdin=subprocess.PIPE, text=True)
+ process.communicate(input='linaro:linaro')
+
+ # root password
+ process = subprocess.Popen(command, stdin=subprocess.PIPE, text=True)
+ process.communicate(input="root:root")
+