From patchwork Wed Jan 1 07:34:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1216937 X-Patchwork-Delegate: daniel.schwierzeck@googlemail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="GpzmryL0"; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47njbq5MwRz9sPJ for ; Wed, 1 Jan 2020 18:34:27 +1100 (AEDT) Received: from phobos.denx.de (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1DCB6807AF; Wed, 1 Jan 2020 08:34:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="GpzmryL0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6913C81462; Wed, 1 Jan 2020 08:34:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 641C3803C3 for ; Wed, 1 Jan 2020 08:34:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1577864049; bh=Unzxnhx0GuE8tZvALrl+cRsWTRgRh3TQCrcNRhSlcLs=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=GpzmryL0bUqMVP+reiaUZJsVXQ3GoasQ6TCvXZ4RXGVgJCtsTjgvGmsqN3Bu1DPhi yIfx6EdiNIRPVbNJFg5/pE4ZkFPRE1MiLW1LCxaYA7B59GuPYnKSY8ou4pz+Rxyofn rrJNqeVQEWE9kH04hpYyvXS+NnHr3RwY8h/ZFXHU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from macchiato.fritz.box ([84.119.33.160]) by mail.gmx.com (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1N8XPt-1jqwhU2RdZ-014RAM; Wed, 01 Jan 2020 08:34:09 +0100 From: Heinrich Schuchardt To: Tom Rini Subject: [PATCH 1/1] doc: board: qemu-mips.rst: fix code examples Date: Wed, 1 Jan 2020 08:34:03 +0100 Message-Id: <20200101073403.15705-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:ADPzDrbv7isbabS8uxwffoTjdHXpXUOATKobKpJiPVlXOboWD1P ZTg/RVrFY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qD8CNJ0PhElSezQPLZbcGmba5V+nlvhOjx9cj WiAb3J/pLLCaKHQk658KCGU1bbgjLD0hbVnAffGhW4MaOzj1uE1K5iNAM2k9zOn048Odh719t wj+05sSp3eO0l2e/njyFbfSKQFAXsXTuW1W9g5Q1tUx9abXRHWmbx6dF5T35T3RkJNhc34U2P Q4JgtfxSS7j15ureB2YgWgTokv540wwfkZVDixgQqexj5UicEEi8x4u0FIuufbnGZ/xGnzbNE dZU6dONR1s+A73WmKtMXbI339/94Whnil3em5hU0GJoIPn2CWz/D83qO/MtN2m/41sASNiNxF Zq8uqv8NuMxodE94erYSpxG1lVbszxwKrK2LE+RsbmlbqsL35+0iy7gz/IMfCgq98DnfYpEDN LfX0e0Smsj/p9L2YuXAtewTZ8ZySafcdIcpZS7ER7LzFyzfoKiJ4ViZUzXg0= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: u-boot@lists.denx.de, Heinrich Schuchardt Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean Code sections should be syntax highlighted as bash. Comment lines in code should start with a hash sign ('#') but code lines should not. Most commands can be executed as normal users. Prepend those commands requiring elevated authorization with 'sudo'. dd does not have a parameter cout. sfdisk does not have a -C parameter on Debian Buster. Provide the necessary input to sfdisk. Creating a partition of length zero makes no sense. Signed-off-by: Heinrich Schuchardt --- doc/board/emulation/qemu-mips.rst | 108 +++++++++++++++++------------- 1 file changed, 60 insertions(+), 48 deletions(-) -- 2.24.1 diff --git a/doc/board/emulation/qemu-mips.rst b/doc/board/emulation/qemu-mips.rst index 529a908b55..f206039f54 100644 --- a/doc/board/emulation/qemu-mips.rst +++ b/doc/board/emulation/qemu-mips.rst @@ -25,37 +25,45 @@ Example usage Using u-boot.bin as ROM (replaces Qemu monitor): -32 bit, big endian:: +32 bit, big endian - # make qemu_mips - # qemu-system-mips -M mips -bios u-boot.bin -nographic +.. code-block:: bash -32 bit, little endian:: + make qemu_mips + qemu-system-mips -M mips -bios u-boot.bin -nographic - # make qemu_mipsel - # qemu-system-mipsel -M mips -bios u-boot.bin -nographic +32 bit, little endian -64 bit, big endian:: +.. code-block:: bash - # make qemu_mips64 - # qemu-system-mips64 -cpu MIPS64R2-generic -M mips -bios u-boot.bin -nographic + make qemu_mipsel + qemu-system-mipsel -M mips -bios u-boot.bin -nographic -64 bit, little endian:: +64 bit, big endian - # make qemu_mips64el - # qemu-system-mips64el -cpu MIPS64R2-generic -M mips -bios u-boot.bin -nographic +.. code-block:: bash + + make qemu_mips64 + qemu-system-mips64 -cpu MIPS64R2-generic -M mips -bios u-boot.bin -nographic + +64 bit, little endian + +.. code-block:: bash + + make qemu_mips64el + qemu-system-mips64el -cpu MIPS64R2-generic -M mips -bios u-boot.bin -nographic or using u-boot.bin from emulated flash: -if you use a qemu version after commit 4224 +if you use a QEMU version after commit 4224 -.. code-block:: none +.. code-block:: bash - create image: - # dd of=flash bs=1k count=4k if=/dev/zero - # dd of=flash bs=1k conv=notrunc if=u-boot.bin - start it (see above): - # qemu-system-mips[64][el] [-cpu MIPS64R2-generic] -M mips -pflash flash -nographic + # create image: + dd of=flash bs=1k count=4k if=/dev/zero + dd of=flash bs=1k conv=notrunc if=u-boot.bin + # start it (see above): + qemu-system-mips[64][el] [-cpu MIPS64R2-generic] -M mips -pflash flash -nographic Download kernel + initrd ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -75,61 +83,63 @@ you can downland:: Generate uImage ^^^^^^^^^^^^^^^ -.. code-block:: none +.. code-block:: bash - # tools/mkimage -A mips -O linux -T kernel -C gzip -a 0x80010000 -e 0x80245650 -n "Linux 2.6.24.y" -d vmlinux.bin.gz uImage + tools/mkimage -A mips -O linux -T kernel -C gzip -a 0x80010000 -e 0x80245650 -n "Linux 2.6.24.y" -d vmlinux.bin.gz uImage Copy uImage to Flash ^^^^^^^^^^^^^^^^^^^^ -.. code-block:: none +.. code-block:: bash - # dd if=uImage bs=1k conv=notrunc seek=224 of=flash + dd if=uImage bs=1k conv=notrunc seek=224 of=flash Generate Ide Disk ^^^^^^^^^^^^^^^^^ -.. code-block:: none +.. code-block:: bash - # dd of=ide bs=1k cout=100k if=/dev/zero + dd of=ide bs=1k count=100k if=/dev/zero - # sfdisk -C 261 -d ide - # partition table of ide + # Create partion table + sudo sfdisk ide << EOF + label: dos + label-id: 0x6fe3a999 + device: image unit: sectors - - ide1 : start= 63, size= 32067, Id=83 - ide2 : start= 32130, size= 32130, Id=83 - ide3 : start= 64260, size= 4128705, Id=83 - ide4 : start= 0, size= 0, Id= 0 + image1 : start= 63, size= 32067, Id=83 + image2 : start= 32130, size= 32130, Id=83 + image3 : start= 64260, size= 4128705, Id=83 + EOF Copy to ide ^^^^^^^^^^^ -.. code-block:: none +.. code-block:: bash - # dd if=uImage bs=512 conv=notrunc seek=63 of=ide + dd if=uImage bs=512 conv=notrunc seek=63 of=ide Generate ext2 on part 2 on Copy uImage and initrd.gz ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. code-block:: none +.. code-block:: bash # Attached as loop device ide offset = 32130 * 512 - # losetup -o 16450560 -f ide + sudo losetup -o 16450560 /dev/loop0 ide # Format as ext2 ( arg2 : nb blocks) - # mke2fs /dev/loop0 16065 - # losetup -d /dev/loop0 + sudo mkfs.ext2 /dev/loop0 16065 + sudo losetup -d /dev/loop0 # Mount and copy uImage and initrd.gz to it - # mount -o loop,offset=16450560 -t ext2 ide /mnt - # mkdir /mnt/boot - # cp {initrd.gz,uImage} /mnt/boot/ + sudo mount -o loop,offset=16450560 -t ext2 ide /mnt + sudo mkdir /mnt/boot + cp {initrd.gz,uImage} /mnt/boot/ # Umount it - # umount /mnt + sudo umount /mnt Set Environment ^^^^^^^^^^^^^^^ -.. code-block:: none +.. code-block:: bash setenv rd_start 0x80800000 setenv rd_size 2663940 @@ -157,9 +167,11 @@ Set Environment setenv addmisc 'setenv bootargs ${bootargs} console=ttyS0,${baudrate} rd_start=${rd_start} rd_size=${rd_size} ethaddr=${ethaddr}' setenv bootcmd 'run boot_tftp_flash' -Now you can boot from flash, ide, ide+ext2 and tfp:: +Now you can boot from flash, ide, ide+ext2 and tfp + +.. code-block:: bash - # qemu-system-mips -M mips -pflash flash -monitor null -nographic -net nic -net user -tftp `pwd` -hda ide + qemu-system-mips -M mips -pflash flash -monitor null -nographic -net nic -net user -tftp `pwd` -hda ide How to debug U-Boot @@ -168,9 +180,9 @@ How to debug U-Boot In order to debug U-Boot you need to start qemu with gdb server support (-s) and waiting the connection to start the CPU (-S) -.. code-block:: none +.. code-block:: bash - # qemu-system-mips -S -s -M mips -pflash flash -monitor null -nographic -net nic -net user -tftp `pwd` -hda ide + qemu-system-mips -S -s -M mips -pflash flash -monitor null -nographic -net nic -net user -tftp `pwd` -hda ide in an other console you start gdb @@ -182,7 +194,7 @@ by connecting to the gdb server localhost:1234 .. code-block:: none - # mipsel-unknown-linux-gnu-gdb u-boot + $ mipsel-unknown-linux-gnu-gdb u-boot GNU gdb 6.6 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are