You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "JianyuWang0623 (via GitHub)" <gi...@apache.org> on 2025/02/20 03:54:24 UTC

[PR] system/fastboot: Add support for oem mkrd command [nuttx-apps]

JianyuWang0623 opened a new pull request, #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003

   ## Summary
   Add support for oem mkrd command to support creating RAM disk on device via fastboot on host side.
   
   Usage
   ```
   fastboot oem mkrd <minor> <nsectors> <sectsize>
   ```
   ## Impact
   system/fastboot
   ## Testing
   ```
   0. The "esp32s3-devkit:fastboot" configuration with `SYSTEM_FASTBOOTD_MKRD` enabled
   
       ./tools/configure.sh -l esp32s3-devkit:fastboot
       # Enable `SYSTEM_FASTBOOTD_MKRD`
       make menuconfig
   
   1. List "ram10" on device side
   
       nsh> ls /dev/ram10
       nsh: ls: stat failed: 2
   
   2. Create RAM disk "ram10" on host side
   
       $ fastboot -s 1234 oem mkrd 10 2 512
                                                          OKAY [  0.001s]
       Finished. Total time: 0.001s
   
   3. List "ram10" on device side, again
   
       nsh> ls -l /dev/ram10
        brw-rw-rw-        1024 /dev/ram10
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for fastboot oem sh [nuttx-apps]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1964784830


##########
system/fastboot/Kconfig:
##########
@@ -32,4 +32,12 @@ config SYSTEM_FASTBOOTD_USB_BOARDCTL
 	---help---
 		Connect usbdev before running fastboot daemon.
 
+config SYSTEM_FASTBOOTD_SH

Review Comment:
   ```suggestion
   config SYSTEM_FASTBOOTD_SHELL
   ```



##########
system/fastboot/fastboot.c:
##########
@@ -770,6 +784,41 @@ static void fastboot_filedump(FAR struct fastboot_ctx_s *context,
   fastboot_okay(context, "");
 }
 
+#ifdef CONFIG_SYSTEM_FASTBOOTD_SH
+static void fastboot_sh(FAR struct fastboot_ctx_s *context,
+                        FAR const char *arg)
+{
+  int ret;
+
+  ret = system(arg);
+  if (ret < 0)
+    {
+      fastboot_fail(context, "Create child process failed %d error %d",
+                    ret, errno);
+      return;
+    }
+  else if (ret == 0 && arg == NULL)

Review Comment:
   ```suggestion
     else if (ret == 0)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for oem mkrd command [nuttx-apps]

Posted by "JianyuWang0623 (via GitHub)" <gi...@apache.org>.
JianyuWang0623 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1963049764


##########
system/fastboot/fastboot.c:
##########
@@ -770,6 +780,38 @@ static void fastboot_filedump(FAR struct fastboot_ctx_s *context,
   fastboot_okay(context, "");
 }
 
