From patchwork Tue Jun 23 00:27:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kovalivskyi X-Patchwork-Id: 1314806 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=pass (p=reject dis=none) header.from=globallogic.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=globallogic.com header.i=@globallogic.com header.a=rsa-sha256 header.s=google header.b=DnUpJGas; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49rRw304t3z9sSf for ; Tue, 23 Jun 2020 10:28:32 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A49C481E48; Tue, 23 Jun 2020 02:28:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=globallogic.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=globallogic.com header.i=@globallogic.com header.b="DnUpJGas"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 47F5F81E48; Tue, 23 Jun 2020 02:28:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0C74681DE7 for ; Tue, 23 Jun 2020 02:28:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=globallogic.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=roman.kovalivskyi@globallogic.com Received: by mail-lj1-x242.google.com with SMTP id n23so21374987ljh.7 for ; Mon, 22 Jun 2020 17:28:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=globallogic.com; s=google; h=from:to:cc:subject:date:message-id; bh=MIFAAXUm91ecZ+iC7ASiwGiPW9QJ5Vxe+NaSwOxTXa0=; b=DnUpJGasfyiK3xOiJk7DnkqAoQOueWepnScia6qeG5uJ2Ow9atrW+I5Za1cMiabqvc Caiyl21ceZV8AfTW6ptT6KsFz68A4O+ZRXHEEyXLr0GalimFfIpOW6FctxNoKHeEoJNA guTwDpVuLwvDm2Wb6eNitmIPT9IX67WRoIvlGw8wVeosKXuHY4byclKvl7c36D0Fm8Go F+IyjRFCv4+G+NIVDqz92364F5mIiJFyyGvZAGA4Zemt8GHna1tQLA0TosNnohxwqnhK gdS3hzTy0hvmJIw6IM5lgmnKxL1S8bkKAzOnN2h+JGzLJSMzf7cTSMeW/i0erKEncYGg UIWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MIFAAXUm91ecZ+iC7ASiwGiPW9QJ5Vxe+NaSwOxTXa0=; b=uP824/V2Ij4GgbVnnffKRPEMs06Xlsl4T1M3ENZ8x2YPIS+KW29/sMhZd8nEMUdZjn tJAPUgEO+UfHAV4S4+TMiMAIux/EpXkRJlcVgmhUZHQDsm0fxXJJkdpJzFlelVhP2LjT Q21nUNSWA65AhuDs8uCMFabvu+C5rWkGjGz97MYnDHdjxFM7WIKsVcJixOTzo7rVI0YH i+fYSCkH6CwTopXgGgYvsHF36wqEqDeqPkFX2Y0p4d2eD5WVZlD7L0iFGyu46PD7i1M0 NjAB8Iz+r+C7fUmhpE8vbIdPZEgW3wQcdvWnPsgKKx05i0DPVBYVYr8J0KqC0gv99TTr bmiw== X-Gm-Message-State: AOAM533NLPQ5/zvdhn+/GEX/3NMIMbIc5zqS7YlglYtWNaknETnlWJm1 fTpwEIkuv//WwH8Gi7gcPHVfeXFjAXZe/g== X-Google-Smtp-Source: ABdhPJyKGF38ZSdnKwIf240j+RbeS5OfeI3ZhC7o8VRiEqHS17vezOWO2dtINCCxAoGJ8Ux1d0vl2g== X-Received: by 2002:a2e:871a:: with SMTP id m26mr1039155lji.418.1592872085837; Mon, 22 Jun 2020 17:28:05 -0700 (PDT) Received: from localhost.localdomain ([159.224.5.60]) by smtp.googlemail.com with ESMTPSA id o6sm144233ljh.42.2020.06.22.17.28.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 17:28:05 -0700 (PDT) From: Roman Kovalivskyi To: u-boot@lists.denx.de Cc: Roman Stratiienko , Joe Hershberger , Roman Kovalivskyi , Simon Glass , Marek Vasut , Lukasz Majewski , Eugeniu Rosca , Alex Kiernan , Sam Protsenko , Neil Armstrong , Philipp Tomsich , Kever Yang , Paul Kocialkowski , Lokesh Vutla , Jagan Teki , Miquel Raynal , Boris Brezillon , Tom Rini , Igor Opaniuk , Aleksandr Bulyshchenko Subject: [PATCH v4 0/3] Add support for booting into userspace fastboot Date: Tue, 23 Jun 2020 03:27:52 +0300 Message-Id: X-Mailer: git-send-email 2.17.1 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Android 10 adds support for dynamic partitions and in order to support them userspace fastboot must be used[1]. New tool called fastbootd is included into recovery image. Userspace fastboot works from recovery and is launched if: 1) - Dynamic partitioning is enabled 2) - Boot control block has 'boot-fastboot' value into command field The bootloader is expected[2] to load and boot into the recovery image upon seeing boot-fastboot in the BCB command. Recovery then parses the BCB message and switches to fastbootd mode. Please note that boot script is expected to handle 'boot-fastboot' command in BCB and load into recovery mode. Bootloader must support[3] 'reboot fastboot' command which should reboot device into userspace fastboot to accomodate those changes. Another command that bootloader must support[3] is 'reboot recovery'. This command should simply reboot device into recovery mode. Changes since v3[6]: * Fixed indentation in Kconfig * Fixed default value for FASTBOOT_USE_BCB_SET_REBOOT_FLAG * Extended help message for FASTBOOT_USE_BCB_SET_REBOOT_FLAG Changes since v2[5]: * Split patch 1 into two separate patches: * Patch 1 extends fastboot_set_reboot_flag arguments with reboot reason * Patch 2 adds new reboot reasons for fastbootd and recovery * Added name for fastboot_rebot_reason enum * Replaced switch inside fastboot_set_reboot_flag with table lookup * Moved fastboot_set_reboot_flag BCB implementation to separate file Changes since v1[4]: * Added missing handling of reboot commands for network protocol * Extended fastboot_set_reboot_flag command to accept reboot reason * Made former fastboot_set_flag function as an optional implementation of fastboot_set_reboot_flag which could be turned on by Kconfig [1] - https://source.android.com/devices/bootloader/fastbootd [2] - https://source.android.com/devices/bootloader/fastbootd#unified_fastboot_and_recovery [3] - https://source.android.com/devices/bootloader/fastbootd#modifications_to_the_bootloader [4] - http://patchwork.ozlabs.org/project/uboot/cover/cover.1590539734.git.roman.kovalivskyi@globallogic.com/ [5] - http://patchwork.ozlabs.org/project/uboot/cover/cover.1591254465.git.roman.kovalivskyi@globallogic.com/ [6] - http://patchwork.ozlabs.org/project/uboot/cover/cover.1591806433.git.roman.kovalivskyi@globallogic.com/ Roman Kovalivskyi (3): fastboot: Extend fastboot_set_reboot_flag with reboot reason fastboot: Add support for 'reboot fastboot' command fastboot: Add default fastboot_set_reboot_flag implementation arch/arm/mach-meson/board-common.c | 6 +++- arch/arm/mach-rockchip/board.c | 6 +++- board/amazon/kc1/kc1.c | 6 +++- board/lg/sniper/sniper.c | 6 +++- board/ti/am57xx/board.c | 6 +++- board/ti/dra7xx/evm.c | 6 +++- drivers/fastboot/Kconfig | 12 ++++++++ drivers/fastboot/Makefile | 1 + drivers/fastboot/fb_bcb_impl.c | 48 ++++++++++++++++++++++++++++++ drivers/fastboot/fb_command.c | 40 ++++++++++++++++++++++++- drivers/fastboot/fb_common.c | 2 +- drivers/usb/gadget/f_fastboot.c | 2 ++ include/fastboot.h | 14 ++++++++- net/fastboot.c | 2 ++ 14 files changed, 148 insertions(+), 9 deletions(-) create mode 100644 drivers/fastboot/fb_bcb_impl.c