From 6c4ff39e7b918f2d4791fd83aa9b985654dd1edc Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Wed, 15 Aug 2012 12:02:44 -0500 Subject: [PATCH] serial: use the chroot script for setting serial port Signed-off-by: Robert Nelson --- TODO | 1 - mk_mmc.sh | 54 ++++++++++++++------------------------ scripts/debian-finish.sh | 6 +++-- scripts/serial.conf | 5 ---- scripts/ubuntu-finish.sh | 12 +++++++++ scripts/ubuntu-tweaks.diff | 3 +-- 6 files changed, 36 insertions(+), 45 deletions(-) delete mode 100644 scripts/serial.conf diff --git a/TODO b/TODO index 476d619..09d28ce 100644 --- a/TODO +++ b/TODO @@ -2,4 +2,3 @@ Easy: * debug.log, to help troubleshoot failures (do we need anything else /boot/uboot/backup/* after install) * random http link to *.deb package (--deb-file just needs to be extended to http case, as it works for local files) * move most of scripts/*tweaks.diff to scripts/*finish.sh as the *.diff is stuck with busybox limiations.. - diff --git a/mk_mmc.sh b/mk_mmc.sh index 751b120..ebedcb6 100755 --- a/mk_mmc.sh +++ b/mk_mmc.sh @@ -728,6 +728,7 @@ function tweak_boot_scripts { fi if [ "${SERIAL_MODE}" ] ; then + echo "NetInstall: Setting up to use Serial Port: [${SERIAL}]" #In pure serial mode, remove all traces of VIDEO if [ ! "${USE_KMS}" ] ; then sed -i -e 's:UENV_VRAM::g' ${TEMPDIR}/bootscripts/${NET} @@ -801,10 +802,6 @@ function setup_bootscripts { boot_uenv_txt_template tweak_boot_scripts - echo "NetInstall: Setting up to use Serial Port: [${SERIAL}]" - sed -i -e 's:SERIAL:'${SERIAL}':g' "${DIR}/scripts/serial.conf" - sed -i -e 's:SERIAL:'${SERIAL}':g' "${DIR}/scripts/debian-finish.sh" - if [ "$SMSC95XX_MOREMEM" ] ; then sed -i 's/8192/16384/g' "${DIR}/scripts/ubuntu-tweaks.diff" sed -i 's/8192/16384/g' "${DIR}/scripts/debian-tweaks.diff" @@ -942,7 +939,6 @@ function initrd_preseed_settings { maverick|natty|oneiric|precise|quantal) patch -p1 < "${DIR}/scripts/ubuntu-tweaks.diff" cp -v "${DIR}/scripts/flash-kernel.conf" ${TEMPDIR}/initrd-tree/etc/flash-kernel.conf - cp -v "${DIR}/scripts/serial.conf" ${TEMPDIR}/initrd-tree/etc/${SERIAL}.conf cp -v "${DIR}/scripts/ubuntu-finish.sh" ${TEMPDIR}/initrd-tree/etc/finish-install.sh ;; squeeze|wheezy) @@ -976,10 +972,6 @@ function initrd_fixes { else echo "vm.min_free_kbytes = 8192" >> ${TEMPDIR}/initrd-tree/etc/sysctl.conf fi - - if [ "${SERIAL_MODE}" ] ; then - touch ${TEMPDIR}/initrd-tree/etc/rcn-serial.conf - fi } function recompress_initrd { @@ -1231,18 +1223,20 @@ function populate_boot { cp -v "${DIR}/dl/${DISTARCH}/${ACTUAL_DEB_FILE}" ${TEMPDIR}/disk/ + #This should be compatible with hwpacks variable names.. + #https://code.launchpad.net/~linaro-maintainers/linaro-images/ cat > ${TEMPDIR}/disk/SOC.sh <<-__EOF__ #!/bin/sh format=1.0 board=${BOOTLOADER} + boot_image=${boot} + boot_script=${boot_script} + serial_tty=${SERIAL} kernel_addr=${kernel_addr} initrd_addr=${initrd_addr} load_addr=${load_addr} dtb_addr=${dtb_addr} dtb_file=${dtb_file} - startup_script=${startup_script} - boot_image=${boot} - boot_fstype=${boot_fstype} __EOF__ @@ -1459,9 +1453,6 @@ fi } function reset_scripts { - sed -i -e 's:'${SERIAL}':SERIAL:g' "${DIR}/scripts/serial.conf" - sed -i -e 's:'${SERIAL}':SERIAL:g' "${DIR}/scripts/debian-finish.sh" - if [ "${SMSC95XX_MOREMEM}" ] ; then sed -i 's/16384/8192/g' "${DIR}/scripts/ubuntu-tweaks.diff" sed -i 's/16384/8192/g' "${DIR}/scripts/debian-tweaks.diff" @@ -1510,10 +1501,11 @@ function is_omap { initrd_addr="0x81600000" load_addr="0x80008000" dtb_addr="0x815f0000" - startup_script="uEnv.txt" + boot_script="uEnv.txt" boot_fstype="fat" + SERIAL="ttyO2" SERIAL_CONSOLE="${SERIAL},115200n8" VIDEO_CONSOLE="console=tty0" @@ -1540,10 +1532,12 @@ function is_imx { unset spl_name boot_name="u-boot.imx" - SERIAL_CONSOLE="${SERIAL},115200" SUBARCH="imx" - startup_script="uEnv.txt" + SERIAL="ttymxc0" + SERIAL_CONSOLE="${SERIAL},115200" + + boot_script="uEnv.txt" boot_fstype="ext2" @@ -1572,7 +1566,6 @@ function check_uboot_type { beagle_bx) SYSTEM="beagle_bx" BOOTLOADER="BEAGLEBOARD_BX" - SERIAL="ttyO2" is_omap #dtb_file="omap3-beagle.dtb" echo "-----------------------------" @@ -1583,7 +1576,6 @@ function check_uboot_type { beagle_cx) SYSTEM="beagle_cx" BOOTLOADER="BEAGLEBOARD_CX" - SERIAL="ttyO2" is_omap #dtb_file="omap3-beagle.dtb" echo "-----------------------------" @@ -1595,14 +1587,12 @@ function check_uboot_type { beagle_xm) SYSTEM="beagle_xm" BOOTLOADER="BEAGLEBOARD_XM" - SERIAL="ttyO2" is_omap #dtb_file="omap3-beagle.dtb" ;; beagle_xm_kms) SYSTEM="beagle_xm" BOOTLOADER="BEAGLEBOARD_XM" - SERIAL="ttyO2" is_omap #dtb_file="omap3-beagle.dtb" @@ -1615,8 +1605,10 @@ function check_uboot_type { boot="bootm" SYSTEM="bone" BOOTLOADER="BEAGLEBONE_A" - SERIAL="ttyO0" is_omap + SERIAL="ttyO0" + SERIAL_CONSOLE="${SERIAL},115200n8" + USE_UIMAGE=1 SUBARCH="omap-psp" @@ -1629,8 +1621,9 @@ function check_uboot_type { bone_zimage) SYSTEM="bone_zimage" BOOTLOADER="BEAGLEBONE_A" - SERIAL="ttyO0" is_omap + SERIAL="ttyO0" + SERIAL_CONSOLE="${SERIAL},115200n8" USE_BETA_BOOTLOADER=1 @@ -1644,7 +1637,6 @@ function check_uboot_type { igepv2) SYSTEM="igepv2" BOOTLOADER="IGEP00X0" - SERIAL="ttyO2" is_omap SERIAL_MODE=1 @@ -1653,7 +1645,6 @@ function check_uboot_type { SYSTEM="panda" BOOTLOADER="PANDABOARD" SMSC95XX_MOREMEM=1 - SERIAL="ttyO2" is_omap #dtb_file="omap4-panda.dtb" VIDEO_OMAP_RAM="16MB" @@ -1663,7 +1654,6 @@ function check_uboot_type { SYSTEM="panda_es" BOOTLOADER="PANDABOARD_ES" SMSC95XX_MOREMEM=1 - SERIAL="ttyO2" is_omap #dtb_file="omap4-panda.dtb" VIDEO_OMAP_RAM="16MB" @@ -1673,7 +1663,6 @@ function check_uboot_type { SYSTEM="panda_es" BOOTLOADER="PANDABOARD_ES" SMSC95XX_MOREMEM=1 - SERIAL="ttyO2" is_omap #dtb_file="omap4-panda.dtb" @@ -1686,7 +1675,6 @@ function check_uboot_type { crane) SYSTEM="crane" BOOTLOADER="CRANEBOARD" - SERIAL="ttyO2" is_omap KERNEL_SEL="TESTING" @@ -1695,7 +1683,6 @@ function check_uboot_type { mx51evk) SYSTEM="mx51evk" BOOTLOADER="MX51EVK" - SERIAL="ttymxc0" is_imx kernel_addr="0x90010000" initrd_addr="0x92000000" @@ -1707,7 +1694,6 @@ function check_uboot_type { mx51evk_dtb) SYSTEM="mx51evk_dtb" BOOTLOADER="MX51EVK" - SERIAL="ttymxc0" is_imx kernel_addr="0x90010000" initrd_addr="0x92000000" @@ -1721,7 +1707,6 @@ function check_uboot_type { mx53loco) SYSTEM="mx53loco" BOOTLOADER="MX53LOCO" - SERIAL="ttymxc0" is_imx kernel_addr="0x70010000" initrd_addr="0x72000000" @@ -1733,7 +1718,6 @@ function check_uboot_type { mx53loco_dtb) SYSTEM="mx53loco_dtb" BOOTLOADER="MX53LOCO" - SERIAL="ttymxc0" is_imx kernel_addr="0x70010000" initrd_addr="0x72000000" @@ -1747,8 +1731,9 @@ function check_uboot_type { mx6q_sabrelite) SYSTEM="mx6q_sabrelite" BOOTLOADER="MX6Q_SABRELITE_D" - SERIAL="ttymxc1" is_imx + SERIAL="ttymxc1" + SERIAL_CONSOLE="${SERIAL},115200" boot="bootm" USE_UIMAGE=1 unset bootloader_location @@ -1763,7 +1748,6 @@ function check_uboot_type { SERIAL_MODE=1 need_dtbs=1 boot_scr_wrapper=1 - startup_script="6q_bootscript" ;; *) IN_VALID_UBOOT=1 diff --git a/scripts/debian-finish.sh b/scripts/debian-finish.sh index 8ae98b1..64ef4da 100644 --- a/scripts/debian-finish.sh +++ b/scripts/debian-finish.sh @@ -47,8 +47,10 @@ cp /boot/initrd.img-`uname -r` /boot/uboot/initrd.img rm -f /boot/uboot/linux-image-*_1.0*_arm*.deb || true -cat etc/inittab | grep -v '#' | grep SERIAL || echo "T2:23:respawn:/sbin/getty -L SERIAL 115200 vt102" >> /etc/inittab && echo "#" >> /etc/inittab - +serial_tty=$(cat /boot/uboot/SOC.sh | grep serial_tty | awk -F"=" '{print $2}') +if [ "x${serial_tty}" != "x" ] ; then + cat etc/inittab | grep -v '#' | grep SERIAL || echo "T2:23:respawn:/sbin/getty -L ${serial_tty} 115200 vt102" >> /etc/inittab && echo "#" >> /etc/inittab +fi boot_fstype=$(cat /boot/uboot/SOC.sh | grep boot_fstype | awk -F"=" '{print $2}') if [ "x${boot_fstype}" == "xext2" ] ; then echo "/dev/mmcblk0p1 /boot/uboot ext2 defaults 0 2" >> /etc/fstab diff --git a/scripts/serial.conf b/scripts/serial.conf deleted file mode 100644 index 523d937..0000000 --- a/scripts/serial.conf +++ /dev/null @@ -1,5 +0,0 @@ -start on stopped rc RUNLEVEL=[2345] -stop on runlevel [!2345] - -respawn -exec /sbin/getty 115200 SERIAL diff --git a/scripts/ubuntu-finish.sh b/scripts/ubuntu-finish.sh index ddde243..19203f3 100644 --- a/scripts/ubuntu-finish.sh +++ b/scripts/ubuntu-finish.sh @@ -89,6 +89,18 @@ cp /boot/initrd.img-`uname -r` /boot/uboot/initrd.img rm -f /boot/uboot/linux-image-*_1.0*_arm*.deb || true +serial_tty=$(cat /boot/uboot/SOC.sh | grep serial_tty | awk -F"=" '{print $2}') +if [ "x${serial_tty}" != "x" ] ; then + cat > /etc/init/${serial_tty}.conf <<-__EOF__ + start on stopped rc RUNLEVEL=[2345] + stop on runlevel [!2345] + + respawn + exec /sbin/getty 115200 ${serial_tty} + + __EOF__ +fi + boot_fstype=$(cat /boot/uboot/SOC.sh | grep boot_fstype | awk -F"=" '{print $2}') if [ "x${boot_fstype}" == "xext2" ] ; then echo "/dev/mmcblk0p1 /boot/uboot ext2 defaults 0 2" >> /etc/fstab diff --git a/scripts/ubuntu-tweaks.diff b/scripts/ubuntu-tweaks.diff index 022b810..4e57dc2 100644 --- a/scripts/ubuntu-tweaks.diff +++ b/scripts/ubuntu-tweaks.diff @@ -3,10 +3,9 @@ new file mode 100755 index 0000000..6d06fc7 --- /dev/null +++ b/usr/lib/finish-install.d/08rcn-ee-finish-installing-device -@@ -0,0 +1,31 @@ +@@ -0,0 +1,30 @@ +#!/bin/sh -e +cp /etc/flash-kernel.conf /target/etc/flash-kernel.conf -+cp /etc/SERIAL.conf /target/etc/init/SERIAL.conf +cp /etc/finish-install.sh /target/etc/finish-install.sh +chmod a+x /target/etc/finish-install.sh +