+#ifdef CONFIG_SYSTEM_FASTBOOTD_MKRD
+static void fastboot_mkrd(FAR struct fastboot_ctx_s *context,
+                          FAR const char *arg)
+{
+  struct boardioc_mkrd_s desc;
+  int ret = -1;
+
+  if (arg)
+    {
+      ret = sscanf(arg, "%" PRIu8 " %" PRIu32 " %" PRIu16,
+                   &desc.minor, &desc.nsectors, &desc.sectsize);
+    }
+
+  if (ret != 3)
+    {
+      fastboot_fail(context, "Usage: mkrd <minor> <nsectors> <sectsize>");
+      return;
+    }
+
+  desc.rdflags  = RDFLAG_WRENABLED | RDFLAG_FUNLINK;
+
+  ret = boardctl(BOARDIOC_MKRD, (uintptr_t)&desc);
+  if (ret < 0)
+    {
+      fastboot_fail(context, "Create RAM disk failed");

Review Comment:
   Done, Format string support for fastboot_fail() was added.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for fastboot oem sh [nuttx-apps]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1964788319


##########
system/fastboot/fastboot.c:
##########
@@ -770,6 +784,41 @@ static void fastboot_filedump(FAR struct fastboot_ctx_s *context,
   fastboot_okay(context, "");
 }
 
+#ifdef CONFIG_SYSTEM_FASTBOOTD_SH
+static void fastboot_sh(FAR struct fastboot_ctx_s *context,
+                        FAR const char *arg)
+{
+  int ret;
+
+  ret = system(arg);

Review Comment:
   should we call popen? so we can retrieve the output from the command(e.g. ps).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for fastboot oem shell [nuttx-apps]

Posted by "jerpelea (via GitHub)" <gi...@apache.org>.
jerpelea merged PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for oem mkrd command [nuttx-apps]

Posted by "JianyuWang0623 (via GitHub)" <gi...@apache.org>.
JianyuWang0623 commented on PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#issuecomment-2670401622

   @Donny9 @yangsong8-ai Could you review this PR please?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for fastboot oem sh [nuttx-apps]

Posted by "JianyuWang0623 (via GitHub)" <gi...@apache.org>.
JianyuWang0623 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1964834854


##########
system/fastboot/fastboot.c:
##########
@@ -770,6 +784,41 @@ static void fastboot_filedump(FAR struct fastboot_ctx_s *context,
   fastboot_okay(context, "");
 }
 
+#ifdef CONFIG_SYSTEM_FASTBOOTD_SH
+static void fastboot_sh(FAR struct fastboot_ctx_s *context,
+                        FAR const char *arg)
+{
+  int ret;
+
+  ret = system(arg);
+  if (ret < 0)
+    {
+      fastboot_fail(context, "Create child process failed %d error %d",
+                    ret, errno);
+      return;
+    }
+  else if (ret == 0 && arg == NULL)

Review Comment:
   @xiaoxiang781216  Need kept maybe.
   If command is NULL, then a nonzero value if a shell is available, or 0 if no shell is available. -- SYSTEM(3)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for fastboot oem sh [nuttx-apps]

Posted by "JianyuWang0623 (via GitHub)" <gi...@apache.org>.
JianyuWang0623 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1964742283


##########
system/fastboot/fastboot.c:
##########
@@ -200,7 +207,10 @@ static const struct fastboot_cmd_s g_fast_cmd[] =
 static const struct fastboot_cmd_s g_oem_cmd[] =
 {
   { "filedump",           fastboot_filedump         },
-  { "memdump",            fastboot_memdump          }
+  { "memdump",            fastboot_memdump          },
+#ifdef CONFIG_SYSTEM_FASTBOOTD_MKRD
+  { "mkrd",               fastboot_mkrd             },

Review Comment:
   got it, done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for fastboot oem sh [nuttx-apps]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1964784830


##########
system/fastboot/Kconfig:
##########
@@ -32,4 +32,12 @@ config SYSTEM_FASTBOOTD_USB_BOARDCTL
 	---help---
 		Connect usbdev before running fastboot daemon.
 
+config SYSTEM_FASTBOOTD_SH

Review Comment:
   ```suggestion
   config SYSTEM_FASTBOOTD_SHELL
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for oem mkrd command [nuttx-apps]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1963832263


##########
system/fastboot/fastboot.c:
##########
@@ -200,7 +207,10 @@ static const struct fastboot_cmd_s g_fast_cmd[] =
 static const struct fastboot_cmd_s g_oem_cmd[] =
 {
   { "filedump",           fastboot_filedump         },
-  { "memdump",            fastboot_memdump          }
+  { "memdump",            fastboot_memdump          },
+#ifdef CONFIG_SYSTEM_FASTBOOTD_MKRD
+  { "mkrd",               fastboot_mkrd             },

Review Comment:
   even that it's still better to invoke system("mkrd...")(or popen to get the output), you can add a white list and check it before invoking system/popen, so you don't need duplicate the parse code and extend the new command easily.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for fastboot oem sh [nuttx-apps]

Posted by "JianyuWang0623 (via GitHub)" <gi...@apache.org>.
JianyuWang0623 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1964742283


##########
system/fastboot/fastboot.c:
##########
@@ -200,7 +207,10 @@ static const struct fastboot_cmd_s g_fast_cmd[] =
 static const struct fastboot_cmd_s g_oem_cmd[] =
 {
   { "filedump",           fastboot_filedump         },
-  { "memdump",            fastboot_memdump          }
+  { "memdump",            fastboot_memdump          },
+#ifdef CONFIG_SYSTEM_FASTBOOTD_MKRD
+  { "mkrd",               fastboot_mkrd             },

Review Comment:
   @xiaoxiang781216  got it, done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for fastboot oem sh [nuttx-apps]

Posted by "JianyuWang0623 (via GitHub)" <gi...@apache.org>.
JianyuWang0623 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1964833572


##########
system/fastboot/fastboot.c:
##########
@@ -770,6 +784,41 @@ static void fastboot_filedump(FAR struct fastboot_ctx_s *context,
   fastboot_okay(context, "");
 }
 
+#ifdef CONFIG_SYSTEM_FASTBOOTD_SH
+static void fastboot_sh(FAR struct fastboot_ctx_s *context,
+                        FAR const char *arg)
+{
+  int ret;
+
+  ret = system(arg);

Review Comment:
   OK, and maybe we need send "INFO" or "TEXT" response to make sure the entire output from the command was sent instead of "OKAY"(no greater than 256 bytes.).
   https://android.googlesource.com/platform/system/core/+/refs/heads/main/fastboot/README.md#transport-and-framing



##########
system/fastboot/fastboot.c:
##########
@@ -770,6 +784,41 @@ static void fastboot_filedump(FAR struct fastboot_ctx_s *context,
   fastboot_okay(context, "");
 }
 
+#ifdef CONFIG_SYSTEM_FASTBOOTD_SH
+static void fastboot_sh(FAR struct fastboot_ctx_s *context,
+                        FAR const char *arg)
+{
+  int ret;
+
+  ret = system(arg);

Review Comment:
   @xiaoxiang781216  OK, and maybe we need send "INFO" or "TEXT" response to make sure the entire output from the command was sent instead of "OKAY"(no greater than 256 bytes.).
   https://android.googlesource.com/platform/system/core/+/refs/heads/main/fastboot/README.md#transport-and-framing



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for oem mkrd command [nuttx-apps]

Posted by "JianyuWang0623 (via GitHub)" <gi...@apache.org>.
JianyuWang0623 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1963049599


##########
system/fastboot/Kconfig:
##########
@@ -31,4 +31,12 @@ config FASTBOOTD_USB_BOARDCTL
 	---help---
 		Connect usbdev before running fastboot daemon.
 
+config SYSTEM_FASTBOOTD_MKRD
+	bool "Create RAM disk"
+	default n
+	depends on BOARDCTL

Review Comment:
   @Donny9 all done.



##########
system/fastboot/fastboot.c:
##########
@@ -770,6 +780,38 @@ static void fastboot_filedump(FAR struct fastboot_ctx_s *context,
   fastboot_okay(context, "");
 }
 
+#ifdef CONFIG_SYSTEM_FASTBOOTD_MKRD
+static void fastboot_mkrd(FAR struct fastboot_ctx_s *context,
+                          FAR const char *arg)
+{
+  struct boardioc_mkrd_s desc;
+  int ret = -1;
+
+  if (arg)
+    {
+      ret = sscanf(arg, "%" PRIu8 " %" PRIu32 " %" PRIu16,
+                   &desc.minor, &desc.nsectors, &desc.sectsize);
+    }
+
+  if (ret != 3)
+    {
+      fastboot_fail(context, "Usage: mkrd <minor> <nsectors> <sectsize>");
+      return;
+    }
+
+  desc.rdflags  = RDFLAG_WRENABLED | RDFLAG_FUNLINK;
+
+  ret = boardctl(BOARDIOC_MKRD, (uintptr_t)&desc);
+  if (ret < 0)
+    {
+      fastboot_fail(context, "Create RAM disk failed");

Review Comment:
   done



##########
system/fastboot/fastboot.c:
##########
@@ -770,6 +780,38 @@ static void fastboot_filedump(FAR struct fastboot_ctx_s *context,
   fastboot_okay(context, "");
 }
 
+#ifdef CONFIG_SYSTEM_FASTBOOTD_MKRD
+static void fastboot_mkrd(FAR struct fastboot_ctx_s *context,
+                          FAR const char *arg)
+{
+  struct boardioc_mkrd_s desc;
+  int ret = -1;
+
+  if (arg)

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for oem mkrd command [nuttx-apps]

Posted by "JianyuWang0623 (via GitHub)" <gi...@apache.org>.
JianyuWang0623 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1963067653


##########
system/fastboot/fastboot.c:
##########
@@ -200,7 +207,10 @@ static const struct fastboot_cmd_s g_fast_cmd[] =
 static const struct fastboot_cmd_s g_oem_cmd[] =
 {
   { "filedump",           fastboot_filedump         },
-  { "memdump",            fastboot_memdump          }
+  { "memdump",            fastboot_memdump          },
+#ifdef CONFIG_SYSTEM_FASTBOOTD_MKRD
+  { "mkrd",               fastboot_mkrd             },

Review Comment:
   @xiaoxiang781216 
   1. Invoke `system()` directly may be too open for bootloader.
   2. No other application scenarios except "sh mkrd" currently.
   3. The function overlaps with ADB shell service (Althouth Fastboot and ADB can not be enabled at the same time at present)..
   
   So, I want to be cautious and narrow the scope to only implement the necessary "mkrd" function ;-)
   
   Will add support for oem sh to execute custom commands if it is necessary.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for oem mkrd command [nuttx-apps]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1963832263


##########
system/fastboot/fastboot.c:
##########
@@ -200,7 +207,10 @@ static const struct fastboot_cmd_s g_fast_cmd[] =
 static const struct fastboot_cmd_s g_oem_cmd[] =
 {
   { "filedump",           fastboot_filedump         },
-  { "memdump",            fastboot_memdump          }
+  { "memdump",            fastboot_memdump          },
+#ifdef CONFIG_SYSTEM_FASTBOOTD_MKRD
+  { "mkrd",               fastboot_mkrd             },

Review Comment:
   even that it's still better to invoke system("mkrd...")(or popen to get the output), you can add a white list and check it before invoking system, so you don't need duplicate the parse code and extend the new command easily.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for oem mkrd command [nuttx-apps]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1963832263


##########
system/fastboot/fastboot.c:
##########
@@ -200,7 +207,10 @@ static const struct fastboot_cmd_s g_fast_cmd[] =
 static const struct fastboot_cmd_s g_oem_cmd[] =
 {
   { "filedump",           fastboot_filedump         },
-  { "memdump",            fastboot_memdump          }
+  { "memdump",            fastboot_memdump          },
+#ifdef CONFIG_SYSTEM_FASTBOOTD_MKRD
+  { "mkrd",               fastboot_mkrd             },

Review Comment:
   even that it's still better to invoke system("mkrd..."), you can add a white list and check it before invoking system, so you don't need duplicate the parse code and extend the new command easily.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for fastboot oem sh [nuttx-apps]

Posted by "JianyuWang0623 (via GitHub)" <gi...@apache.org>.
JianyuWang0623 commented on PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#issuecomment-2673541891

   @xiaoxiang781216 @Donny9 @yangsong8-ai Here are 2 problems:
   ### 1. Output format: Fastboot tool version & response code "TEXT", "INFO"
   - The print format of "INFO" is: "(bootloader) " + InfoMessagePayload + ā€˜\n’, which break the original format
       ```
       $ fastboot oem sh ls /dev/
                                                          (bootloader) /dev:
       
       (bootloader)  console
       
       (bootloader)  fastboot/
       
       (bootloader)  null
       
       (bootloader)  ram0
       
       (bootloader)  ttyS0
       
       (bootloader)  zero
       ```
   
   - fastboot version 28.0.2-debian doesn`t support "TEXT", the latest version(fastboot version 35.0.2-12147458) supports
       - 28.0.2-debian 
       ```
       $ fastboot --version
       fastboot version 28.0.2-debian
       Installed as /usr/lib/android-sdk/platform-tools/fastboot
       
       $ fastboot oem sh ls /dev/
                                                          FAILED (Device sent unknown status code: TEXT console
       )
       fastboot: error: Command failed
       ```
       - 35.0.2-12147458
       ```
       $ ./platform-tools/fastboot oem sh ls /dev/
       /dev:
        console
        fastboot/
        null
        ram0
        ttyS0
        zero
       ```
       - source
       ```
       ^be8f723e6 (Arve Hj?nnev?g 2024-08-01 00:19:49 +0000 503)         } else if (android::base::StartsWith(input, "TEXT")) {
       ^be8f723e6 (Arve Hj?nnev?g 2024-08-01 00:19:49 +0000 504)             text_(input.substr(strlen("TEXT")));
       ^be8f723e6 (Arve Hj?nnev?g 2024-08-01 00:19:49 +0000 505)             // Reset timeout as many more TEXT may come
       ^be8f723e6 (Arve Hj?nnev?g 2024-08-01 00:19:49 +0000 506)             start = std::chrono::steady_clock::now();
       ^be8f723e6 (Arve Hj?nnev?g 2024-08-01 00:19:49 +0000 507)         } else if (android::base::StartsWith(input, "DATA")) {
       ... ...
       ^be8f723e6 (Arve Hj?nnev?g 2024-08-01 00:19:49 +0000 517)         } else {
       ^be8f723e6 (Arve Hj?nnev?g 2024-08-01 00:19:49 +0000 518)             error_ = android::base::StringPrintf("Device sent unknown status code: %s", status);
       ^be8f723e6 (Arve Hj?nnev?g 2024-08-01 00:19:49 +0000 519)             return BAD_DEV_RESP;
       ^be8f723e6 (Arve Hj?nnev?g 2024-08-01 00:19:49 +0000 520)         }
       ```
   
   **Maybe we can suggest using the latest version fastboot tool and use "TEXT" for pretty format.**
   
   
   ### 2. The exit status of the command was incorrect, maybe pclose() has some bugs?
       ```
       $ ./platform-tools/fastboot oem sh ps
         PID GROUP PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK            STACK COMMAND
           0     0   0 FIFO     Kthread   - Ready              0000000000000000 0003056 Idle_Task
           1     0 224 RR       Kthread   - Waiting  Semaphore 0000000000000000 0001976 hpwork 0x3fc8bb90 0x3fc8bbc0
           2     2 100 RR       Task      - Waiting  Semaphore 0000000000000000 0004048 nsh_main
           3     3 100 RR       Task      - Ready              0000000000000000 0001992 fastbootd
           4     4 100 RR       Task      - Running            0000000000000000 0001992 popen -c ps
       FAILED (remote: 'error detected -1 10')
       fastboot: error: Command failed
       ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for oem mkrd command [nuttx-apps]

Posted by "Donny9 (via GitHub)" <gi...@apache.org>.
Donny9 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1962992077


##########
system/fastboot/Kconfig:
##########
@@ -31,4 +31,12 @@ config FASTBOOTD_USB_BOARDCTL
 	---help---
 		Connect usbdev before running fastboot daemon.
 
+config SYSTEM_FASTBOOTD_MKRD
+	bool "Create RAM disk"
+	default n
+	depends on BOARDCTL

Review Comment:
   remove BOARDCTL, BOARDCTL_MKRD depends on BOARDCTL



##########
system/fastboot/fastboot.c:
##########
@@ -770,6 +780,38 @@ static void fastboot_filedump(FAR struct fastboot_ctx_s *context,
   fastboot_okay(context, "");
 }
 
+#ifdef CONFIG_SYSTEM_FASTBOOTD_MKRD
+static void fastboot_mkrd(FAR struct fastboot_ctx_s *context,
+                          FAR const char *arg)
+{
+  struct boardioc_mkrd_s desc;
+  int ret = -1;
+
+  if (arg)
+    {
+      ret = sscanf(arg, "%" PRIu8 " %" PRIu32 " %" PRIu16,
+                   &desc.minor, &desc.nsectors, &desc.sectsize);
+    }
+
+  if (ret != 3)
+    {
+      fastboot_fail(context, "Usage: mkrd <minor> <nsectors> <sectsize>");
+      return;
+    }
+
+  desc.rdflags  = RDFLAG_WRENABLED | RDFLAG_FUNLINK;
+
+  ret = boardctl(BOARDIOC_MKRD, (uintptr_t)&desc);
+  if (ret < 0)
+    {
+      fastboot_fail(context, "Create RAM disk failed");

Review Comment:
   add ret output



##########
system/fastboot/fastboot.c:
##########
@@ -770,6 +780,38 @@ static void fastboot_filedump(FAR struct fastboot_ctx_s *context,
   fastboot_okay(context, "");
 }
 
+#ifdef CONFIG_SYSTEM_FASTBOOTD_MKRD
+static void fastboot_mkrd(FAR struct fastboot_ctx_s *context,
+                          FAR const char *arg)
+{
+  struct boardioc_mkrd_s desc;
+  int ret = -1;
+
+  if (arg)

Review Comment:
   arg != NULL



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for oem mkrd command [nuttx-apps]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#discussion_r1963033108


##########
system/fastboot/fastboot.c:
##########
@@ -200,7 +207,10 @@ static const struct fastboot_cmd_s g_fast_cmd[] =
 static const struct fastboot_cmd_s g_oem_cmd[] =
 {
   { "filedump",           fastboot_filedump         },
-  { "memdump",            fastboot_memdump          }
+  { "memdump",            fastboot_memdump          },
+#ifdef CONFIG_SYSTEM_FASTBOOTD_MKRD
+  { "mkrd",               fastboot_mkrd             },

Review Comment:
   why not implement a general command which invoke system function directly?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] system/fastboot: Add support for fastboot oem shell [nuttx-apps]

Posted by "JianyuWang0623 (via GitHub)" <gi...@apache.org>.
JianyuWang0623 commented on PR #3003:
URL: https://github.com/apache/nuttx-apps/pull/3003#issuecomment-2678718417

   > please add commit message [fb4c03f](https://github.com/apache/nuttx-apps/commit/fb4c03f4135dde4e6bc6c90e55ceba0ebb28f373)
   
   @jerpelea done, thank you.
   ```diff
   +Add support for producing output according to a format like printf().
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org